如何阻止 Postfix 發送垃圾郵件?

如何阻止 Postfix 發送垃圾郵件?

我的 postfix 正在從以下地址發送垃圾郵件[電子郵件受保護]地址。這怎麼可能,我如何只允許 www-data@localhost 發送,而 postfix 只允許從[電子郵件受保護][電子郵件受保護](如我的別名清單中所示)?

這是我的 main.cf:

    # See /usr/share/postfix/main.cf.dist for a commented, more complete version


    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = *** My main domain ***

    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no

    # appending .domain is the MUA's job.
    append_dot_mydomain = no

    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h

    readme_directory = no

    # TLS parameters
    smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
    smtpd_use_tls=yes
    smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.

    myhostname = *** My hostname ***
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = $mydomain
    mydestination = $myhostname, localhost.$mydomain, $mydomain, localhost
    mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    mailbox_size_limit = 0
    recipient_delimiter = +
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous noplaintext
    smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination permit_inet_interfaces
    smtpd_tls_security_level = may

    virtual_alias_domains = *** My aliases ***
    virtual_alias_maps = hash:/etc/postfix/virtual
    smtpd_tls_auth_only = yes


smtpd_client_restrictions = permit_mynetworks, reject
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_end_of_data_restrictions = check_policy_service unix:private/policy
smtp_sasl_auth_enable = no
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, hash:/etc/postfix/sender_access, permit
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, check_helo_access hash:/etc/postfix/sender_access, reject_non_fqdn_hostname, reject_invalid_hostname, permit
smtpd_recipient_restrictions = reject_unauth_pipelining, reject_unauth_destination, reject_non_fqdn_recipient, permit_mynetworks, permit_sasl_authenticated, check_sender_access hash:/etc/postfix/sender_access, reject_rbl_client relays.ordb.org, reject_rbl_client list.dsbl.org, reject_rbl_client sbl-xbl.spamhaus.org, check_policy_service unix:private/spfpolicy, check_policy_service inet:127.0.0.1:10023, permit
transport_maps = hash:/etc/postfix/transport

答案1

你有

smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit

你需要那個決賽嗎, permit

http://www.postfix.org/SMTPD_ACCESS_README.html#lists其中有

# Relay control (Postfix 2.10 and later): local clients and
# authenticated clients may specify any destination domain.
smtpd_relay_restrictions = permit_mynetworks, 
    permit_sasl_authenticated,
    reject_unauth_destination

答案2

看看設定relay_recipient_maps是否正確修復了這個問題。

我認為這就是問題所在...

您設定reject_unauth_destination是正確的,但是伺服器基本上沒有關於「unauth目的地」實際上是什麼的明確指示。如果它不是您電腦上的帳戶或轉發,則不應授權它進行中繼,除非它是 sasl 驗證或允許的網路電腦。

垃圾郵件發送者正在向您的電腦發送偽造的訊息,而您的電腦無法將它們發送到不存在的帳戶。由於它無法判斷它們是否是「未經身份驗證」的目的地,因此它嘗試將它們視為合法的SMTP 錯誤,而不是未經授權的錯誤,因此,將錯誤發送回「原始」MTA(該MTA是偽造的或配置錯誤的)。

在正確配置的郵件伺服器上,延遲應該是很不尋常的。如果您覺得這樣做是安全的,並且確定不會刪除任何合法的內容,請執行postsuper -d ALL deferred刪除佇列中的所有延遲郵件。如果我是對的,隊列就不會再像以前那樣擠滿了。為了

相關內容