openSUSE Leap 16

初期設定 : ファイアウォール2025/10/10

 

ファイアウォール と SELinux の設定です。

[1] ファイアウォールサービスの現在の状態は以下のようにして確認できます。(デフォルトは有効)
localhost:~ #
systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
     Active: active (running) since Fri 2025-10-10 13:50:32 JST; 16min ago
 Invocation: 9df52c37c8ab463b8ecd416407d582fe
       Docs: man:firewalld(1)
   Main PID: 898 (firewalld)
      Tasks: 2 (limit: 4662)
        CPU: 263ms
     CGroup: /system.slice/firewalld.service
.....
.....

# Active: active (running) *** の状態は稼働中

[2]

ファイアウォールサービスを稼働させる場合、デフォルトではインバウンド通信はほぼ許可されていないため、 サーバーに設定/公開するサービス/アプリケーションに応じて、通信を許可する設定が必要になります。
ファイアウォールサービスの基本的な操作/設定方法はこちらを参照ください
なお、当サイトの openSUSE Leap 16 設定例は、全て、ファイアウォールサービス稼働中の環境を前提としていますので、各ページには必要に応じて許可設定を記載しています。

[3] もし、自身のネットワーク内で、設定対象とするサーバーの上位にファイアウォール機器が設置されており、 サーバー側ではファイアウォールサービスは必要ないといった場合は、以下のようにして停止可能です。
# サービス停止

localhost:~ #
systemctl stop firewalld

# 自動起動設定を無効にする

localhost:~ #
systemctl disable firewalld

Removed '/etc/systemd/system/multi-user.target.wants/firewalld.service'.
Removed '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'.
初期設定 : SELinux
[4] SELinux (Security-Enhanced Linux) の現在の状態は以下のようにして確認できます。(デフォルトは有効)
localhost:~ #
getenforce

Enforcing     # SELinux は有効な状態
[5]

SELinux が [Enforcing] の場合、通常の Linux アクセス権の設定は問題なくとも、SELinux のアクセス制御によってアクセスが拒否され、サービス/アプリケーションが期待通りの動作をしないといった場合が発生します。 そのため、サーバーに設定/公開するサービス/アプリケーションによっては、SELinux ポリシーに対して、手動でのアクセス許可の設定が必要になる場合があります。
SELinux の基本的な操作/設定方法はこちらを参照ください
なお、当サイトの openSUSE Leap 16 設定例は、全て [SELinux = Enforcing] の環境を前提としていますので、各ページには必要に応じて許可設定を記載しています。

[6] もし、設定対象とするサーバーが安全な社内のみの利用である等の理由で SELinux を無効にしたいといった場合は、以下のように設定して無効化できます。
localhost:~ #
vi /etc/default/grub
# 11行目 : [selinux=0] に変更
GRUB_CMDLINE_LINUX_DEFAULT="mitigations=auto quiet security=selinux selinux=0"

# 変更を反映

localhost:~ #
grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-6.12.0-160000.5-default
Found initrd image: /boot/initrd-6.12.0-160000.5-default
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
37.452022 | DM multipath kernel driver not loaded
Adding boot menu entry for UEFI Firmware Settings ...
done

# 再起動して変更を有効にする

localhost:~ #
関連コンテンツ