Re: Harvest netblocks of good MTAs from SPF for whitelisting from greylisting

Stuart D Gathman <[email protected]> Tue, 12 Feb 2013 23:10:07 -0500 (EST)
Newsgroups gmane.mail.spam.spf.discuss
Message-ID <[email protected]>
On Feb 12, Stuart D Gathman transmitted in part:

>> Where has it been implemented?  Please provide me a link, I'm very
>> interested in applying it to my setup.
>
> I did a quick and dirty for pyspf (just add ips to a set while evaluating):
>
> http://spidey2.bmsi.com/pyspf/spf.py
>
> $ python spf.py 0.0.0.0 [email protected] google.com
> (('softfail', 250, 'domain owner discourages use of this host'), '~all')
> 216.239.32.0/19
> 64.233.160.0/19
> 66.249.80.0/20
> 72.14.192.0/18
> 209.85.128.0/17
> 66.102.0.0/20
> 74.125.0.0/16
> 64.18.0.0/20
> 207.126.144.0/20
> 173.194.0.0/16
> 216.73.93.70/31
> 216.73.93.72/31
>
> This needs to ensure that all paths are followed, and combine adjacent
> blocks (e.g. the last two above).  It also needs to handle IP6.

Hmm, using 0.0.0.0 to "never match" is a good hack, but fails with
fancy includes - so I'll need to handle those.

It needs to keep 4 separate ipsets for Pass, Fail, SoftFail, and Neutral.
I'll make a separate method for computing ipsets.