There's probably an answer to this already, but I just can't figure out how to search for it correctly.
We have a failover situation for two nodes, using
keepalived, passing a floating IP between them. The main purpose of the nodes is to run
haproxy. Each node also runs a local
postfix that is solely used to deliver email from
keepalived or from
haproxy, to an actual operator account, relaying through SendGrid to an external mail domain, as it happens. No mail is accepted from any other machine.
All this is working well. Too well; my mailbox is flooded. I would like to suppress mail from the non-active node, and when failover happens, make postfix suddenly start delivering mail.
So here's the idea.
- normal mode: postfix accepts mail on port 25 and relays through Sendgrid.
- silent mode: postfix still accepts mail on port 25, but it drops it on the floor, not relaying it anywhere, not returning failure to the client, not sending a bounce. (Yes, this is terrible behavior for an MTA normally. MTAs shouldn't lie about accepting mail. But this is a restricted situation.)
- How to tell whether I should be in normal or silent mode: a simple script, probably something like
ip addr | grep -q $FLOAT_IP.
So ... I guess the basic question is how does "silent mode" happen. Is it a totally separate postfix config, and I have to restart postfix with the right config?
Would it be better to set up an After-Queue Content Filter?
Is there some other idea?