AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 116298
In Process
Lightbeard
Lightbeard
Asked: 2010-02-25 08:02:51 +0800 CST2010-02-25 08:02:51 +0800 CST 2010-02-25 08:02:51 +0800 CST

无法将邮件发送到 postfix /w iptables linux 代理

  • 772

我有两个独立的服务器,都运行 Ubuntu 8.04。

服务器 1 拥有我们网站的真实域名,我们将其称为example.com. 服务器 2 是我使用 postfix/courier 设置的邮件服务器。此服务器的主机名是mail.example.com。

我在服务器 1 上设置了 iptables,将端口 25 上的所有流量转发到服务器 2。我使用了这个脚本(除了我将目标 IP 地址和端口从 80 更改为 25)。

当我向它发送电子邮件时,[email protected]它可以工作。但是,当我尝试[email protected]从 gmail 发送电子邮件时,我收到此错误: 550 550 #5.1.0 Address rejected [email protected] (state 14)

/var/log/mail.log发生这种情况时不显示新行。

奇怪的是它可以在我的本地机器上使用 telnet。例如:

$ 远程登录 example.com 25
220 VO13421.localdomain SMTP 后缀
EHLO example.com
250-VO13421.localdomain
250-流水线
250 尺寸 10240000
250-ETRN
250-STARTTLS
250 增强状态代码
250-8BITMIME
250 DSN
发件人:[email protected]
250 2.1.0 好的
RCPT 收件人:[email protected]
250 2.1.5 好的
数据
354 请开始邮件输入。
你好用户...你好吗?
.
250 邮件排队等待投递。
退出
221 关闭连接。再见。

/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 后缀/smtpd [2212]:警告:忽略“许可”后的限制“smtpd_data_restrictions”
2 月 24 日 09:48:01 VO13421 后缀/smtpd[2212]: 65C68120321: client=81.208.68.208.static.dnsptr.net[208.68.xxx.xxx]
2 月 24 日 09:48:29 VO13421 后缀/smtpd [2212]:警告:忽略“许可”后的限制“smtpd_data_restrictions”
2 月 24 日 09:48:29 VO13421 后缀/smtpd[2212]: 6BDFA120321: client=81.208.68.208.static.dnsptr.net[208.68.xxx.xxx]
2 月 24 日 09:48:29 VO13421 后缀/清理 [2216]: 6BDFA120321: message-id=
Feb 24 09:48:29 VO13421 postfix/qmgr[2042]: 6BDFA120321: from=, size=395, nrcpt=1 (queue active)
2 月 24 日 09:48:29 VO13421 后缀/虚拟[2217]:6BDFA120321:to=,relay=virtual,delay=0.28,delays=0.25/0.02/0/0.01,dsn=2.0.0,status=sent(发送到邮件目录)
2 月 24 日 09:48:29 VO13421 后缀/qmgr[2042]:6BDFA120321:已删除
2 月 24 日 09:48:30 VO13421 后缀/smtpd[2212]:断开与 81.208.68.208.static.dnsptr.net[208.68.xxx.xxx] 的连接

iptables -L -n -v --line在 example.com 上产生以下内容。任何人都知道一个 iptables 命令来查看端口转发?此外,它似乎接受所有流量,这可能很糟糕吧?;]

num pkts bytes target prot opt in out source destination
1 14041 1023K 全部接受 -- * * 0.0.0.0/0 0.0.0.0/0

Chain FORWARD(策略接受 0 个数据包,0 个字节)
num pkts bytes target prot opt in out source destination
1 338 20722 接受所有 -- * * 0.0.0.0/0 0.0.0.0/0

链输出(策略接受 419K 数据包,425M 字节)
num pkts bytes target prot opt in out source destination
1 13711 2824K 全部接受 -- * * 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 = 否
比夫=没有
config_directory = /etc/postfix
delay_warning_time = 4h
disable_vrfy_command = 是
inet_interfaces = 所有
local_recipient_maps =
邮箱大小限制 = 0
masquerade_domains = mail.example.com mail1.example.com
masquerade_exceptions = 根
最大退避时间 = 8000 秒
最大队列寿命 = 7d
minimum_backoff_time = 1000s
我的目的地 =
我的网络 = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = 主机
myorigin = example.com
自述目录 = 否
收件人分隔符 = +
中继主机 =
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、permit
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、permit
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
postfix iptables
  • 4 4 个回答
  • 1270 Views

4 个回答

  • Voted
  1. adaptr
    2012-03-13T00:59:22+08:002012-03-13T00:59:22+08:00

    550 550 #5.1.0 Address rejected [email protected] (state 14)不是后缀消息,它可以解释“/var/log/mail.log 在发生这种情况时没有显示新行。”;也许您没有连接到您认为自己所在的位置。

    此外,根据parent_domain_matches_subdomains的设置,*.example.com 将匹配“example.com”,无论它在后缀中配置。

    虽然[email protected] | [email protected]有点奇怪,但我们还需要查看 virtual_alias_domains 和 virtual_mailbox_* 表的内容。

    • 2
  2. ΤΖΩΤΖΙΟΥ
    2010-02-25T14:35:53+08:002010-02-25T14:35:53+08:00

    mydestinationServer2:/etc/postfix/main.cf 中设置的变量是什么?除了您可能遇到的其他问题外,我相信如果mydestination包含,example.com那么邮件将被接受。如果您需要更多帮助,请评论或更新问题。

    • 1
  3. Lightbeard
    2010-02-25T18:06:41+08:002010-02-25T18:06:41+08:00

    也许我的aliasesmysql表有问题?

    +--------+------------------------+------------------ -----+----------+
    | pkid | 邮件 | 目的地 | 启用 |
    +--------+------------------------+------------------ -----+----------+
    | 1 | 邮递员@localhost | 根@本地主机 | 1 |
    | 2 | 系统管理员@本地主机 | 根@本地主机 | 1 |
    | 3 | 网站管理员@localhost | 根@本地主机 | 1 |
    | 4 | 滥用@localhost | 根@本地主机 | 1 |
    | 5 | 根@本地主机 | 根@本地主机 | 1 |
    | 6 | @本地主机 | 根@本地主机 | 1 |
    | 7 | @localhost.localdomain | @本地主机 | 1 |
    | 8 | @mail.example.com | @example.com | 1 |
    | 9 | [email protected] | 邮递员@localhost | 1 |
    | 10 | 滥用@example.com | 滥用@localhost | 1 |
    | 11 | 用户@example.com | 用户@example.com | 1 |
    +--------+------------------------+------------------ -----+----------+
    • 0
  4. proy
    2012-03-13T01:30:41+08:002012-03-13T01:30:41+08:00

    您能否查看 example.com 的 MX 记录是否设置正确。因为正如适配器所说,/var/log/mail.log 中没有错误消息。

    • 0

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve