如何停用通過 postfix smtp 無需身份驗證發送郵件

如何停用通過 postfix smtp 無需身份驗證發送郵件

我剛剛設定了一個有 postfix 2.6.6 和 dovecot 的郵件伺服器。

我在 main.cf 中有與身份驗證相關的配置,如下所示:

smtpd_tls_cert_file=/etc/httpd/ssl/mail.crt
smtpd_tls_key_file=/etc/httpd/ssl/mail.key
smtpd_use_tls=yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

現在我可以正常地從我的網域和外部發送和接收電子郵件,這很好。

但是,我發現我可以輕鬆地使用 telnet 從遠端發送未經身份驗證的郵件,如下所示,這意味著其他人可以輕鬆地將垃圾郵件發送到我的網域。

Myhost:~/ z$ telnet mail.example.com 25
Trying 232.96.23.130...
Connected to mail.example.com.
Escape character is '^]'.    
220 mail.example.com ESMTP Postfix
ehlo mail.example.com
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:[email protected]
250 2.1.0 Ok
rcpt to: [email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject:how much dust?
fdhjaklf
fdsahjk;
fdajshk
.

250 2.0.0 Ok: queued as 08B2C5883481

如何保護 postfix 並禁止其他人無需身份驗證即可發送郵件?

答案1

通常郵件伺服器有兩個目的:

  1. 允許使用者將郵件傳送到網際網路上的其他郵件伺服器。這部分你已經做了你該做的事。
  2. 接收其應該服務的網域的使用者的郵件。

如果您只想使用伺服器傳送外寄郵件,而不是接收傳入郵件,則需要變更mydestinationmain.cf 中的參數並將$mydomain其刪除。這樣它就不會接受任何發送到您的網域的電子郵件。有更多信息,請訪問postfix 文件站點

但請注意,這意味著您必須設定其他一些電子郵件伺服器來接受發送到您的網域的傳入郵件。否則您收到的所有郵件都將被退回。

相關內容