1

I have Postfix setup in a test environment, segregated from our LAN, and relaying for hosts in the test environment. Originally, I had all outbound email funneling through procmail and into a single account on the postfix box (accessed via Dovecot by the devs). This allows the developers to test production code which sends email notifications without having the email actually reach it's intended recipient.

Now I need to actually allow for one host to relay to the actual world and not the "funnel" account. I still need to "lie" and accept email from any sender to anywhere (in the test environment of course) and funnel it into the funneluser account. I'm not quite sure what to even google for as this isn't a typical postfix setup. How can I add an exception for a single sending host, given the config below?

UPDATE The noted "duplicate question" does not, at this time, contain a working example for postfix 2.9.6-1~12.04.

postconf: warning: /etc/postfix/master.cf: unused parameter: smtpd_client_restriction=check
/usr/sbin/postconf: warning: /etc/postfix/master.cf: unused parameter: smtpd_client_restriction=check

Neither am I certain it's actually a duplicate as the answer appears to route mail based on user@domain pair. I want to route based on the connected host IP address or DNS hostname. I have posted a question to the linked "duplicate" in an attempt to resolve the issue.

My main.conf looks like this:

myhostname           = cliff.blah.net
alias_database       = hash:/etc/aliases
mydestination        = regexp:/etc/postfix/virtual_domains
virtual_alias_maps   = regexp:/etc/postfix/virtual
mynetworks           = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 10.2.1.0/24
mailbox_command      = /usr/bin/procmail
relay_domains        = .blah.net
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject
local_recipient_maps         =

virtual and virtual_domains are here:

# cat virtual
/@/     funnelmail

# cat virtual_domains
/.*/ MATCH

UPDATE2 I cannot get the example at the link above working. Maybe there is a difference in postfix versions or too many typos I don't know. I did get multipole instances running with same server on different ports but cannot post my solution here because someone closed the thread so good luck.

4
  • Not sure postfix relay based on origin will work for me as it appears to route mail based on the user@domain pair. I'm not doing that. I want to route based on only the domain of the connected server. Also, I just get errors with the configuration in the answer there. Posted a Q, guess I'll wait and see if it gets answered. Mar 3, 2015 at 15:24
  • Hi, you can see pseudocode in the answer of duplicated question, that it relay based on client. And for the solution of funnel it into the funneluser account, you can using REDIRECT function from postfix.
    – masegaloeh
    Mar 3, 2015 at 21:22
  • Ah yes, I see it now. Thank you. I will post in the relay based on origin thread for question. Mar 3, 2015 at 21:41
  • but cannot post my solution here because someone closed the thread so good luck --> you can post the answer in the duplicated question. The fundamental goal of closing duplicate questions is to help people find the right answer by getting all of those answers in one place.
    – masegaloeh
    Mar 6, 2015 at 2:19

1 Answer 1

-1

If I'm understanding your question, I think your answer lies here: rewrite-recipient-of-all-except-one-recipient-outgoing-e-mail. It shows how to route based on recipient and has many references for postfix maps.

This question asked of routing based on IP. The responder tells it's not possible. The first is the most likely solution to the problem, I think.

0

Not the answer you're looking for? Browse other questions tagged .