SELinux : ポリシータイプの設定2025/10/22 |
|
SELinux が [enforcing/permissive] で動作している場合、どのポリシータイプを適用するかを設定することができます。
ポリシータイプは [/etc/selinux/config] 設定ファイルで設定変更可能です。
ただし、ポリシータイプを変更する場合、ポリシーファイルがインストールされている必要があります。 インストールされてないポリシータイプを指定すると、システムが起動しなくなるため、重々注意が必要です。 |
|
| [1] | ポリシータイプは [SELINUXTYPE=***] で設定します。 |
|
# デフォルトは [targeted] ポリシー dlp:~ # cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELinux can be completly disabled with the "selinux=0" kernel # commandline option. # # SELINUX= can take one of these two values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # Previously SELinux could be disabled by changing the value to # 'disabled'. This is deprecated and should not be used anymore. # If you want to disable linux add 'selinux=0' to the kernel # command line. For details see # https://github.com/SELinuxProject/selinux-kernel/wiki/DEPRECATE-runtime-disable SELINUX=enforcing # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. SELINUXTYPE=targeted # ポリシーファイルが [minimum] ディレクトリ配下にインストールされる dlp:~ # ll /etc/selinux total 8 -rw-r--r--. 1 root root 0 Oct 22 08:46 .relabelled -rw-r--r--. 1 root root 847 Oct 9 14:05 config drwxr-xr-x. 1 root root 142 Oct 22 08:58 minimum -rw-r--r--. 1 root root 2321 Mar 7 2025 semanage.conf drwxr-xr-x. 1 root root 142 Oct 9 14:05 targeted
dlp:~ #
vi /etc/selinux/config # [SELINUXTYPE] 変更 # ポリシー変更の際は動作モードを [permissive] に変更 # * [enforcing] のまま再起動するとリラベリングできずシステムが起動しなくなるため注意 ..... ..... SELINUX=permissive # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. SELINUXTYPE=minimum # 変更後はリラべリングをセットしてシステム再起動 dlp:~ # fixfiles -F onboot System will relabel on next boot dlp:~ # sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: minimum Current mode: permissive Mode from config file: permissive Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 33 |
| [2] |
パッケージとして提供されているポリシーは以下の 2 種類です。
|
| Sponsored Link |
|
|