Translated message

A translation of this page exists in English.

Auditd サービスを再起動すると /etc/audit/audit.rules に加えられた変更が上書きされる

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • audit-libs-2.3.7-5

Issue

/etc/audit/audit.rules を更新しようとすると、auditd サービスの再起動により、追加しようとしている新しいルールが最初のルールセットに置き換えられます。

Resolution

[解決策]
- 監査ルールファイルは /etc/audit/rules.d に配置する必要があります。
- ファイル名は「.rules」で終わる必要があります。

または、以下の方法もあります。

  • Red Hat Enterprise Linux 6

    • /etc/sysconfig/auditd で USE_AUGENRULES=no を設定します。
    • service auditd restart を実行して auditd サービスを再起動します。
  • Red Hat Enterprise Linux 7

    • /usr/lib/systemd/system/auditd.service ファイルを /etc/systemd/system/auditd.service にコピーします。
    • ファイル内のコメントに従って、/etc/systemd/system/auditd.service を編集します。
     ## To not use augenrules, copy this file to /etc/systemd/system/auditd.service
     ## and comment/delete the next line and uncomment the auditctl line.
     ## NOTE: augenrules expect any rules to be added to /etc/audit/rules.d/
     ExecStartPost=-/sbin/augenrules --load
     #ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules
    
    • systemd デーモンをリロードして、auditd サービスユニットファイルに加えられた変更をリロードします。
    $ systemctl daemon-reload
    
    • service auditd restart を実行して auditd サービスを再起動します。

Root Cause

  • audit-libs-2.3.7-5 では、augenrules ユーティリティーのサポートが監査パッケージに追加されました。
  • 以下は、augenrules の man ページになります。
augenrules is a script that merges all component audit rules files, found in the audit rules directory, /etc/audit/rules.d, placing the merged file in
/etc/audit/audit.rules. Component audit rule files, must end in .rules in order to be processed. All other files in /etc/audit/rules.d are ignored.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments