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 / 问题 / 471581
Accepted
DavisTasar
DavisTasar
Asked: 2013-01-23 17:46:16 +0800 CST2013-01-23 17:46:16 +0800 CST 2013-01-23 17:46:16 +0800 CST

后缀:警告:连接到 127.0.0.1:10023:连接被拒绝,无法接收来自外部域的邮件

  • 772

我有一个 Postfix 服务器运行了很短的时间,它工作了,但我今天不得不重新启动服务器,我不再接收来自外部来源的电子邮件:

Jan 23 01:34:44 myservername postfix/smtpd[1055]: connect from db3ehsobe006.messaging.microsoft.com[213.199.154.144]
Jan 23 01:34:45 myservername postfix/smtpd[1055]: warning: connect to 127.0.0.1:10023: Connection refused
Jan 23 01:34:45 myservername postfix/smtpd[1055]: warning: problem talking to server 127.0.0.1:10023: Connection refused
Jan 23 01:34:46 myservername postfix/smtpd[1055]: warning: connect to 127.0.0.1:10023: Connection refused
Jan 23 01:34:46 myservername postfix/smtpd[1055]: warning: problem talking to server 127.0.0.1:10023: Connection refused
Jan 23 01:34:46 myservername postfix/smtpd[1055]: NOQUEUE: reject: RCPT from db3ehsobe006.messaging.microsoft.com[213.199.154.144]: 451 4.3.5 Server configuration problem; from=<MyKnownWorking@EmailAccountOutside> to=<[email protected]> proto=ESMTP helo=<db3outboundpool.messaging.microsoft.com>

服务器正在监听port 10023,但我注意到它只通过 IPv6 监听:

> sudo netstat -a | grep 10023
tcp6       0      0 ip6-localhost:10023     [::]:*                  LISTEN

