本文主要介紹在Linux作業系統遷移時,遷移任務出錯提示“TCP Wrappers configuration affects”資訊時的問題描述、問題原因及其解決方案。
問題描述
在SMC作業系統遷移到AnolisOS時,遷移任務出錯提示“TCP Wrappers configuration affects”資訊。
問題原因
Anolis OS 8不再支援TCP Wrapper。
解決方案
TCP Wrappers是一種在應用程式層級阻止傳入串連的簡單工具。 最早在Linux中還沒有防火牆,現在可以使用firewalld來替代TCP Wrappers。
以TCP Wrappers 限制ssh策略為例,將TCP Wrappers限制轉換成firewalld配置的方式。
假設
/etc/hosts.deny的配置為:# # hosts.deny This file contains access rules which are used to # deny connections to network services that either use # the tcp_wrappers library or that have been # started through a tcp_wrappers-enabled xinetd. # # The rules in this file can also be set up in # /etc/hosts.allow with a 'deny' option instead. # # See 'man 5 hosts_options' and 'man 5 hosts_access' # for information on rule syntax. # See 'man tcpd' for information on tcp_wrappers # sshd: ALL假設
/etc/hosts.allow的配置為:# # hosts.allow This file contains access rules which are used to # allow or deny connections to network services that # either use the tcp_wrappers library or that have been # started through a tcp_wrappers-enabled xinetd. # # See ‘man 5 hosts_options’ and ‘man 5 hosts_access’ # for information on rule syntax. # See ‘man tcpd’ for information on tcp_wrappers # sshd: 192.168.20.100 192.168.20.101 sshd: 192.168.15.16/29
遠端連線原始伺服器。具體操作,請參見串連執行個體。
執行以下命令,安裝firewalld並啟動服務。
yum install -y firewalld systemctl enable firewalld systemctl restart firewalld執行以下命令,把ssh在firewalld的default zone移除。
firewalld在default zone(public zone)裡面預設使能了ssh。
firewall-cmd --permanent --remove-service=ssh執行以下命令,建立一個新的firewalld zone。
firewall-cmd --permanent --new-zone=sshzone執行以下命令,把ssh服務和網路過濾條件加到sshzone中。
firewall-cmd --permanent --zone=sshzone --add-source=192.168.20.100 firewall-cmd --permanent --zone=sshzone --add-source=192.168.20.101 firewall-cmd --permanent --zone=sshzone --add-source=192.168.15.16/29 firewall-cmd --permanent --zone=sshzone --add-service=ssh執行以下命令,載入配置。
firewall-cmd --reload注釋掉
/etc/hosts.allow和/etc/hosts.deny裡面的內容。問題排查解決後,運行SMC用戶端再試。具體操作,請參見運行SMC用戶端。