Rocky Linux 10 SELinux 無効化

はじめに

CentOS時代は設定ファイルを直接編集していましたが、現在はgrubbyコマンドでカーネルパラメータを編集する方法に変更されたらしいです。

現在の設定の確認

# getenforce
Enforcing
# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33

永続的に無効化

configにコマンドが書いてあります。

# cat /etc/selinux/config

# 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.
# See also:
# https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-selinux/#getting-started-with-selinux-selinux-states-and-modes
#
# NOTE: In earlier Fedora kernel builds, SELINUX=disabled would also
# fully disable SELinux during boot. If you need a system with SELinux
# fully disabled instead of SELinux running with no policy loaded, you
# need to pass selinux=0 to the kernel command line. You can use grubby
# to persistently set the bootloader to boot with selinux=0:
#
#    grubby --update-kernel ALL --args selinux=0
#
# To revert back to SELinux enabled:
#
#    grubby --update-kernel ALL --remove-args selinux
#
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.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

永続的に無効化実行

# grubby --update-kernel ALL --args selinux=0

設定を反映させるため、サーバ再起動します。

# reboot

先起動後に確認

# getenforce
Disabled
# sestatus
SELinux status:                 disabled

ちなみに、configファイルを見ると無効化しても設定は更新されていません。これはconfig が「有効時の動かし方」を決めるファイルとして残っていて、「止めるかどうか」はブートローダー側の役割に移ったということらしいです。

以上です。