Centos
Selinux 禁用但在 Centos 7 上工作
禁用完整的 Selinux
首先編輯*/etc/selinux/config*
SELINUX=disabled
也嘗試添加到grub.conf selinux=0
kernel /vmlinuz-2.6.32-642.3.1.el6.x86_64 ro root=/dev/mapper/vg-lv_root rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=es rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto LANG=es_ES.UTF-8 rd_LVM_LV=vg/lv_swap rd_NO_DM rd_LVM_LV=vg/lv_root selinux=0 rhgb quiet initrd /initramfs-2.6.32-642.3.1.el6.x86_64.img
重啟機器並驗證
root@srv107 [~]# sestatus SELinux status: disabled
哎呀
問題依然存在。嘗試從其他主機訪問時使用埠 24、10050、10051 的多個服務出現錯誤:
#telnet srv107.XXXXXXX.net 10051 Trying 5.XXX.XX.101... telnet: connect to address 5.XXX.XX.101: No route to host
在主機上查看 selinux 登錄操作
type=USER_START msg=audit(1470384283.115:17): user pid=2348 uid=0 auid=0 ses=1 msg='op=login id=0 exe="/usr/sbin/sshd" hostname=213.XXX.XX.35 addr=213.XXX.XX.35 terminal=/dev/pts/0 res=success' type=CRYPTO_KEY_USER msg=audit(1470384283.116:18): user pid=2348 uid=0 auid=0 ses=1 msg='op=destroy kind=server fp=59:ff:74:ff:7f:4b:a8:5b:60:20:60:c7:a5:4b:c8:ae direction=? spid=2348 suid=0 exe="/usr/sbin/sshd" hostname=? addr=213.XXX.XX.35 terminal=pts/0 res=success' type=CRYPTO_KEY_USER msg=audit(1470384283.116:19): user pid=2348 uid=0 auid=0 ses=1 msg='op=destroy kind=server fp=7b:0d:45:79:16:08:c4:3f:30:0f:3d:76:86:07:48:c5 direction=? spid=2348 suid=0 exe="/usr/sbin/sshd" hostname=? addr=213.XXX.XX.35 terminal=pts/0 res=success' type=CRED_REFR msg=audit(1470384283.116:20): user pid=2348 uid=0 auid=0 ses=1 msg='op=PAM:setcred acct="root" exe="/usr/sbin/sshd" hostname=213.XXX.XX.35 addr=213.XXX.XX.35 terminal=ssh res=success' type=USER_ACCT msg=audit(1470384301.929:21): user pid=2413 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=CRED_ACQ msg=audit(1470384301.929:22): user pid=2413 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:setcred acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=LOGIN msg=audit(1470384301.929:23): pid=2413 uid=0 old auid=4294967295 new auid=0 old ses=4294967295 new ses=2 type=USER_START msg=audit(1470384301.935:24): user pid=2413 uid=0 auid=0 ses=2 msg='op=PAM:session_open acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=CRED_DISP msg=audit(1470384305.615:25): user pid=2413 uid=0 auid=0 ses=2 msg='op=PAM:setcred acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=USER_END msg=audit(1470384305.615:26): user pid=2413 uid=0 auid=0 ses=2 msg='op=PAM:session_close acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
從您的審核日誌中,您執行的操作沒有任何內容。審核日誌顯示 SSH 連接和 cron 操作,但您正在嘗試使用 telnet 連接。
首先,您必須檢查您是否打開了埠,例如埠 10051:
netstat -an Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN
然後你必須檢查你是否被防火牆阻止:
firewall-cmd --list-all
如果找不到防火牆輸出結果中列出的埠,則必須通過以下方式添加新規則:
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" port port=10051 protocol="tcp" accept'
對於永久規則,您必須重新載入防火牆服務以應用新設置:
firewall-cmd --reload