Search code examples
c#.netwcfsecuritywcf-security

How to enable Security logging in WCF Service using auditLogLocation="Security"


I am working on WCF Logging module. I want to enable all Security logging with WCF Service. like there are three options in auditLogLocation="Application | Security | Default. I have used Application but I want to enable Security option. I read this link Auditing Security Events.

All I want to know how to enable SeAuditPrivilege and SeSecurityPrivilege in WCF Service.

Here is my configuration

<behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="true" serviceAuthorizationAuditLevel="SuccessOrFailure"
            messageAuthenticationAuditLevel="SuccessOrFailure" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

Solution

  • You should be able to configure WCF Security Auditing, to log security events to the Windows event log, by specifying the following in the configuration file:

    Service Behavior definition: (e.g.)

    <behaviors>
       <behavior name="myAuditBehavior">
          <serviceSecurityAudit auditLogLocation="Application"
                suppressAuditFailure="false" 
                serviceAuthorizationAuditLevel="None" 
                messageAuthenticationAuditLevel="SuccessOrFailure" />
          </behavior>
    </behaviors>
    

    Service Behavior referenced in the service definition:

    <services>
        <service behaviorConfiguration=" myAuditBehavior" ...
           <endpoint 
    

    Reference: http://msdn.microsoft.com/en-us/library/ms734737(v=vs.110).aspx

    Note: you do not show the service section of your configuration section, so you need to make sure the service is using correct behavior.

    Regards,