
我正在 Debian 12 上設定新的Postifx25
伺服器。465
587
Postfix 正在運行,日誌中沒有錯誤。我禁用了監獄,master.cf
並且該伺服器沒有運行軟體防火牆。
Postifx 綁定到所有接口,如下netstat
:
netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 8417/master
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 8417/master
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 8417/master
tcp6 0 0 :::587 :::* LISTEN 8417/master
tcp6 0 0 :::465 :::* LISTEN 8417/master
tcp6 0 0 :::25 :::* LISTEN 8417/master
我可以在伺服器本身上遠端登入並透過其公共 IP 連接到 Postfix:
telnet xx.xx.xx.xx 587
Trying xx.xx.xx.xx...
Connected to xx.xx.xx.xx.
Escape character is '^]'.
220 mydomain.com ESMTP Postfix
但如果我從伺服器外部嘗試此操作,它將無法連接:
telnet mydomain.com 587
Trying xx.xx.xx.xx...
Trying xxxx:xxxx::xxxx:xxxx:xxxx:xxxx...
telnet: Unable to connect to remote host: Network is unreachable
我已經確認從客戶端的角度來看 DNS 可以正確解析到伺服器。
我工作/家裡的 ISP 不會阻止傳出端口,因為我可以從家裡遠端登入 Gmail 的 SMTP 伺服器並訪問EHLO
.
伺服器託管公司聲稱沒有連接埠被阻止。
我可以從我的家庭客戶端存取伺服器,traceroute -I
但不能沒有該-I
選項。
老實說,我不知道我還能嘗試什麼。當我嘗試 telnet 時,我應該從 Postfix 得到一些東西。大多數封鎖郵件的選項都出現在 後EHLO
,但我們還沒有做到這一點。
伺服器上的哪些可能的設定會阻止 Postifx 在外部介面上偵聽或回應,當netstat
顯示它已綁定時,日誌中沒有錯誤,並且當從伺服器本身進行 telnet 時,Postfix 回應伺服器外部 IP 上的 telnet?
inet_interfaces = all
已設定。
inet_protocols = all
已設定。
是否有任何配置設定會導致 Postfix 默默地丟棄連接請求而根本沒有任何輸出?
我還可以檢查或嘗試什麼? Postfix 中的哪些設定會丟棄或不接受初始連線要求?
答案1
iptables
希望這對其他人有幫助:顯然除了和 之外還有許多不同的防火牆ucf
。
我發現這篇有用的貼文:https://surgemail.com/knowledge-base/disable-your-firewall/,其中列出了要尋找的所有可能性。就我而言,是nft
。
以下是要停用或檢查的防火牆的完整清單:
nft flush ruleset
systemctl mask nftables.service
systemctl stop firewalld
systemctl disable firewalld
service iptables stop
service iptables disable
service ipchains disable
service ipchains stop
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
cfx -x