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 / 问题 / 409160
Accepted
Pablo
Pablo
Asked: 2012-07-20 01:41:46 +0800 CST2012-07-20 01:41:46 +0800 CST 2012-07-20 01:41:46 +0800 CST

发送邮件到 cron 连接到错误的 IP

  • 772

我正在运行带有 Ubuntu 12.04 的服务器,我们有一些 cron 作业可以生成我们想要接收的电子邮件。为了处理那个和其他类似的邮件,我安装了 postfix 并将其配置为仅在本地主机上侦听,因为我不希望随机的人甚至试图将它用作 SMTP 中继。

我可以通过运行成功发送邮件:

mail [email protected]

但是当 cron 运行时,它会以某种方式尝试连接到机器的公共 IP,但失败了,因为它们不受后缀约束:

Jul 19 09:29:01 einstein cron[5503]: (postgres) RELOAD (crontabs/postgres)
Jul 19 09:29:01 einstein CRON[12119]: (postgres) CMD (ls /)
Jul 19 09:29:01 einstein postfix/pickup[11890]: 5F43928ACE: uid=109 from=<postgres>
Jul 19 09:29:01 einstein postfix/cleanup[12068]: 5F43928ACE: message-id=<[email protected]>
Jul 19 09:29:01 einstein postfix/qmgr[11891]: 5F43928ACE: from=<[email protected]>, size=647, nrcpt=1 (queue active)
Jul 19 09:29:01 einstein postfix/smtp[12073]: connect to einstein.example.com[176.5.13.71]:25: Connection refused
Jul 19 09:29:01 einstein postfix/smtp[12073]: connect to einstein.example.com[2a01:5800::96f1]:25: Connection refused
Jul 19 09:29:01 einstein postfix/smtp[12073]: 5F43928ACE: to=<[email protected]>, orig_to=<postgres>, relay=none, delay=0.01, delays=0/0/0/0, dsn=4.4.1, status=deferred (connect to einstein.example.com[2a01:5800::96f1]:25: Connection refused)

我什至不确定哪个程序连接到错误的 IP,所以我不知道如何开始解决它。谁能指出我正确的方向?

我的 Postfix 配置非常标准:

# This file is managed by puppet, any manual changes will be lost.
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = einstein.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localdomain, localhost, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
myorigin = /etc/mailname
inet_protocols = all
ubuntu cron postfix
  • 1 1 个回答
  • 340 Views

1 个回答

  • Voted
  1. Best Answer
    adaptr
    2012-07-20T01:46:44+08:002012-07-20T01:46:44+08:00

    根据定义,cron 不会连接到任何地方来发送电子邮件;它使用由 postfix 和其他 MTA 公开的 sendmail(1) 接口。

    如您的日志所示,postfix 正在尝试通过 SMTP 将邮件发送给自己;发生这种情况是因为 postfix 不知道它应该处理 einstein.example.com 的邮件。

    将域添加到 mydestination 并重新加载 postfix。

    • 2

相关问题

  • 无法通过 Ubuntu VPN 访问外部网络

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

  • VirtualBox 上 Ubuntu 的访客优化技巧 [关闭]

  • 外部硬盘上的 virtualbox 虚拟硬盘驱动器(Vista 主机上的 ubuntu 客户机)

  • 如何在 Ubuntu 上挂载 LVM 分区?

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