8.3.5. 拒否の検索および表示
auditd、rsyslogd、setroubleshootd のデーモンが実行中であることを前提としています。これらのデーモンのスタート方法に関しては、「使用するログファイル」 を参照してください。SELinux 拒否の検索および表示には、ausearch、aureport、sealert などの数多くのツールが利用できます。
audit パッケージは ausearch を提供します。ausearch(8) man ページでは、「ausearch は、異なる検索基準に基づいたイベントで監査デーモンログにクエリを行えるツールです」となっています[14]。ausearch ツールは /var/log/audit/audit.log にアクセスするので、Linux root ユーザーで実行する必要があります。
| 検索対象 | コマンド |
|---|---|
| すべての拒否 | ausearch -m avc |
| 当日の拒否 | ausearch -m avc -ts today |
| 過去 10 分間の拒否 | ausearch -m avc -ts recent |
-c comm-name オプションを使います。ここでの comm-name は「実行可能な名前です」 [15]。例えば、Apache HTTP Server の場合は httpd、Samba の場合は smbd になります。
~]# ausearch -m avc -c httpd~]# ausearch -m avc -c smbdausearch オプションの詳細については、ausearch(8) man ページを参照してください。
audit パッケージは aureport を提供します。aureport(8) man ページでは、「aureport は、監査システムログのサマリーレポートを作成するツールです」となっています[16]。aureport ツールは /var/log/audit/audit.log にアクセスするので、Linux root ユーザーで実行する必要があります。SELinux 拒否の一覧を表示し、その発生頻度を確認するには、aureport -a コマンドを実行します。以下の例では出力に 2 つの拒否があります。
~]# aureport -a
AVC Report
========================================================
# date time comm subj syscall class permission obj event
========================================================
1. 05/01/2009 21:41:39 httpd unconfined_u:system_r:httpd_t:s0 195 file getattr system_u:object_r:samba_share_t:s0 denied 2
2. 05/03/2009 22:00:25 vsftpd unconfined_u:system_r:ftpd_t:s0 5 file read unconfined_u:object_r:cifs_t:s0 denied 4
aureport オプションの詳細については、aureport(8) man ページを参照してください。
setroubleshoot-server パッケージは sealert を提供します。これは、setroubleshoot-server が変換した拒否メッセージを読み取ります。/var/log/messages にあるように、拒否には ID が割り当てられます。以下の例は、messages からの拒否です。
setroubleshoot: SELinux is preventing httpd (httpd_t) "getattr" to /var/www/html/file1 (samba_share_t). For complete SELinux messages. run sealert -l 84e0b04d-d0ad-4347-8317-22e74f6cd020
84e0b04d-d0ad-4347-8317-22e74f6cd020 です。-l オプションは、ID を引数 として受け取ります。sealert -l 84e0b04d-d0ad-4347-8317-22e74f6cd020 コマンドを実行すると、SELinux がアクセスを拒否した詳細な分析とアクセスを許可するソリューションが提示されます。
setroubleshootd と dbus、auditd デーモンが稼働している場合、SELinux によってアクセスが拒否されると警告が表示されます。「表示する」をクリックすると、sealert GUI が開始され、HTML 出力で拒否を表示します。

sealert -bコマンドを実行し、sealertGUI を開始します。sealert -l \*コマンドを実行し、すべての拒否の詳細な分析を表示します。- Linux root ユーザーで
sealert -a /var/log/audit/audit.log -H > audit.htmlコマンドを実行し、sealertGUI で見られたようにsealert分析の HTML バージョンを作成します。
sealert オプションの詳細については、sealert(8) man ページを参照してください。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.