SELinuxで例外を追加するには?

SELinuxで例外を追加するには?

SELinuxを無効にすると問題はありませんが、強制的に適用するとこの問題が発生します。

[systemd] failed to get d-bus session: Failed to connect to socket /run/dbus/system_bus_socket: Permission denied

監査ログ

 sealert -a /var/log/audit/audit.log
100% done
found 2 alerts in /var/log/audit/audit.log
--------------------------------------------------------------------------------

SELinux is preventing /usr/sbin/zabbix_agentd from connectto access on the unix_stream_socket /run/dbus/system_bus_socket.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that zabbix_agentd should be allowed connectto access on the system_bus_socket unix_stream_socket 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 'zabbix_agentd' --raw | audit2allow -M my-zabbixagentd
# semodule -i my-zabbixagentd.pp

上記のようにポリシーを作成してzabbix-agentを再起動し、zabbixエージェントログからインポートします。

[systemd] failed to get d-bus session: An SELinux policy prevents this sender from sending this message to this recipient, 0 matched rules; type="method_call", sender="(null)" (inactive) interface="org.freedesktop.DBus" member="Hello" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)



 sealert -a /var/log/audit/audit.log
 39% donetype=AVC msg=audit(1534885076.573:250): avc:  denied  { connectto } for  pid=10654 comm="zabbix_agentd" path="/run/dbus/system_bus_socket" scontext=system_u:system_r:zabbix_agent_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=unix_stream_socket

**** Invalid AVC allowed in current policy ***

ベストアンサー1

まあ、まずやるべきこと確認するSELinuxで得た拒否です。 (私の考えでは)最も簡単な方法はsealertユーティリティを利用することです。

まず、次のコマンドを使用してパッケージをインストールしますsetroubleshoot-server

yum install setroubleshoot-server

次に、次を実行します。

sealert -a /var/log/audit/audit.log

多くの結果が得られます。あなたのいいえと具体的に話し、アドバイスに従ってください。しかし、許可されてはいけないことは許可しないように注意してください!

以下は、拒否の例とsealert(私が強調する)提案された解決策です。

SELinux は、rlimitinh を使用するプロセスへの /usr/libexec/postfix/qmgr アクセスをブロックします。

*****プラグインオールインクルーシブ(100. Confidence)推奨****************************

qmgrは、デフォルトでpostfix_qmgr_tとマークされたプロセスへのrlimitinhアクセスを許可する必要があると思います。
その後、これをバグとして報告する必要があります。
このアクセスを許可するローカルポリシーモジュールを作成できます。
する
次のコマンドを実行して、一時的にこのアクセスを許可します。
# ausearch -c 'qmgr' --raw audit2allow -M my-qmgr |
#semodule -i my-qmgr.pp


追加情報:
ソース・コンテキスト system_u:system_r:postfix_master_t:s0
ターゲットコンテキスト system_u:system_r:postfix_qmgr_t:s0
対象オブジェクトが不明 [手続き]
ソースqmgr
ソースパス/usr/libexec/postfix/qmgr
ポート                          
所有者                          
ソースRPMパッケージpostfix-2.10.1-6.el7.x86_64
目標RPMパッケージ           
ポリシーRPM selinux-policy-3.13.1-102.el7_3.16.noarch
Selinux の有効化True
ポリシータイプの目標
力モード力
ホスト名Centos
PlatformLinux centos 3.10.0-514.26.2.el7.x86_64 #1 SMP火曜日
                              2017年7月4日 15:04:05 UTC x86_64 x86_64
警告回数 5
2018-04-18 18:02:32 CESTに初登場しました。
最終確認日:2018-08-22 09:11:22 CEST
ローカルID 855f168c-1e47-4c6b-8a1e-f8fddce5d426

上記の例は、Postfixの検索に関するものです。あなたのローカルポリシーを拒否して挿入します。

おすすめ記事