Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to confirm to SPF and DKIM, this requires me to send email using the IP written in the DNS record of the domain

I have two domains example1.com and example2.com with two IPs 100.0.0.1 and 100.0.0.2 respectively.

How can I configure postfix to always use IP 100.0.0.1 when the send from address is xx@example1.com and the same to be true for the other domain.

When connecting to the SMTP transport I am using localhost, I know I can configure two postfix instances for each IP and then just connect to the right IP when sending depending on the domain, I would like to see if this can be avoided.

How can this be done?

share|improve this question
1  
Why not just add both IPs in SPF using include:otherdomain.tld? DKIM has nothing to do with the IP address afaik. –  gertvdijk Dec 11 '12 at 15:55
    
I did not think about that, what about reverse DNS issue, when reverse DNSing one ip, the domains will not match, some MTA's use SPF some use PTR some use reverse dns rDNS, how can this be solved? –  David MZ Dec 11 '12 at 16:07
    
I am not aware about MTAs actually matching the rDNS record, I only know about verify their existence. –  gertvdijk Dec 11 '12 at 16:09
    
I mean they see if ip 1 matches the domain 1, because if they don't check it's very easy to fool them for spammers –  David MZ Dec 11 '12 at 16:37
    
Nope. Somebody has been telling you a fairytale I guess. Those checks on the source IP for mail are done using SPF, possibly against a DNSBL (also PBL), possibly for acceptance of the Return-Path sender address given, but not on a 'match' for the latter one on rDNS. That would break all ways of doing mail relay by a 3rd party (e.g. Amazon SES). –  gertvdijk Dec 11 '12 at 22:21

2 Answers 2

May take some fiddling, but i think you can achieve this in the following way:

  • configure your original smtpd listener in master.cf to route mail where sender is from each respective domain to two new, local smtpd listeners
  • setup 2 additional smtpd listeners in master.cf that have their own main.cf files (eg. example1.main.cf and example2.main.cf) :http://www.postfix.org/master.5.html (in said master.cf file, you can override various settings for main.cf via the -o name=value mechanism)
  • configure the new main.cf files with appropriate outbound interface configurations and other related main.cf configs
share|improve this answer

You can specify sender as user@example1.com and user@example2.com to send mails from an Ip/Host by using sender dependent sasl authentication. Follow these links. http://www.postfix.org/SASL_README.html#client_sasl_sender And in other terms. http://www.cyberciti.biz/faq/postfix-multiple-isp-accounts-smarthost-smtp-client/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.