virtual_alias_domains – 转发邮件时如何使用不同的IP地址?

我在具有4个IP地址的CentOS 6.6 Linux服务器上托pipe2个Web域(domain1.com和domain2.com)。

Postfix 2.6.6接收邮件到[email protected][email protected] ,并将它们转发到person1@gmail.com[email protected] 。 这里是configuration文件的摘录:

/etc/postfix/main.cf中

inet_interfaces = all inet_protocols = ipv4 virtual_alias_domains = domain1.com domain2.com virtual_alias_maps = hash:/etc/postfix/virtual smtp_generic_maps = hash:/etc/postfix/generic 

/等/后缀/虚拟

 [email protected] [email protected] [email protected] [email protected] 

我的问题是,第一个人(我的父亲,自1990年以来在互联网上的业务)变成了很多垃圾邮件。 我使用Spamassassin拒绝这些邮件,但有些仍然通过,当转发到[email protected]他们导致Google扼杀我的服务器:

DFC32800849 3412 Fri Jan 30 11:40:38 [email protected](主机alt1.gmail-smtp-in.l.google.com [74.125.130.26]说:421-4.7.0 [144.76.123.123 15]我们的系统检测到来自您IP地址的421-4.7.0不请自来的邮件的exception速率为了保护我们的421-4.7.0用户免受垃圾邮件,从您的IP地址发送的邮件已暂时421-4.7.0速率有限​​,请访问421-4.7.0 http://www.google.com/mail/help/bulk_mail.html查看我们的Bulk 421 4.7.0电子邮件发件人指南。fl14si17784804pdb.81 – gsmtp(在DATA命令结束时回复))person1 @ gmail.com

这会影响第二个人,经过长时间的延迟,他们会收到邮件给[email protected]

我的问题是,是否可以configurationPostfix,使它使用不同的IP地址(因为我的服务器有4个)用于转发邮件?

谢谢你,下面是当前的“postconf -n”输出:

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 header_checks = pcre:/etc/postfix/header_checks html_directory = no inet_interfaces = all inet_protocols = ipv4 mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost myhostname = www.domain1.com newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_destination_concurrency_limit = 2 smtp_destination_rate_delay = 40s smtp_generic_maps = hash:/etc/postfix/generic unknown_local_recipient_reject_code = 550 virtual_alias_domains = domain1.com domain2.com virtual_alias_maps = hash:/etc/postfix/virtual 

更新:

我修改了我的configuration文件build议通过undefined (谢谢!),然后运行postmap /etc/postfix/transportservice postfix restart

/etc/mail/master.cf

 smtp unix - - n - - smtp smtp-1 unix - - n - - smtp -o smtp_bind_address=my_ip_3 smtp-2 unix - - n - - smtp -o smtp_bind_address=my_ip_4 

/ etc / mail / transport

 [email protected] smtp-1: [email protected] smtp-2: 

不幸的是,我仍然看到邮件标题中的旧有问题的my_ip_2

我怎样才能确认新的“运输”正在使用?

以下是更改后的日志摘录:

 Feb 7 14:56:50 www postfix/postsuper[14206]: Deleted: 92 messages Feb 7 14:57:06 www postfix/anvil[14172]: statistics: max connection rate 1/60s for (smtp:37.233.142.116) at Feb 7 14:53:45 Feb 7 14:57:06 www postfix/anvil[14172]: statistics: max connection count 1 for (smtp:37.233.142.116) at Feb 7 14:53:45 Feb 7 14:57:06 www postfix/anvil[14172]: statistics: max cache size 1 at Feb 7 14:53:45 Feb 7 14:57:07 www postfix/smtp[14008]: warning: open active 6870A8007E8: No such file or directory Feb 7 14:57:14 www postfix/smtpd[14213]: connect from mail-ie0-f171.google.com[209.85.223.171] Feb 7 14:57:14 www postfix/smtpd[14216]: connect from unknown[213.179.214.207] Feb 7 14:57:14 www postfix/smtpd[14213]: 3EBA0800187: client=mail-ie0-f171.google.com[209.85.223.171] Feb 7 14:57:14 www postfix/cleanup[14218]: 3EBA0800187: message-id=<CAADeyWgtCh21w-_AbKaPrq_kj2A=YjRi7OXHyjjruL01MR6sqw@mail.gmail.com> Feb 7 14:57:14 www postfix/qmgr[12668]: 3EBA0800187: from=<[email protected]>, size=1707, nrcpt=1 (queue active) Feb 7 14:57:14 www spamd[1856]: spamd: connection from localhost [127.0.0.1] at port 34152 Feb 7 14:57:14 www spamd[1856]: spamd: setuid to spam succeeded Feb 7 14:57:14 www spamd[1856]: spamd: processing message <CAADeyWgtCh21w-_AbKaPrq_kj2A=YjRi7OXHyjjruL01MR6sqw@mail.gmail.com> for spam:502 Feb 7 14:57:14 www spamd[1856]: spamd: clean message (-1.9/5.0) for spam:502 in 0.0 seconds, 1670 bytes. Feb 7 14:57:14 www spamd[1856]: spamd: result: . -1 - BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,T_DKIM_INVALID scantime=0.0,size=1670,user=spam,uid=502,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=34152,mid=<CAADeyWgtCh21w-_AbKaPrq_kj2A=YjRi7OXHyjjruL01MR6sqw@mail.gmail.com>,bayes=0.000000,autolearn=ham Feb 7 14:57:14 www postfix/smtpd[14216]: 68890800246: client=unknown[213.179.214.207] Feb 7 14:57:14 www postfix/pipe[14219]: 3EBA0800187: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=0.18, delays=0.13/0/0/0.05, dsn=2.0.0, status=sent (delivered via spamassassin service) Feb 7 14:57:14 www postfix/qmgr[12668]: 3EBA0800187: removed Feb 7 14:57:14 www postfix/pickup[14119]: 69FD7800187: uid=502 from=<[email protected]> Feb 7 14:57:14 www postfix/cleanup[14223]: 69FD7800187: message-id=<CAADeyWgtCh21w-_AbKaPrq_kj2A=YjRi7OXHyjjruL01MR6sqw@mail.gmail.com> Feb 7 14:57:14 www postfix/qmgr[12668]: 69FD7800187: from=<[email protected]>, size=2042, nrcpt=1 (queue active) Feb 7 14:57:14 www spamd[1762]: prefork: child states: II Feb 7 14:57:14 www postfix/smtpd[14213]: disconnect from mail-ie0-f171.google.com[209.85.223.171] Feb 7 14:57:14 www postfix/cleanup[14218]: 68890800246: message-id=<[email protected]> Feb 7 14:57:14 www postfix/qmgr[12668]: 68890800246: from=<[email protected]>, size=13993, nrcpt=1 (queue active) Feb 7 14:57:14 www spamd[1856]: spamd: connection from localhost [127.0.0.1] at port 34153 Feb 7 14:57:14 www spamd[1856]: spamd: setuid to spam succeeded Feb 7 14:57:14 www spamd[1856]: spamd: processing message <[email protected]> for spam:502 Feb 7 14:57:14 www postfix/smtpd[14216]: disconnect from unknown[213.179.214.207] Feb 7 14:57:14 www spamd[1856]: spamd: clean message (1.6/5.0) for spam:502 in 0.2 seconds, 13741 bytes. Feb 7 14:57:14 www spamd[1856]: spamd: result: . 1 - BAYES_50,HTML_MESSAGE,RDNS_NONE,T_REMOTE_IMAGE,UNPARSEABLE_RELAY scantime=0.2,size=13741,user=spam,uid=502,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=34153,mid=<[email protected]>,bayes=0.484741,autolearn=no Feb 7 14:57:15 www postfix/pickup[14119]: 00CD6800247: uid=502 from=<[email protected]> Feb 7 14:57:15 www postfix/cleanup[14223]: 00CD6800247: message-id=<[email protected]> Feb 7 14:57:15 www postfix/pipe[14219]: 68890800246: to=<[email protected]>, orig_to=<[email protected]>, relay=spamassassin, delay=0.68, delays=0.43/0/0/0.25, dsn=2.0.0, status=sent (delivered via spamassassin service) Feb 7 14:57:15 www postfix/qmgr[12668]: 68890800246: removed Feb 7 14:57:15 www postfix/qmgr[12668]: 00CD6800247: from=<[email protected]>, size=14341, nrcpt=1 (queue active) Feb 7 14:57:15 www spamd[1762]: prefork: child states: II Feb 7 14:57:47 www postfix/smtp[14008]: warning: open active A6F92801560: No such file or directory 

不幸的是,在交付的testing邮件中仍然会看到相同的IP(由Google扼杀)144.76.184.154:

 Delivered-To: [email protected] Received: by 10.170.190.67 with SMTP id h64csp2513657yke; Sat, 7 Feb 2015 05:59:08 -0800 (PST) X-Received: by 10.180.89.210 with SMTP id bq18mr14321108wib.45.1423317548028; Sat, 07 Feb 2015 05:59:08 -0800 (PST) Return-Path: <[email protected]> Received: from www.afarber.de ([144.76.184.154]) by mx.google.com with ESMTP id k10si7979060wif.41.2015.02.07.05.59.07 for <[email protected]>; Sat, 07 Feb 2015 05:59:08 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning [email protected] does not designate 144.76.184.154 as permitted sender) client-ip=144.76.184.154; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning [email protected] does not designate 144.76.184.154 as permitted sender) [email protected]; dkim=pass [email protected]; dmarc=pass (p=NONE dis=NONE) header.from=gmail.com Received: by www.afarber.de (Postfix, from userid 502) id 69FD7800187; Sat, 7 Feb 2015 14:57:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.afarber.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by www.afarber.de (Postfix) with ESMTP id 3EBA0800187 for <[email protected]>; Sat, 7 Feb 2015 14:57:14 +0100 (CET) 

