psad 无法通过 mandrill smtp 和 postfix 发送电子邮件

psad 无法通过 mandrill smtp 和 postfix 发送电子邮件

我已经安装普萨德在我的 Ubuntu 13 系统上,我已经将其设置为发送电子邮件(我有后缀安装为邮件服务器,并进行 smtp 中继山魈的服务器)发送到某个电子邮件地址,但似乎它发送的内容不符合 mandrill 的过滤器的要求。

这将是到达 mandrill 的 API 调用:

{
    "from_email": null,
    "from_name": null,
    "send_at": null,
    "async": false,
    "raw_message": "Received: from pulsr.io (unknown [95.85.35.223])\n\t(Authenticated sender: [email protected])\n\tby ip-10-75-135-250 (Postfix) with ESMTPSA id C030E3C0CF4\n\tfor <[email protected]>; Mon, 14 Apr 2014 15:10:27 +0000 (UTC)\nReceived: by pulsr.io (Postfix, from userid 0)\n\tid 7E42B61753; Mon, 14 Apr 2014 11:10:27 -0400 (EDT)\nSubject: [psad-status] firewall setup warning on pulsr!\nTo: <[email protected]>\nX-Mailer: mail (GNU Mailutils 2.99.98)\nMessage-Id: <[email protected]>\nDate: Mon, 14 Apr 2014 11:10:27 -0400 (EDT)\nFrom: root@pulsr (root)\n\n[-] You may just need to add a default logging rule to the /sbin/ip6tables\n    'filter' 'INPUT' chain on pulsr.  For more information,\n    see the file \"FW_HELP\" in the psad sources directory or visit:\n\n    http://www.cipherdyne.org/psad/docs/fwconfig.html\n",
    "ip_pool": null,
    "to": [
        "[email protected]"
    ],
    "return_path_domain": null,
    "key": "MY_MANDRILL_API_KEY"
}

他们会这样回答:

[
    {
        "email": "[email protected]",
        "status": "rejected",
        "_id": "a8c60b80ad3745e48398516bea7ca768",
        "reject_reason": "invalid-sender"
    }
]

它一定是带有字符串的内容,因为其他成功的电子邮件在属性上raw_message具有相同的值,但是具有不同的。nullraw_message

工作电子邮件的示例如下:

{
    "async": false,
    "send_at": null,
    "ip_pool": null,
    "from_name": null,
    "to": [
        "[email protected]"
    ],
    "return_path_domain": null,
    "raw_message": "Received: from pulsr.io (unknown [95.85.35.223])\n\t(Authenticated sender: [email protected])\n\tby ip-10-33-35-82 (Postfix) with ESMTPSA id 894FE2031D\n\tfor <[email protected]>; Mon, 14 Apr 2014 12:52:04 +0000 (UTC)\nReceived: by pulsr.io (Postfix, from userid 0)\n\tid 51038608D5; Mon, 14 Apr 2014 08:52:04 -0400 (EDT)\nFrom: Pulsr <[email protected]>\nSubject: RKHunter\nTo: <[email protected]>\nX-Mailer: mail (GNU Mailutils 2.99.98)\nMessage-Id: <[email protected]>\nDate: Mon, 14 Apr 2014 08:52:04 -0400 (EDT)\n\nPlease inspect this machine, because it may be infected.",
    "from_email": null,
    "key": "MY_MANDRILL_API_KEY"
}

响应如下:

[
    {
        "email": "[email protected]",
        "status": "sent",
        "_id": "ab8df939be544023a8afb77be5a1e7a8",
        "reject_reason": null
    }
]

我已经尝试了两天来弄清楚发生了什么,但毫无头绪。如果有人以前遇到过同样的问题(可能是使用 Google 的 SMTP 作为中继),那么一点帮助就太好了。

编辑:我的 Postfix/etc/postfix/main.conf文件:

# RFC requirement
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)

# Local user mail notification off
biff = yes

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

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.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

# Hostname
myhostname = pulsr.io

# Domain
mydomain = pulsr.io

#virtual_alias_maps = hash:/etc/postfix/virtual
#virtual_alias_domains = /etc/postfix/vhosts.txt

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

mydestination = pulsr localhost.pulsr.io localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +

inet_interfaces = all
inet_protocols = all

# Mandrill
relayhost = [smtp.mandrillapp.com]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

# Add Missing Headers
always_add_missing_headers = yes

答案1

Mandrill 要求您的发件人电子邮件地址具有完全限定域名。 所以,[电子邮件保护]可以接受,但 root@myhost 或没有域名的 root 则不行。您可以通过更改 myhostname 或 myorigin main.cf 值以包含您的完整域名,让 postfix 自动修复您的邮件。

答案2

我已通过将我的机器主机名更改为内部有效的 FQDN 主机名来修复此问题/etc/hostname

前:

pulsr

现在:

pulsr.io

看起来 postfix 对此完全不负责,psad 或 psad 使用的 mta 正在使用机器的主机名。我本来希望 postfix 始终能够处理。

相关内容