Moo*_*288 7 email postfix dovecot maildir
我一直在尝试设置一个新的邮件服务器以从我的 VPS 迁移,因为我的主机已决定关门。旧服务器运行的是 Exim/Courier(此时已有近十年的历史),我的印象是 Postfix/Dovecot 的设置会更简单。不过我还没有那么幸运。
我想要设置什么:
我一直在使用 Amavis 将 ClamAV 和 SpamAssassin 结合在一起。
后会议-n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
content_filter = smtp-amavis:[127.0.0.1]:10024
home_mailbox = Maildir/
inet_interfaces = all
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 0
milter_default_action = accept
mydestination = localhost, /etc/postfix/domains
myhostname = example.org
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = reject_unknown_client_hostname, permit_sasl_authenticated
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
smtpd_recipient_restrictions = permit_mynetworks, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/.pem
smtpd_tls_key_file = /etc/postfix/.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = hash:/etc/postfix/virtual
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/域:
lorem.com
example.org
website.net
Run Code Online (Sandbox Code Playgroud)
/etc/postfix/虚拟:
postmaster@lorem.com userTwo
ipsum@lorem.com userTwo
postmaster@example.org userOne
steve@example.org userOne
postmaster@website.net userOne
steve@website.net userOne
mike@website.net userThree
mary@website.net userTwo
Run Code Online (Sandbox Code Playgroud)
从 steve@example.org 向 mike@website.net 发送邮件时:
邮件日志、邮件错误:
Aug 3 20:04:55 example postfix/submission/smtpd[25424]: connect from my-hostname[68.xxx.xxx.xxx]
Aug 3 20:04:55 example postfix/submission/smtpd[25424]: 8D70441402: client=my-hostname[68.xxx.xxx.xxx], sasl_method=PLAIN, sasl_username=userOne
Aug 3 20:04:55 example postfix/cleanup[25429]: 8D70441402: message-id=<55C001A5.9020907@example.org>
Aug 3 20:04:55 example postfix/qmgr[25311]: 8D70441402: from=<steve@example.org>, size=583, nrcpt=1 (queue active)
Aug 3 20:04:55 example postfix/submission/smtpd[25424]: disconnect from my-hostname[68.xxx.xxx.xxx]
Aug 3 20:04:56 example postfix/smtpd[25434]: connect from localhost[127.0.0.1]
Aug 3 20:04:56 example postfix/smtpd[25434]: 72CE941403: client=localhost[127.0.0.1]
Aug 3 20:04:56 example postfix/cleanup[25429]: 72CE941403: message-id=<55C001A5.9020907@example.org>
Aug 3 20:04:56 example postfix/qmgr[25311]: 72CE941403: from=<steve@example.org>, size=991, nrcpt=1 (queue active)
Aug 3 20:04:56 example postfix/smtpd[25434]: disconnect from localhost[127.0.0.1]
Aug 3 20:04:56 example amavis[5148]: (05148-07) Passed CLEAN {RelayedInbound}, [68.xxx.xxx.xxx]:52874 [68.xxx.xxx.xxx] <steve@example.org> -> <steve@example.org>, Queue-ID: 8D70441402, Message-ID: <55C001A5.9020907@example.org>, mail_id: QciSwqBl84A4, Hits: 1.439, size: 583, queued_as: 72CE941403, 838 ms
Aug 3 20:04:56 example postfix/smtp[25430]: 8D70441402: to=<steve@example.org>, orig_to=<mike@website.net>, relay=127.0.0.1[127.0.0.1]:10024, delay=1, delays=0.13/0.01/0.01/0.84, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 72CE941403)
Aug 3 20:04:56 example postfix/qmgr[25311]: 8D70441402: removed
Aug 3 20:04:56 example dovecot: lda(steve): msgid=<55C001A5.9020907@example.org>: saved mail to INBOX
Aug 3 20:04:56 example postfix/local[25377]: 72CE941403: to=<steve@example.org>, relay=local, delay=0.12, delays=0.01/0/0/0.1, dsn=2.0.0, status=sent (delivered to command: /usr/lib/dovecot/deliver)
Aug 3 20:04:56 example postfix/qmgr[25311]: 72CE941403: removed
Run Code Online (Sandbox Code Playgroud)
我审查了我的 IP 和主机名。现在,请注意中间的那一行,上面写着 orig_to。当我收到电子邮件时,它位于 steve@example.org 的发送箱中。这很奇怪,不是吗?从 mike@website.net 到 steve@example.org 的 SMTP 工作正常。
我发现了另一个与此匹配的问题:
后缀:virtual_alias_maps 将所有内容交付给一个用户,尽管有新域
不幸的是,我不明白答案,而且我不相信我们的设置是相同的。
所以我认为这与我的目的地和我对虚拟地图的使用有关......但我不太确定如何设置我的目的地和虚拟域,如果我到目前为止所做的不起作用。
很长一段时间以来,我一直在寻找这个看似简单的问题的答案,但我已经没有办法尝试了。我不想让 Google 运行我的邮件,而且我真的很想让它在这个 VPS 上运行。
任何帮助将不胜感激。谢谢。
我相信我已经解决了这个问题,并希望这能为遇到此问题的其他人提供帮助。有点失望的是这里没有太多帮助,但我想把它写出来的行为可能有所帮助。反正:
在 中main.cf,myorigin和mydestination变量需要设置为 localhost。所以:
myorigin = localhost
mydestination = localhost
Run Code Online (Sandbox Code Playgroud)
切换到虚拟域映射可以让虚拟用户获取他们需要的邮件,而不是使用 mydestination 来处理域分配。
virtual_alias_domains = hash:/etc/postfix/domains
Run Code Online (Sandbox Code Playgroud)
这意味着我们还需要正确格式化/etc/postfix/domains文件:
example.org #
example.com #
Run Code Online (Sandbox Code Playgroud)
注释只是满足哈希格式,仅此而已。postmap该文件也需要A :
postmap /etc/postfix/domains
Run Code Online (Sandbox Code Playgroud)
应该是这样。在完成虚拟域查找后,所有个人帐户都会将电子邮件路由到正确的 UNIX 地址。
我仍然不知道向用户“扩展”是什么,或者遇到麻烦的其他人发布了什么,但这似乎与这个特定问题无关。
我希望这可以帮助像我这样的人。
编辑:同时删除/etc/aliases.
| 归档时间: |
|
| 查看次数: |
17834 次 |
| 最近记录: |