SELinuxアラートのトラブルシューティング

SELinuxが有効になっているかどうかを確認するには、sestatusコマンドを使用します。

SELinuxがDeep Security Agentサービスをブロックする

SELinuxポリシーが有効に設定されていて、 Deep Security Agentサービスがブロックされている場合、次のアラートサンプルがシステム監査ログ /var/log/audit/audit.log またはSELinuxログ /var/log/audit.log に表示されることがあります。

[TIMESTAMP] [HOSTNAME] python: SELinux is preventing [/PATH/BINARY] from 'read, write' accesses on the file /var/opt/ds_agent/dsa_core/ds_agent.db-shm.

***** Plugin leaks (86.2 confidence) suggests *****************************

If you want to ignore [BINARY] trying to read write access the ds_agent.db-shm file, because you believe it should not need this access. Then you should report this as a bug.

You can generate a local policy module to dontaudit this access.

Do

ausearch -x [/PATH/BINARY] --raw | audit2allow -D -M [POLICYNAME]

semodule -i POLICYNAME.pp

この問題を解決するには、以下のようにAudit2allowを使用してカスタムSELinuxポリシーを作成します。

  1. rootユーザとしてDeep Security Agentシステムに接続します。
  2. 次のコマンドを実行して、 Deep Security Agentファイルへのアクセスを許可するカスタムポリシーを作成します。
  3. cd /tmp

    grep ds_agent /var/log/audit/audit* | audit2allow -M ds_agent

    semodule -i ds_agent.pp

  4. ds_agentを再起動します。
  5. 次のコマンドを実行して、システムメッセージを確認し、ds_agentに関連するアラートがないことを確認してください。
  6. cat /var/log/messages | grep ds_agent

  7. アラートが引き続き発生する場合は、手順2からコマンドを再実行して、既存のポリシーをアップデートし、再適用します。

SELinuxポリシーを削除するには、次のコマンドを使用します。

semodule -r ds_agent.

Berkeley Packet Filter (BPF) 操作がブロックされる

この問題は、次の状況で発生する可能性があります。

以下のようなアラートがシステム監査ログ /var/log/audit/audit.log またはSELinuxログ /var/log/audit.log に表示されることがあります。

type=AVC msg=audit(1682773485.952:1080): avc: denied { map_create } for pid=12807 comm="ds_nuagent" scontext=system_u:system_r:unconfined_service_t:s0 tcontext=system_u:system_r:unconfined_service_t:s0 tclass=bpf permissive=0

type=SYSCALL msg=audit(1682773485.952:1080): arch=c000003e syscall=321 success=no exit=-13 a0=0 a1=c000a25800 a2=2c a3=0 items=0 ppid=12802 pid=12807 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ds_nuagent" exe="/opt/ds_agent/nuagent/ds_nuagent" subj=system_u:system_r:unconfined_service_t:s0 key=(null)

この問題を解決するには、次の手順に従ってカスタムSELinuxポリシーを作成します。

  1. rootユーザとしてDeep Security Agentシステムに接続します。
  2. nuagent.teという名前のType Enforcementファイルを作成します。
  3. module nuagent 1.0;

    require {

    type unconfined_service_t;

    class bpf { map_create map_read map_write prog_load prog_run };

    }

    #============= unconfined_service_t ==============

    allow unconfined_service_t self:bpf { map_create map_read map_write prog_load prog_run };

  4. 次のコマンドを実行して、ds_nuagentに対するbpfアクセスを許可するカスタムポリシーを作成します。
  5. checkmodule -M -m -o nuagent.mod nuagent.te

    semodule_package -o nuagent.pp -m nuagent.mod

    semodule -i nuagent.pp

  6. ds_agentサービスを再起動します。

Deep Security Agentバージョン20.0.0-8137以降では、tm_netagentという新しいプロセスのサポートが追加されました。ds_nuagentプロセスは引き続きサポートされており、プロセス名は同じように使用できます。