第10章 監査


政府機関の中には、実装のソフトウェアコンポーネントを確実に追跡できるようにエンタープライズアプリケーションにおける監査や、設計パラメータ内での動作を義務付けているところがあります。さらに、標準のアプリケーション監査に加え、政府規制および規格には監査制御が必要です。
システム管理者は、セキュリティイベント監査が常にセキュリティドメインの動作とデプロイされた Web および EJB アプリケーションを監視できるようにします。

重要

セキュリティイベント監査は、高いイベントボリュームを管理するサーバーのパフォーマンスに影響することがあります。監査はデフォルトでは無効になっており、要求に応じて使用できるよう設定した方がよいでしょう。
セキュリティイベント監査の有効化は Web コンポーネントと EJB コンポーネントでは異なります。手順10.1「セキュリティ監査機能の有効化」 では実装における EJB の監査サービスを有効にする最小限のステップを説明しています。手順10.2「Web コンテナにセキュリティ監査を有効化」 では Web コンテナに対するセキュリティイベント監査を有効にする方法を説明しています。

重要

Web コンテナイベント監査によりユーザーの機密情報が露呈される恐れがあります。管理者は、Web コンテナイベントにセキュリティ監査を設定する場合はパスワードハッシュなどの適切なデータ保護の手順を確実に実行する必要があります。

手順10.1 セキュリティ監査機能の有効化

  1. log4j 設定ファイルを開きます

    $JBOSS_HOME/server/$PROFILE/conf/ に移動します。
    テキストエディタを使用して jboss-log4j.xml ファイルを開きます。
  2. セキュリティ監査カテゴリを非コメント化します

    デフォルトでは、jboss-log4j.xml ファイルの Security Audit Provider カテゴリの定義はコメントアウトされています。例10.1「log4j Security Audit Provider のカテゴリ」 で示されているカテゴリ定義を非コメント化します。

    例10.1 log4j Security Audit Provider のカテゴリ

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- Limit the verbose MC4J EMS (lib used by admin-console) categories -->
    <category name="org.mc4j.ems">
      <priority value="WARN"/>
    </category>
       
    <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
    <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
      <priority value="TRACE"/>
    </category>
       -->
    
    <!-- Category specifically for Security Audit Provider -->
    <category name="org.jboss.security.audit.providers.LogAuditProvider" additivity="false">
    <priority value="TRACE"/>
      <appender-ref ref="AUDIT"/>
    </category>
    
       
    <!-- Limit the org.jboss.serial (jboss-serialization) to INFO as its DEBUG is verbose -->
    <category name="org.jboss.serial">
      <priority value="INFO"/>
    </category>
    
    
    Copy to Clipboard Toggle word wrap
  3. Audit appender を非コメント化します

    デフォルトでは、jboss-log4j.xml ファイルの AUDIT appender の定義はコメントアウトされています。例10.1「log4j Security Audit Provider のカテゴリ」 で示されている appender の定義を非コメント化します。

    例10.2 log4j Security Audit Provider のカテゴリ

    ...
    <!--  Emit events as JMX notifications
    <appender name="JMX" class="org.jboss.monitor.services.JMXNotificationAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="Threshold" value="WARN"/>
      <param name="ObjectName" value="jboss.system:service=Logging,type=JMXNotificationAppender"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %-5p [%c] %m"/>
      </layout>
    </appender>
    -->
    
    <!-- Security AUDIT Appender -->
    <appender name="AUDIT" class="org.jboss.logging.appender.DailyRollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.log.dir}/audit.log"/>
      <param name="Append" value="true"/>
      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %-5p [%c] (%t:%x) %m%n"/>
      </layout>
    </appender>
       
       <!-- ================ -->
       <!-- Limit categories -->
       <!-- ================ -->
    
    <!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
    <category name="org.apache">
      <priority value="INFO"/>
    </category>
    ...
    
    Copy to Clipboard Toggle word wrap
  4. 保存して、サーバーを再起動します

    これで、jboss-log4j.xml ファイルで設定したとおり実装に対し監査サービスをアクティブにすることができました。
    サーバーを再起動して、新しいセキュリティポリシーが有効であることを確認してください。
  5. セキュリティ監査が正しく機能していることを確認します

    監査サービスが設定、デプロイされた時点で、監査ログエントリは監査サービスと EJB 呼び出しが成功したかを確認します。
    audit.log ファイルは jboss-as/server/$PROFILE/log/ ディレクトリにあります。
    成功する EJB 呼び出しは、次の audit.log 出力に似ています。

    例10.3 成功する EJB 呼び出しのログエントリ

    2008-12-05 16:08:26,719 TRACE [org.jboss.security.audit.providers.LogAuditProvider] (http-127.0.0.1-8080-2:) [Success]policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518; Resource:=[org.jboss.security.authorization.resources.EJBResource:contextMap={policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518}:method=public abstract org.jboss.test.security.interfaces.RunAsServiceRemote org.jboss.test.security.interfaces.RunAsServiceRemoteHome.create() throws java.rmi.RemoteException,javax.ejb.CreateException:ejbMethodInterface=Home:ejbName=RunAs:ejbPrincipal=jduke:MethodRoles=Roles(identitySubstitutionCaller,):securityRoleReferences=null:callerSubject=Subject:
            Principal: [roles=[identitySubstitutionCaller, extraRunAsRole],principal=runAsUser]
            Principal: Roles(members:extraRunAsRole,identitySubstitutionCaller)
    :callerRunAs=[roles=[identitySubstitutionCaller, extraRunAsRole],principal=runAsUser]:callerRunAs=[roles=[identitySubstitutionCaller, extraRunAsRole],principal=runAsUser]:ejbRestrictionEnforcement=false:ejbVersion=null];Source=org.jboss.security.plugins.javaee.EJBAuthorizationHelper;Exception:=;
    Copy to Clipboard Toggle word wrap
    失敗する EJB 呼び出しは、次の audit.log 出力に似ています。

    例10.4 失敗する EJB 呼び出しのログエントリ

    [Error]policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518;Resource:=[org.jboss.security.authorization.resources.EJBResource:contextMap={policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518}:method=public java.security.Principal org.jboss.test.security.ejb3.SimpleStatelessSessionBean.invokeUnavailableMethod():ejbMethodInterface=Remote:ejbName=SimpleStatelessSessionBean:ejbPrincipal=UserA:MethodRoles=Roles(<NOBODY>,):securityRoleReferences=null:callerSubject=Subject:
            Principal: UserA
            Principal: Roles(members:RegularUser,Administrator)
    :callerRunAs=null:callerRunAs=null:ejbRestrictionEnforcement=false:ejbVersion=null];Source=org.jboss.security.plugins.javaee.EJBAuthorizationHelper;Exception:=Authorization Failed: ;
    Copy to Clipboard Toggle word wrap

