$ uname -a
Linux xxxx 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
$ cat /etc/aliases
# See man 5 aliases for format
postmaster: root
root: root@xxxx.xxxx
Run Code Online (Sandbox Code Playgroud)
没有人收到的电子邮件。
$ sudo mail -f /var/spool/mail/nobody
"/var/spool/mail/nobody": 23 messages 1 new 19 unread
1 Anacron Tue Jan 9 00:07 20/823 Anacron job
'cron.daily' on xxxx
From: Anacron <root@xxxx.xxxx>
To: root@xxxx.xxxx
Subject: Anacron job 'cron.daily' on xxxx
Content-Type: text/plain; charset=UTF-8
Run Code Online (Sandbox Code Playgroud)
为什么发送给 root 的电子邮件会重定向给任何人?
$ sudo mail -f /var/spool/mail/root
/var/spool/mail/root: 0 messages
Run Code Online (Sandbox Code Playgroud)
root 的邮箱中没有电子邮件。
给root发送邮件进行测试。 …
vim /etc/postfix/main.cf
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/access
Run Code Online (Sandbox Code Playgroud)
在 /etc/postfix/access 中添加一些 ips
vim /etc/postfix/access
86.111.171.141 REJECT
191.96.249.63 REJECT
Run Code Online (Sandbox Code Playgroud)
重新启动后缀。
postmap hash:/etc/postfix/access
systemctl restart postfix
Run Code Online (Sandbox Code Playgroud)
几次之后。
tail /var/log/maillog
Oct 30 10:18:45 localhost postfix/smtpd[3491]: connect from unknown[86.111.171.141]
Oct 30 10:18:45 localhost postfix/smtpd[3491]: warning: unknown[86.111.171.141]: SASL LOGIN authentication failed: authentication failure
Oct 30 10:18:46 localhost postfix/smtpd[3491]: disconnect from unknown[86.111.171.141]
Oct 30 10:18:45 localhost postfix/smtpd[3491]: connect from unknown[191.96.249.63]
Oct 30 10:18:45 localhost postfix/smtpd[3491]: warning: unknown[191.96.249.63]: SASL LOGIN authentication failed: authentication failure
Oct 30 10:18:46 localhost postfix/smtpd[3491]: …
Run Code Online (Sandbox Code Playgroud)