我有两个独立的服务器,都运行Ubuntu 8.04。
服务器1具有我们网站的真实域名,我们将其称为example.com 。 服务器2是我用postfix / courier设置的邮件服务器。 该服务器的主机名是mail.example.com 。
我已经在服务器1上设置iptables转发端口25上的所有stream量到服务器2.我用这个脚本 (除了我改变目标IP地址和端口从80到25)。
当我发送电子邮件到[email protected]它的作品。 但是,当我尝试从gmail发送邮件到[email protected]时,出现这个错误: 550 550 #5.1.0 Address rejected [email protected] (state 14)
/var/log/mail.log在这种情况下不显示新行。
奇怪的是,它可以在本地机器上使用telnet。 例如:
$ telnet example.com 25 220 VO13421.localdomain SMTP后缀 EHLO example.com 250 VO13421.localdomain 250stream水 250-SIZE 10240000 250-ETRN 250-STARTTLS 250 ENHANCEDSTATUSCODES 250-8BITMIME 250个DSN 邮件来自:[email protected] 250 2.1.0好的 RCPT TO:[email protected] 250 2.1.5好的 数据 354请开始邮件input。 你好用户...你好吗? 。 250邮件排队等候发货。 放弃 221closures连接。 再见。
/var/log/mail.log显示成功(邮件发送到maildr):
2月24日09:47:36 VO13421后缀/ smtpd [2212]:连接从81.208.68.208.static.dnsptr.net [208.68.xxx.xxx] 2月24日09:48:01 VO13421 postfix / smtpd [2212]:警告:限制'smtpd_data_restrictions'在'permit'后被忽略 Feb 24 09:48:01 VO13421 postfix / smtpd [2212]:65C68120321:client = 81.208.68.208.static.dnsptr.net [208.68.xxx.xxx] 2月24日09:48:29 VO13421 postfix / smtpd [2212]:警告:限制'smtpd_data_restrictions'在'permit'后被忽略 Feb 24 09:48:29 VO13421 postfix / smtpd [2212]:6BDFA120321:client = 81.208.68.208.static.dnsptr.net [208.68.xxx.xxx] Feb 24 09:48:29 VO13421 postfix / cleanup [2216]:6BDFA120321:message-id = Feb 24 09:48:29 VO13421 postfix / qmgr:6BDFA120321:from =,size = 395,nrcpt = 1(队列激活) Feb 24 09:48:29 VO13421 postfix / virtual [2217]:6BDFA120321:to =,relay = virtual,delay = 0.28,delay = 0.25 / 0.02 / 0 / 0.01,dsn = 2.0.0,status = sent邮件目录) Feb 24 09:48:29 VO13421 postfix / qmgr [0242]:6BDFA120321:已删除 Feb 24 09:48:30 VO13421 postfix / smtpd [2212]:从81.208.68.208.static.dnsptr.net [208.68.xxx.xxx]
在example.com上的iptables -L -n -v --line生成以下内容。 任何人都知道一个iptables命令来查看端口转发? 另外,它似乎接受所有的stream量,这可能是不好的权利? ]
num pkts字节目标protselect输出源目的地 1 14041 1023K ACCEPT all - * * 0.0.0.0/0 0.0.0.0/0 链FORWARD(策略接受0包,0字节) num pkts字节目标protselect输出源目的地 1 338 20722全部接受 - * * 0.0.0.0/0 0.0.0.0/0 链OUTPUT(策略ACCEPT 419K包,425M字节) num pkts字节目标protselect输出源目的地 1 13711 2824K ACCEPT all - * * 0.0.0.0/0 0.0.0.0/0
postconf -n结果是:
alias_database = hash:/ etc / postfix / aliases
alias_maps = hash:/ etc / postfix / aliases
append_dot_mydomain = no
biff = no
config_directory = / etc / postfix
delay_warning_time = 4h
disable_vrfy_command =是
inet_interfaces = all
local_recipient_maps =
mailbox_size_limit = 0
masquerade_domains = mail.example.com mail1.example.com
masquerade_exceptions = root
maximal_backoff_time = 8000s
maximal_queue_lifetime = 7d
minimal_backoff_time = 1000s
mydestination =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [:: 1] / 128
mynetworks_style = host
myorigin = example.com
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_helo_timeout = 60s
smtp_tls_session_cache_database = btree:$ {data_directory} / smtp_scache
smtpd_banner = $ myhostname SMTP $ mail_name
smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org,reject_rbl_client blackholes.easynet.nl,reject_rbl_client dnsbl.njabl.org
smtpd_delay_reject =是
smtpd_hard_error_limit = 12
smtpd_helo_required =是
smtpd_helo_restrictions = permit_mynetworks,warn_if_reject reject_non_fqdn_hostname,reject_invalid_hostname,许可
smtpd_recipient_limit = 16
smtpd_recipient_restrictions = reject_unauth_pipelining,permit_mynetworks,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_destination,许可smtpd_data_restrictions = reject_unauth_pipelining
smtpd_sender_restrictions = permit_mynetworks,warn_if_reject reject_non_fqdn_sender,reject_unknown_sender_domain,reject_unauth_pipelining,许可
smtpd_soft_error_limit = 3
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:$ {data_directory} / smtpd_scache
smtpd_use_tls =是
unknown_local_recipient_reject_code = 450
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
virtual_gid_maps = mysql:/etc/postfix/mysql_gid.cf
virtual_mailbox_base = / var / spool / mail / virtual
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
virtual_uid_maps = mysql:/etc/postfix/mysql_uid.cf
550 550 #5.1.0 Address rejected [email protected] (state 14)不是postfix消息,这将解释“/var/log/mail.log在这种情况下不显示新行”。 也许你没有连接你认为你的地方。
此外,取决于parent_domain_matches_subdomains的设置,* .example.com将匹配“example.com”,无论它在Postfix中进行configuration。
而[email protected] | [email protected] [email protected] | [email protected] ,我们也需要查看virtual_alias_domains和virtual_mailbox_ *表的内容。
什么是在Server2中设置的variablesmydestination :/etc/postfix/main.cf? 除了您可能遇到的其他问题,我相信如果mydestination包含example.com那么邮件将被接受。 如果您需要更多帮助,请发表评论或更新问题。
也许我的aliases mysql表有什么问题?
+ ------ + ------------------------ + ----------------- ----- + --------- + | pkid | 邮件| 目的地| 启用| + ------ + ------------------------ + ----------------- ----- + --------- + | 1 | postmaster @ localhost | root @ localhost | 1 | | 2 | sysadmin @ localhost | root @ localhost | 1 | | 3 | webmaster @ localhost | root @ localhost | 1 | | 4 | 滥用@ localhost | root @ localhost | 1 | | 5 | root @ localhost | root @ localhost | 1 | | 6 | @localhost | root @ localhost | 1 | | 7 | @ localhost.localdomain | @localhost | 1 | | 8 | @ mail.example.com | @ example.com | 1 | | 9 | [email protected] | postmaster @ localhost | 1 | | 10 | [email protected] | 滥用@ localhost | 1 | | 11 | [email protected] | [email protected] | 1 | + ------ + ------------------------ + ----------------- ----- + --------- +
您能否看到example.com的MXlogging是否正确设置。 因为adaptr说在/var/log/mail.log中没有错误信息。