Red Hat Training

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

50.2. SELinux の管理者コントロール

「SELinux のエンドユーザーコントロール」 でユーザーが行うタスクに加えて、SELinux 管理者は多くの追加タスクを実行することが必要になる場合があります。これらのタスクは通常、システムへの root アクセスを必要とします。このようなタスクは、targeted ポリシーで大幅に容易になります。たとえば、SELinux ユーザーで Linux ユーザーを追加、編集、または削除したり、ロールを考慮する必要はありません。
本セクションでは、管理者が SELinux を実行している Red Hat Enterprise Linux を管理するタスクの種類を説明します。

50.2.1. SELinux のステータス表示

sestatus コマンドは、設定可能なビューを SELinux のステータスに提供します。このコマンドの最も単純な形式により、以下の情報が表示されます。
~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted
-v オプションには、/etc/sestatus.conf で指定された一連のファイルのセキュリティーコンテキストに関する情報が含まれます。
~]# sestatus -v
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 21
Policy from config file:        targeted

Process contexts:
Current context:                user_u:system_r:unconfined_t
Init context:                   system_u:system_r:init_t
/sbin/mingetty                  system_u:system_r:getty_t
/usr/sbin/sshd                  system_u:system_r:unconfined_t:s0-s0:c0.c1023

File contexts:
Controlling term:               user_u:object_r:devpts_t
/etc/passwd                     system_u:object_r:etc_t
/etc/shadow                     system_u:object_r:shadow_t
/bin/bash                       system_u:object_r:shell_exec_t
/bin/login                      system_u:object_r:login_exec_t
/bin/sh                         system_u:object_r:bin_t -> system_u:object_r:shell_exec_t
/sbin/agetty                    system_u:object_r:getty_exec_t
/sbin/init                      system_u:object_r:init_exec_t
/sbin/mingetty                  system_u:object_r:getty_exec_t
/usr/sbin/sshd                  system_u:object_r:sshd_exec_t
/lib/libc.so.6                  system_u:object_r:lib_t -> system_u:object_r:lib_t
/lib/ld-linux.so.2              system_u:object_r:lib_t -> system_u:object_r:ld_so_t
-b は、ブール値の現在の状態を表示します。grep またはその他のツールと組み合わせて使用すると、特定のブール値のステータスを確認できます。
~]# sestatus -b | grep httpd | grep on$
httpd_builtin_scripting           on
httpd_disable_trans               on
httpd_enable_cgi                  on
httpd_enable_homedirs             on
httpd_unified                     on