我想使用sendmail
以便fail2ban
可以向我发送通知。我已经阅读了多个关于如何设置它的指南,但我无法让它工作。
到目前为止我做了什么:
apt-get install sendmail
- 修改
/etc/hosts
:“127.0.0.1 localhost”=>“127.0.0.1 localhost localhost.localdomain MYHOSTNAME”。我认为错误可能在这里。由于我没有域名,因此输出hostname
的 IP 地址是错误的。因此,如果我的 IP 地址是1.2.3.4
,则hostname
输出4-3-2-1
。这就是我为“MYHOSTNAME”输入的内容。 - 重启
sudo sendmailconfig
.
仍然,sendmail
没有发送并且/var/log/mail.log
是空的。
输出var/log/syslog
(大写字母的所有内容都已被我修改):
Jan 17 11:58:11 MY-I-P-ADRESS sendmail[1814]: v0HBwBK4001814: from=fail2ban, size=100100, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Jan 17 11:58:11 MY-I-P-ADRESS sendmail[1814]: v0HBwBK4001814: [email protected], delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=130100, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v0HBwB0U001819 Message accepted for delivery)
Jan 17 11:58:12 MY-I-P-ADRESS sendmail[1799]: v0HBtjwr001799: from=root, size=0, class=0, nrcpts=2, relay=root@localhost
Jan 17 11:58:12 MY-I-P-ADRESS sm-mta[1821]: STARTTLS=client, relay=mx3.hotmail.com, version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES256-SHA384, bits=256/256
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwB0U001819: to=<[email protected]>, delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=220357, relay=mx3.hotmail.com. [65.55.37.120], dsn=5.0.0, stat=Service unavailable
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwB0U001819: to=<[email protected]>, delay=00:00:02, mailer=local, pri=220357, dsn=5.1.1, stat=User unknown
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwB0U001819: to=postmaster, delay=00:00:02, mailer=local, pri=220357, dsn=5.1.1, stat=User unknown
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwD0U001821: to=MAILER-DAEMON, delay=00:00:00, mailer=local, pri=0, dsn=5.1.1, stat=User unknown
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwD0U001821: to=postmaster, delay=00:00:00, mailer=local, pri=0, dsn=5.1.1, stat=User unknown
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwD0V001821: to=MAILER-DAEMON, delay=00:00:00, mailer=local, pri=0, dsn=5.1.1, stat=User unknown
Jan 17 11:58:13 MY-I-P-ADRESS sm-mta[1821]: v0HBwD0U001821: Saved message in /var/lib/sendmail/dead.letter
从sendmail复制:如何在ubuntu上配置sendmail?在 Stack Overflow 上,由Venice回答,但修改为将开头
'
引号更改为`
. (这个问题太老了,无法迁移到这里。)