Show Table of Contents
5.12.2. SELinux における MLS の有効化
注記
X Window System 実行中のシステム上では、MLS ポリシーの使用は推奨されません。
システム上で SELinux の MLS ポリシーを有効にするには、以下のステップにしたがいます。
- selinux-policy-mls パッケージをインストールします。
~]#
yum install selinux-policy-mls - MLS ポリシーを有効にする前に、ファイルシステム上のすべてのファイルが MLS ラベルで再ラベル付けされる必要があります。ファイルシステムが再ラベル付けされると、制限のあるドメインはアクセスが拒否され、システムが正常に起動できない可能性があります。これを回避するには、
/etc/selinux/configファイルでSELINUX=permissiveと設定します。また、SELINUXTYPE=mlsと設定して MLS ポリシーを有効にします。設定ファイルは以下のようになります。# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=mls
- SELinux が permissive モードで稼働していることを確認します。
~]#
setenforce 0~]#getenforcePermissive .autorelabelファイルを root のホームディレクトリーに作成し、次回のリブート時にファイルが再ラベル付けされていることを確認します。~]#
touch /.autorelabel- システムをリブートします。次回の起動時にすべてのファイルシステムが MLS ポリシーにしたがって再ラベル付けされます。ラベルプロセスでは、全ファイルが適切な SELinux コンテキストでラベル付けされます。
*** Warning -- SELinux mls policy relabel is required. *** Relabeling could take a very long time, depending on file *** system size and speed of hard drives. ***********
一番下の行の * (アスタリスク) 記号はそれぞれ、ラベル付けされた 1000 ファイルを表します。上記の例では、11 個の * 記号はラベル付けされた 11000 ファイルを表しています。全ファイルにラベル付けする時間はシステム上のファイル数とハードディスクドライブの速度によって異なります。最近のシステムでは、このプロセスは 10 分程度で終わります。ラベリングプロセスが完了すると、システムは自動で再起動します。 - permissive モードでは、SELinux ポリシーは強制されませんが、enforcing モードであれば拒否されたであろうアクションについては拒否がログに記録されます。enforcing モードに変更する前に、Linux root ユーザーで
grep "SELinux is preventing" /var/log/messagesコマンドを実行して、SELinux が最後の起動時にアクセスを拒否しなかったことを確認します。最後の起動時にアクセス拒否がなかった場合は、このコマンドに返される出力はありません。起動時に SELinux がアクセスを拒否していた場合は、トラブルシューティング情報を 8章トラブルシューティング で参照してください。 /var/log/messagesに拒否メッセージがない場合、または既存の拒否をすべて解決した場合は、/etc/selinux/configファイルでSELINUX=enforcingと設定します。# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=mls
- システムを再起動し、SELinux が permissive モードで稼働していることを確認します。
~]$
getenforceEnforcingそして MLS ポリシーを有効にします。~]#
sestatus |grep mlsPolicy from config file: mls

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.