[ CentOS/セキュリティ ]

SELinuxを有効・無効にする

SELinuxの動作モードには以下があります。

   * Enforcing   SELINUX=enforcing
     SELinuxパーミッションのチェックを行い、アクセスを拒否する。
   * Permissive  SELINUX=permissive
     SELinuxパーミッションのチェックはするが実際にアクセスの拒否はしない
   * disabled    SELINUX=disabled
     無効

SELinux状態確認

[root@linux ~]# getenforce ← SELinux状態確認
Enforcing ← SELinux有効
Permissive ← SELinuxチェックのみ
disabled ← SELinux無効

設定ファイルの編集

[root@linux ~]# cp -a /etc/selinux/config /etc/selinux/config.org ←■ 元のファイルをバックアップ
[root@linux ~]# vi /etc/sysconfig/selinux
# 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 - SELinux is fully disabled.
SELINUX=permissive  ←■ 有効=enforcing チェックのみ=permissive 無効=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

設定後、マシンを再起動します。
(*)注意
無効から有効にする場合、ラベルの再構築が必要です。
再起動する前にラベルの再構築を行わないと、最悪システムが起動しなくなります。

ラベルの再構築

SELinuxを無効にすると、ラベルが削除されるので、有効後は必ずラベルの再構築を行う必要があります。
以下を実行して、ラベルの再構築を行います。

[root@linux ~]# fixfiles relabel

実行後は、/tmp以下のファイルが全て削除されるので、Xの再起動が必要です。

SELinux でFTPを動かす場合 未確認情報

[root@linux ~]# setsebool -P ftp_home_dir 1
  • Pを設定することでreboot時にも設定が保存されたままになります。

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-05-18 (火) 00:39:46 (115d)