手順10.2 Web コンテナにセキュリティ監査を有効化

  1. EJB セキュリティ監査を有効にします

    手順10.1「セキュリティ監査機能の有効化」 の説明通りセキュリティを有効にする必要があります。
  2. サーバーレルムで監査を有効にします

    Web コンテナ監査は server.xml ファイルのサーバーレルムで最初にアクティブにする必要があります。
    server.xml ファイルは jboss-as/server/$PROFILE/deploy/jbossweb.sar/ ディレクトリにあります。
    <Realm> 要素には 例10.5「server.xml 監査のアクティブ化」 ごとに enableAudit="true" 属性セットがなければなりません。

    例10.5 server.xml 監査のアクティブ化

    <Realm className="org.jboss.web.tomcat.security.JBossWebRealm" certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping" allRolesMode="authOnly" 
    enableAudit="true"/>
    Copy to Clipboard Toggle word wrap
  3. 監査レベルのシステムプロパティを指定します

    Web アプリケーションの監査レベルは run.sh (Linux) または run.bat (Microsoft Windows) スクリプトの org.jboss.security.web.audit システムプロパティを使用して指定する必要があります。
    別の方法として、jboss-as/server/$PROFILE/deploy/properties-service.xml ファイルのシステムプロパティを指定することもできます。
    • Linux

      jboss-as/bin/run.sh ファイルにシステムプロパティを追加します。
      ## Specify the Security Audit options
      #System Property setting to configure the web audit:
      #* off = turn it off
      #* headers = audit the headers
      #* cookies = audit the cookie
      #* parameters = audit the parameters
      #* attributes = audit the attributes
      #* headers,cookies,parameters = audit the headers,cookie and 
      #                               parameters
      #* headers,cookies = audit the headers and cookies
      JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.security.web.audit=headers,cookies,parameter"
      Copy to Clipboard Toggle word wrap
    • Microsoft Windows

      jboss-as/bin/run.bat ファイルにシステムプロパティを追加します。
      rem Specify the Security Audit options
      rem System Property setting to configure the web audit
      rem * off = turn it off
      rem * headers = audit the headers
      rem * cookies = audit the cookie
      rem * parameters = audit the parameters
      rem * attributes = audit the attributes
      rem * headers,cookies,parameters = audit the headers,cookie and
      rem   parameters
      rem * headers,cookies = audit the headers and cookies
      set JAVA_OPTS=%JAVA_OPTS% " -Dorg.jboss.security.web.audit=headers,cookies,parameter"
      Copy to Clipboard Toggle word wrap
    • properties-service.xml

      jboss-as/server/$PROFILE/deploy/properties-service.xml ファイルの SystemPropertiesService クラス MBeanを更新し、<attribute> として java プロパティを宣言します。以下のコードサンプルで関連するオペレーティングシステムブロックを非コメント化できます。
      ...
      
      <mbean code="org.jboss.varia.property.SystemPropertiesService" 
      name="jboss:type=Service,name=SystemProperties">
      
         <!-- Linux Attribute Declaration -->
         <!--
         <attribute name="Properties">JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.security.web.audit=headers,cookies,parameter"
         </attribute>
         -->
      
         <!-- Windows Attribute Declaration -->
         <!--
         <attribute name="Properties">JAVA_OPTS=%JAVA_OPTS% " -Dorg.jboss.security.web.audit=headers,cookies,parameter"
         </attribute>
         -->
      
      </mbean>
      
      ...
      Copy to Clipboard Toggle word wrap
  4. セキュリティ監査が正しく機能していることを確認します

    システムプロパティがファイルで指定された時点で、監査ログエントリは Web 呼び出しが成功するか確認します。
    audit.log ファイルは jboss-as/server/$PROFILE/log/ ディレクトリにあります。
    成功する Web 呼び出しは、次の audit.log 出力に似ています。

    例10.6 成功する Web 呼び出しのログエントリ

    2008-12-05 16:08:38,997 TRACE [org.jboss.security.audit.providers.LogAuditProvider] (http-127.0.0.1-8080-17:) [Success]policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518;Resource:=[org.jboss.security.authorization.resources.WebResource:contextMap={policyRegistration=org.jboss.security.plugins.JBossPolicyRegistration@76ed4518,securityConstraints=[Lorg.apache.catalina.deploy.SecurityConstraint;@6feeae6, resourcePermissionCheck=true},canonicalRequestURI=/restricted/get-only/x,request=[/web-constraints:cookies=null:headers=user-agent=Jakarta Commons-HttpClient/3.0,authorization=host=localhost:8080,][parameters=],CodeSource=null];securityConstraints=SecurityConstraint[RestrictedAccess - Get Only];Source=org.jboss.security.plugins.javaee.WebAuthorizationHelper;resourcePermissionCheck=true;Exception:=;
    Copy to Clipboard Toggle word wrap
    失敗する EJB 呼び出しは、次の audit.log 出力に似ています。

    例10.7 失敗する Web 呼び出しのログエントリ

    2008-12-05 16:08:41,561 TRACE [org.jboss.security.audit.providers.LogAuditProvider] (http-127.0.0.1-8080-4:) [Failure]principal=anil;Source=org.jboss.web.tomcat.security.JBossWebRealm;request=[/jaspi-web-basic:cookies=null:headers=user-agent=Jakarta Commons-HttpClient/3.0,authorization=host=localhost:8080,][parameters=][attributes=];2008-12-05 16:07:30,129 TRACE [org.jboss.security.audit.providers.LogAuditProvider] (WorkerThread#1[127.0.0.1:55055]:)
    Copy to Clipboard Toggle word wrap
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat