1. 程式人生 > 實用技巧 >關閉防火牆

關閉防火牆

注: 搭建服務前須關閉防火牆(否則會導致服務無法訪問)

一、firewalld 防火牆

檢視 firewalld 防火牆狀態:systemctl status firewalld
關閉 firewall 防火牆 systemctl stop firewalld

二、selinux 防火牆

簡介:
SELinux(Security-Enhanced Linux) 是美國國家安全域性(NSA)對於強制訪問控制的實現,是 Linux歷史上最傑出的新安全子系統。

selinux 分三種模式
Enforcing(強制模式)、Permissive(警告模式)、Disabled(關閉模式)

檢視防火牆當前狀態:getenforce

#  關閉 selinux 防火牆

vim /etc/selinux/config		#  編輯 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 - No SELinux policy is loaded.
SELINUX=enforcing	#  需將此處更改為 disabled(預設為 enforcing)
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.

更改完後輸入命令使其生效 setenforce 0