khe*_*aud 3 email postfix aliases
在 SF/SO 上挖掘了几个小时并在谷歌上搜索了很多之后,我仍然无法弄清楚 postfix 是如何使用 /etc/aliases 的。
srv.example.com/etc/aliases规则包括root: mymail@gmail.comnewaliases考虑变化/etc/aliasessudo service postfix restartecho "something" | mailx -s D"subject" root发送邮件到root@example.com而不是mymail@gmail.com我在/var/log/maillog:
Mar 13 17:21:23 srv postfix/smtpd[14462]: A27B540A87: client=localhost[127.0.0.1]
Mar 13 17:21:23 srv postfix/cleanup[14466]: A27B540A87: message-id=<55031c93.Il7wUJmrkLu/WLNL%srv@example.com>
Mar 13 17:21:23 srv opendkim[2065]: A27B540A87: DKIM-Signature field added (s=prod-key-swf, d=example.com)
Mar 13 17:21:23 srv postfix/qmgr[14458]: A27B540A87: from=<srv@example.com>, size=820, nrcpt=1 (queue active)
Mar 13 17:21:23 srv sendmail[14461]: t2DHLNlC014461: to=root, ctladdr=srv@example.com (serveur srv) (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30309, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as A27B540A87)
Mar 13 17:21:25 srv postfix/smtp[14467]: A27B540A87: to=<root@srv.example.com>, relay=aspmx.l.google.com[64.233.186.27]:25, delay=2, delays=0.1/0.01/1.4/0.48, dsn=5.1.1, status=bounced (host aspmx.l.google.com[64.233.186.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 f78si2479139qkh.47 - gsmtp (in reply to RCPT TO command))
Mar 13 17:21:26 srv postfix/bounce[14468]: A27B540A87: sender non-delivery notification: 2297E40A86
Mar 13 17:21:26 srv postfix/qmgr[14458]: A27B540A87: removed
Run Code Online (Sandbox Code Playgroud)
我唯一的后缀配置修改是(空客户端配置):
myhostname = srv.example.commyorigin = $mydomainrelayhost = $mydomaininet_interfaces = loopback-onlymydestination =为了按预期应用 /etc/aliases 语句,我缺少哪一步?
我的sudo postconf -n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = loopback-only
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
milter_default_action = accept
mydestination =
myhostname = srv.example.com
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relayhost = $mydomain
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_milters = inet:127.0.0.1:8891
unknown_local_recipient_reject_code = 550
Run Code Online (Sandbox Code Playgroud)
在了解了“空客户端”是空客户端之后,我再深入了解一下postfix 虚拟域如何。
myorigin服务器主机名myorigin also specifies the default domain name that is appended to recipient addresses that have no @domain part(取自/et/postfix/main.cf)。/etc/aliases来路由我的本地邮件,因为我的邮件root/ fail2ban/ me... 将被重写为root@srv.example.com/ fail2ban@srv.example.com...xxx@srv.example.com到mymail@gmail.com@srv.example.com mymail@gmail.com在/etc/postfix/canonicalcanonical_maps = hash:/etc/postfix/canonical在/etc/postfix/main.cfpostmap /etc/postfix/canonical并重启 postfix ( sudo service postfix restart)我进一步保留了原始目标用户的信息。您可以为此使用正则表达式:
/etc/postfix/main.cf, 而不是canonical_maps = hash:/etc/postfix/canonical, 使用canonical_maps = regexp:/etc/postfix/canonical/etc/postfix/canonical, 而不是@srv.example.com mymail@gmail.com, 我曾经(.+)@(.+).example.com mymail+$1.$2@gmail.com接收邮件到 mymail+fail2ban.srv@gmail.com (我以后会有 srv2、srv3、srvx...)我过早地寻求帮助,希望这个答案能帮助其他人遇到同样的问题。
| 归档时间: |
|
| 查看次数: |
2659 次 |
| 最近记录: |