这不是我为smtp-1或smtp-2指定的IP。

更新2:

我已经添加了“-v”到/etc/postfix/master.cf

 smtp inet n - n - - smtpd -o content_filter=spamassassin .... smtp unix - - n - - smtp smtp-1 unix - - n - - smtp -o smtp_bind_address=144.76.184.155 -v smtp-2 unix - - n - - smtp -o smtp_bind_address=144.76.184.156 -v .... spamassassin unix - nn - - pipe user=spam argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient} 

现在在/ var / log / maillog中看到更多的Spamassassin消息。

这里是更新后的“postconf -n”输出(从上面解开):

 alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 header_checks = pcre:/etc/postfix/header_checks html_directory = no inet_interfaces = all inet_protocols = ipv4 mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost myhostname = www.afarber.de newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtp_destination_concurrency_limit = 2 smtp_destination_rate_delay = 40s smtp_generic_maps = hash:/etc/postfix/generic unknown_local_recipient_reject_code = 550 virtual_alias_domains = videoskat.de balkan-preferans.de simplex.ru larissa-farber.de bukvy.de slova.de virtual_alias_maps = hash:/etc/postfix/virtual 

我在这里看到两个解决scheme

  1. (我做了这样的configuration很多年前)谷歌使用许多IP的MX。 您可以在交通地图中定义第一封邮件是通过gmail-smtp-in.l.google.com。发送的,第二封是通过alt1.gmail-smtp-in.l.google.com发送的。 然后 – 使用iptables和nat / POSTROUTING – nat连接到第一个google MX通过第一个ip,然后到第二个google MX通过第二个ip。

  2. (未经testing,但应该工作)用于传出邮件的IP通过smtp_bind_address定义。 你可以在master.cf中定义第二个(和下一个)smtp传输,如:

 smtp-1 unix  -   -  n  -   -  smtp -o smtp_bind_address = firstip
 smtp-2 unix  -   -  n  -   -  smtp -o smtp_bind_address = secondip

然后在交通图中定义如下:

 [email protected] smtp-1: [email protected] smtp-2: 

您必须在main.cf文件中指定使用transportmap文件:

 transport_maps = hash:/etc/mail/transport 

并运行

 postmap /etc/mail/transport 

创build它的哈希映射。