本章では、syslogにSELinuxのメッセージが出力された場合の対処方法を説明します。
■環境
以下の4つの条件を満たす環境で発生する場合があります。
OSがRed Hat Enterprise Linux 7以降である。
SELinuxが有効である。
Enterprise Manager/Manager/Proxy Manager/Agentがインストールされている。
サーバ内リソース情報の収集を行っている(セットアップを行っている)。
■現象
以下のようなメッセージが、syslogに1分間隔で出力される場合があります。
例)
Oct 6 19:55:03 rhel7-02 setroubleshoot: SELinux is preventing /usr/lib64/sa/sadc from write access on the file . For complete SELinux messages. run sealert -l 91567dca-d82d-4b55-8900-c1ecb5ea21fd
■原因
Red Hat Enterprise Linux 7の機能変更により、SELinuxの設定が正しく反映されない場合があるためです。
■確認方法
システム管理者(スーパーユーザー)権限のあるユーザーでログインします。
出力されているメッセージの最後に書かれたコマンド(sealert)を実行します。
上記のメッセージ例の場合、赤字で示された以下のコマンドを実行してください。
# sealert -l 91567dca-d82d-4b55-8900-c1ecb5ea21fd
コマンドの実行例)
# sealert -l 91567dca-d82d-4b55-8900-c1ecb5ea21fd SELinux is preventing /usr/lib64/sa/sadc from write access on the file . ・・・ (中略) ・・・ Raw Audit Messages type=AVC msg=audit(1444129023.514:3894): avc: denied { write } for pid=24969 comm="sadc" path="/var/opt/FJSVssqc/temp/SAR/rhel7-02_SAR_0001_20xx1006195703.stderr" dev="dm-0" ino=8308178 scontext=system_u:system_r:sysstat_t:s0 tcontext=system_u:object_r:initrc_var_log_t:s0 tclass=file type=SYSCALL msg=audit(1444129023.514:3894): arch=x86_64 syscall=execve success=yes exit=0 a0=410273 a1=61aa60 a2=7fff0c494610 a3=7fff0c494000 items=0 ppid=24968 pid=24969 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sadc exe=/usr/lib64/sa/sadc subj=system_u:system_r:sysstat_t:s0 key=(null) Hash: sadc,sysstat_t,initrc_var_log_t,file,write
出力結果の最終行近くの「Raw Audit Messages」の「path=」に、「/var/opt/FJSVssqc/temp」が含まれている場合(上記のコマンドの実行例では赤字で示しています)、「■原因」で説明する事象に該当します。
■対処方法
SELinuxの設定を正しく反映するため、以下のコマンドをシステム管理者(スーパーユーザー)権限で実行してください。
なお、実行の際に、デーモンの停止は不要です。
# restorecon -F -R -v /var/opt/FJSVssqc/temp