Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

11.3.7. sealert メッセージ

拒否は、/var/log/messages にあるように ID が割り当てられています。以下は、Apache HTTP サーバー (httpd_t ドメインで実行中) が /var/www/html/file1 ファイル (samba_share_t タイプのラベルが付いたファイル) にアクセスしようとしたときに発生した AVC 拒否 (messages に記録) の例です。
hostname setroubleshoot: SELinux is preventing httpd (httpd_t) "getattr" to /var/www/html/file1 (samba_share_t). For complete SELinux messages. run sealert -l 32eee32b-21ca-4846-a22f-0ba050206786
推奨されるように、sealert -l 32eee32b-21ca-4846-a22f-0ba050206786 コマンドを実行して、メッセージ全体を表示します。このコマンドは、ローカルマシンでのみ機能し、sealert GUI と同じ情報を表示します。
~]$ sealert -l 32eee32b-21ca-4846-a22f-0ba050206786
SELinux is preventing httpd from getattr access on the file /var/www/html/file1.

*****  Plugin restorecon (92.2 confidence) suggests   ************************

If you want to fix the label. 
/var/www/html/file1 default label should be httpd_sys_content_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /var/www/html/file1

*****  Plugin public_content (7.83 confidence) suggests   ********************

If you want to treat file1 as public content
Then you need to change the label on file1 to public_content_t or public_content_rw_t.
Do
# semanage fcontext -a -t public_content_t '/var/www/html/file1'
# restorecon -v '/var/www/html/file1'

*****  Plugin catchall (1.41 confidence) suggests   **************************

If you believe that httpd should be allowed getattr access on the file1 file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'httpd' --raw | audit2allow -M my-httpd
# semodule -i my-httpd.pp


Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                unconfined_u:object_r:samba_share_t:s0
Target Objects                /var/www/html/file1 [ file ]
Source                        httpd
Source Path                   httpd
Port                          <Unknown>
Host                          hostname.redhat.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-166.el7.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     hostname.redhat.com
Platform                      Linux hostname.redhat.com
                              3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57
                              EDT 2017 x86_64 x86_64
Alert Count                   2
First Seen                    2017-07-20 02:52:11 EDT
Last Seen                     2017-07-20 02:52:11 EDT
Local ID                      32eee32b-21ca-4846-a22f-0ba050206786

Raw Audit Messages
type=AVC msg=audit(1500533531.140:295): avc:  denied  { getattr } for  pid=24934 comm="httpd" path="/var/www/html/file1" dev="vda1" ino=31457414 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:samba_share_t:s0 tclass=file


Hash: httpd,httpd_t,samba_share_t,file,getattr
概要
拒否されたアクションの概要これは、/var/log/messages の拒否と同じです。この例では、httpd プロセスが、samba_share_t タイプのラベルが付いたファイル (file1) へのアクセスを拒否されています。
詳細な説明
より詳細な説明この例では、file1 には samba_share_t タイプのラベルが付けられています。このタイプは、Samba を使用してエクスポートするファイルおよびディレクトリーに使用されます。この説明では、このようなアクセスが必要な場合は、Apache HTTP Server および Samba がアクセス可能なタイプにタイプを変更することが推奨されています。
アクセスの許可
アクセスを許可する方法を説明します。ファイルの再ラベル付け、ブール値の有効化、またはローカルポリシーモジュールの作成を行います。この場合、Apache HTTP Server と Samba の両方がアクセスできるタイプでファイルにラベルを付けることが提案されます。
Fix コマンド
アクセスを許可し、拒否を解決するための推奨されるコマンド。この例では、file1 タイプを public_content_t に変更するためのコマンドを提供します。これは Apache HTTP Server および Samba からアクセスできます。
追加情報
バグ報告に役に立つ情報 (ポリシーパッケージの名前やバージョン (selinux-policy-3.13.1-166.el7.noarch) ですが、拒否が発生した理由の解決には役立たない場合があります。
Raw 監査メッセージ
拒否に関連付けられた /var/log/audit/audit.log からの Raw 監査メッセージ。AVC 拒否に関する詳細は、「Raw 監査メッセージ」 を参照してください。