【问题标题】:Postfix virtual mailbox with authentication setup allows sending mails from unauthenticated users带有身份验证设置的 Postfix 虚拟邮箱允许从未经身份验证的用户发送邮件
【发布时间】:2017-01-14 17:13:30
【问题描述】:

我的 postfix 设置存在问题,它允许未经身份验证和不存在的用户发送邮件。 Postfix 配置为使用虚拟邮箱。 这就是发生的事情:

telnet hostname.com 25
Connected to hostname.com.
Escape character is '^]'.
220 hostname.com ESMTP Postfix (Debian/GNU)
ehlo server
250-hostname.com
250-PIPELINING
250-SIZE 52428800
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN CRAM-MD5 LOGIN
250-AUTH=PLAIN CRAM-MD5 LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

发送邮件

telnet hostname.com 25
Connected to hostname.com.
Escape character is '^]'.
220 hostname.com ESMTP Postfix (Debian/GNU)
mail from: nonexistinguser@virtual-domain.com
250 2.1.0 Ok
rcpt to: legit-user@virtual-domain.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
hi this is a mail from fake account
.
250 2.0.0 Ok: queued as BE73115761D
quit
221 2.0.0 Bye
Connection closed by foreign host.

后缀配置:

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

append_dot_mydomain = no

readme_directory = no

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_auth_only=no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = hostname.com
mydomain = hostname.com
myorigin=$mydomain

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes

smtpd_sender_restrictions = permit_sasl_authenticated,
    reject_unauthenticated_sender_login_mismatch

smtpd_recipient_restrictions = permit_sasl_authenticated,
    reject_unauth_destination,
    reject_unknown_sender_domain
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client

virtual_mailbox_domains = /etc/postfix/vhosts
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmaps
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
message_size_limit = 52428800
virtual_mailbox_limit = 0

问题是:我如何无需身份验证就可以发送邮件?

【问题讨论】:

    标签: linux authentication virtual postfix-mta sasl


    【解决方案1】:

    Postfix 将接受发送到本地域的消息。它们可以通过多种方式指定,一种是main.cf 中的mydestination 参数。

    mydestination 参数指定这台机器将在本地传送哪些域,而不是转发到另一台机器。

    如果您尝试使用 telnet 发送到非本地域,您将在发出 rcpt to 命令后收到 Relay access denied

    【讨论】:

    • 我收到 /usr/sbin/postconf:警告:/etc/postfix/main.cf:未使用的参数:smtpd_relay_restrictions=permit_sasl_authenticated defer_unauth_destination 后缀版本:2.9.6
    • 那是因为 smtpd_recipient_restrictions,反正你是想从 localhost 发送吗?
    • 我尝试从本地主机和远程主机发送。都不需要发件人身份验证
    • 我测试了您的确切 main.cf 配置,smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth-client 除外,但中继访问被拒绝。我怀疑你的 dovecot 配置有问题。您可以将master.cf 更新为smtp inet n - - - - smtpd -v 并检查mail.log 是否有错误。
    • 经过大量阅读后,我在这里发现了这个有趣的注释:link You can send to email addresses belonging to your domain without authentication. This is normal as it enables you to receive mail from the outside. 这就是问题所在。如果我尝试向某个外部域发送邮件,我无法在没有身份验证的情况下这样做。但问题是,有时我会遇到一些垃圾邮件发送者,他们使用我的服务器向我自己的客户发送垃圾邮件,并使用我自己的域使用乱码用户名
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-22
    • 2016-11-17
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2017-09-22
    相关资源
    最近更新 更多