On Saturday, July 21, 2018 02:30:36 PM Phil Stracchino wrote: > I am running Postfix with opendkim, rspamd, pypolicyd-spf, and DMARC. > This is working fine for mail delivered directly to my domain. However, > if my net connection goes down and mail gets queued by my backup MX at > another domain (which I do not control), then when my connection comes > back up and the MX relay attempts to redeliver all the queued mail, > delivery fails due to SPF failures like this one, because the sender's > domain has not authorized my mail relay to send mail on its behalf. Of > course, I didn't *find out* about this problem until our uplink went > down for two and a half days. > > > Remote host said: 550 5.7.23 <[email protected]>: Recipient address > rejected: Message rejected due to: SPF fail - not authorized. Please see > +http://www.openspf.net/Why?s=mfrom;[email protected];ip=96.53.88.246; > r=<UNKNOWN> > > > The failure is of course (in hindsight) because *our* backup MX relay is > not SPF-authorized by the *sender's* domain to send mail on behalf of > that domain, therefore it fails *my* SPF check and is rejected. I've > added the MX relay to pypolicyd's HELO whitelist, but so far this does > not seem to be solving the problem. > > Can anyone advise how I should best fix this?
Only check SPF at the external border of your email architecture. The relay from your backup MX is an internal relay. SPF checks from that host should be skipped. If you look at the documentation provided with pypolicyd-spf, particularly man (5) policyd-spf.conf, you'll see there are multiple options available for doing this. As an example (all see https://git.launchpad.net/~kitterman/pypolicyd-spf/tree/policyd-spf.conf.commented ) this might work given the data you provided: HELO_Whitelist = fritter.limelight.ca
