【问题标题】:How to enable Security logging in WCF Service using auditLogLocation="Security"如何使用 auditLogLocation="Security" 在 WCF 服务中启用安全日志记录
【发布时间】:2013-12-27 09:26:47
【问题描述】:

我正在开发 WCF 日志记录模块。我想使用 WCF 服务启用所有安全日志记录。就像auditLogLocation="Application | Security | Default 中有三个选项一样。我使用了Application,但我想启用Security 选项。我读了这个链接Auditing Security Events。

我只想知道如何在 WCF 服务中启用 SeAuditPrivilege 和 SeSecurityPrivilege。

这是我的配置

<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>

【问题讨论】:

    标签: c# .net wcf security wcf-security


    【解决方案1】:

    您应该能够配置 WCF 安全审核,将安全事件记录到 Windows 事件日志中,方法是在配置文件中指定以下内容:

    服务行为定义:(例如)

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

    服务定义中引用的服务行为:

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

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

    注意:您不显示配置部分的服务部分,因此您需要确保服务使用正确的行为。

    问候,

    【讨论】:

    • 我们需要把auditLogLocation="Application"改成Security吗?
    • 我认为您可以决定要将事件写入何处,应用程序或安全事件日志。以下 sn-p 说明: AuditLogLocation 枚举具有三个值:Application、Security 或 Default。该值指定事件查看器中可见的日志之一,安全日志或应用程序日志。
    • 当我使用上面的配置并进行一些更改,如 Contract 它停止工作
    • 您可能需要检查 WCF 跟踪文件以了解它“停止工作”的原因。参考:msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx
    猜你喜欢
    • 2015-08-31
    • 1970-01-01
    • 1970-01-01
    • 2020-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多