我没有适当的防火墙规则来拒绝特定端口,该死,我继续刷新规则集只是为了确认它。这是我的 postconf -n 的输出(我删除了我的域名以代替“mydomain.com”:

> sudo postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
disable_vrfy_command = yes
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
message_size_limit = 0
mydestination = localhost.$mydomain, localhost, mail.mydomain.com, servername.mydomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
myorigin = /etc/mailname
readme_directory = no
receive_override_options = no_address_mappings
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = mail.mydomain.com ESMTP $mail_name
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
smtpd_tls_cert_file = /etc/ssl/private/mail.mydomain.com.crt
smtpd_tls_key_file = /etc/ssl/private/mail.mydomain.com.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/maps/alias.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_domains = mysql:/etc/postfix/maps/domain.cf
virtual_mailbox_limit = 0
virtual_mailbox_maps = mysql:/etc/postfix/maps/user.cf
virtual_uid_maps = static:5000

如您所见,我什至试图通过 inet_protocols 指定它侦听 ipv4 连接。我已经尝试过使用和不使用该命令。

任何故障排除方面的帮助将不胜感激!当然,如果您发现我的配置中有任何明显愚蠢的地方,我也不会拒绝建议或批评。

linux
  • 6 6 个回答
  • 21097 Views

6 个回答

  • Voted
  1. Best Answer
    KodeTitan
    2013-01-23T18:00:44+08:002013-01-23T18:00:44+08:00

    您对smtpd_recipient_restrictions的最后一次检查使用策略服务来验证收件人。通常这是一个 postgrey 服务,并且在 Postfix 连接到它时似乎有一些问题。

    smtpd_recipient_restrictions = ...,check_policy_service inet:127.0.0.1:10023, permit
    

    如果您从 smtpd_recipient_restrictions 中删除check_policy_service inet:127.0.0.1:10023,您应该消除该错误,但您仍然应该确定您的 postgrey 或将在此处运行的其他服务发生了什么。

    在 Unbuntu 系统上检查 Postgrey

    通常,postgrey 默认配置将在端口 10023 上侦听连接并确定是否应允许或拒绝它们。Unbutu 服务器上的一些部分,您可以检查它是否已安装...

    • 你有/etc/default/postgrey档案吗?这是基本的配置文件。
    • 你有/etc/postgrey文件夹吗?这是您可以将元素列入白名单的地方。
    • 当你运行时> which postgrey它会找到一个二进制文件吗?我的是在/usr/sbin/postgrey.
    • 你有/etc/init.d/postgrey在启动时启动它的脚本吗?这是 Ubuntu 守护进程的典型位置。

    这些只会给你一些线索,让你知道这个服务器是否曾经postgrey配置过。如果进程未在您的服务器上正常运行,您将需要进一步查找故障排除。

    • 6
  2. scorry
    2015-08-04T09:07:37+08:002015-08-04T09:07:37+08:00

    面对同样的问题,尝试了很多方法,例如bshea提出的,谷歌搜索和尝试。
    基础: Ubuntu 14.04.2 LTS,postgrey服务启动,但没有出现在进程列表中,即服务启动但悄悄退出。

    找到更改行的解决方案/etc/default/postgrey:

    更改此行:

    POSTGREY_OPTS="--inet=10023"
    

    对此

    POSTGREY_OPTS="--inet=127.0.0.1:10023"
    

    无需使用端口、协议,也不需要降级版本。无法解释原因,但服务ps -aux正常并且一切正常。

    • 6
  3. janfai
    2015-01-04T00:22:50+08:002015-01-04T00:22:50+08:00

    其实你也不是非要用ipv6,你可以把Postgrey和Postfix设置成ipv4。问题是,Postgrey(可能是 1.33 及更新版本)拒绝在 ipv4 localhost ip 127.0.0.1 上启动,因此您可以使用您的 ethX ip 地址。

    在/etc/postfix/main.cf中更改:

    check_policy_service inet:127.0.0.1:10023
    

    至:

    check_policy_service inet:<your_ipv4_address>:10023
    

    然后重启 Postfix:

    sudo service postfix restart
    

    在/etc/default/postgrey改变这个:

    POSTGREY_OPTS="--inet=10023 --delay=60"
    

    至:

    POSTGREY_OPTS="--inet=<your_ipv4_address>:10023 --delay=60"
    

    然后重启 Postgrey:

    sudo service postgrey restart
    

    这条 Debian 邮件列表消息非常有用:

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656046#25

    • 1
  4. B. Shea
    2015-05-20T07:53:22+08:002015-05-20T07:53:22+08:00

    IP:PORT 问题对我来说不是/不是问题(Ubuntu 14.04.2 LTS)。假设 postgrey 在本地端口附加/执行失败时中断/退出可能会产生误导。

    首先检查守护进程是否被识别为正在运行:

    sudo service postgrey status
    

    如果它没有运行/未被识别,您仍然会看到:

    warning: problem talking to server [::1]:10023: Connection refused
    

    在您的邮件日志中。Postgrey 根本没有附加/运行。如果您发现它正在运行(可能不止一次)并且无法停止服务或状态,则您可能遇到了 pid/truncate 问题。如果是这样,请执行以下操作:

    ps a | grep postgrey
    

    手动杀死(每个)进程。从 /var/run (/run) 中删除任何 postgrey.pid 文件。

    假设您所有的 postgrey 文件都是默认的并且它正在尝试启动,但是在重新启动/重新启动/停止时失败(在检查“sudo service postgrey status”之后),您可能遇到锁定文件和停止启动守护进程的命名进程的问题。

    POSTGREY 有一个非常基本的 init.d 脚本,它在执行之前/之后不会做太多检查。维护者确实需要为此努力。

    主要问题是 start-stop-daemon 寻找截断的命名文件 :

    ( https://bugs.launchpad.net/ubuntu/+source/postgrey/+bug/1289424 )

    安装的脚本检查 $NAME = "postgrey"。
    ( "--name $NAME" )
    不幸的是,它需要使用的 (Ubuntu/Debian) 是:'/usr/sbin/postg'
    (只有 15 个字符并且是路径的一部分 - 显然不存在。)

    修复(添加带有截断版本的变量 PROCNAME,包括路径):

    PROCNAME=`echo $DAEMON | cut -c -15`
    

    (然后将检查“/usr/sbin/postg”)

    并将进入“--name”:

      stop)
            log_daemon_msg "Stopping $DESC" "$NAME"
            if start-stop-daemon --stop --oknodo --quiet \
                    --pidfile $PIDFILE --name $PROCNAME
    

    ..

      reload|force-reload)
            log_action_begin_msg "Reloading $DESC configuration..."
            if start-stop-daemon --stop --signal 1 --quiet \
                    --pidfile $PIDFILE --name $PROCNAME
    

    (可选)
    当我在那里时,我将锁定文件放在它自己的目录中:'/run/postgrey/postgrey.pid'。

    如果你喜欢它在它自己的目录中,你需要添加这个位来每次重新创建文件夹:

    PIDFOLDER=/var/run/$NAME
    PIDFILE=$PIDFOLDER/$NAME.pid
    

    检查现有的目录/文件夹:

    check_pid_dir() {
      if [ ! -d $PIDFOLDER ]; then
        mkdir $PIDFOLDER
        chmod 0755 $PIDFOLDER
      fi
    }
    

    并在“开始”中添加功能:

    case "$1" in
      start)
            check_pid_dir
            log_daemon_msg "Starting $DESC" "$NAME"
    

    我的完整 init.d 脚本在这里: https
    ://gist.github.com/bmatthewshea/50e2038563b103e466ea 我还没有测试这么多 - 但到目前为止它肯定比默认工作得更好。:)

    • 1
  5. iva2k
    2013-08-12T10:44:41+08:002013-08-12T10:44:41+08:00

    戴维斯 - 你是对的,postgrey 在 12.04LTS 中被更改为在 IPv6 中工作。升级不会为 postfix 更改它,也不会提醒您进行更改。

    所以你必须自己做。改变这个:

    check_policy_service inet:127.0.0.1:10023
    

    至:

    check_policy_service inet:::1:10023
    

    在你的/etc/postfix/master.cf文件中,然后重启 postfix:

    sudo service postfix restart
    

    它将允许 postfix 将 IPv6 与 postgrey 通信。

    • 0
  6. Francesco
    2018-02-06T00:53:48+08:002018-02-06T00:53:48+08:00

    如果您将 Postfix 配置为仅使用 IPv4,这也会中断(因为我必须这样做,因为我的 ISP仍然不支持 IPv6,而且我的 IPv6 HE 隧道被 Netflix 等服务标记,从而破坏了 Netflix ...)

    将本地主机添加到 postgrey 的 INET 命令标志确实修复了它不绑定到 IPv4 的问题。

    我不明白为什么它不能同时绑定到 IPv4 和 IPv6 ...

    • 0

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

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

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

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

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

    • 9 个回答
  • Marko Smith

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

    • 3 个回答
  • Marko Smith

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

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +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