All Projects → cetanu → sender_policy_flattener

cetanu / sender_policy_flattener

Licence: MIT license
Compact large SPF chains into flat blocks of IP addresses

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sender policy flattener

spf
Parse SPF record and determine if client IP is allowed to send email.
Stars: ✭ 28 (+12%)
Mutual labels:  spf, sender-policy-framework, spf-record
checkdmarc
A parser for SPF and DMARC DNS records
Stars: ✭ 124 (+396%)
Mutual labels:  dns, email, spf
smf-spf
It's a lightweight, fast and reliable Sendmail milter that implements the Sender Policy Framework
Stars: ✭ 12 (-52%)
Mutual labels:  email, spf
mailauth
Command line utility and a Node.js library for email authentication
Stars: ✭ 57 (+128%)
Mutual labels:  email, spf
email-checker
Provides email verification on the go.
Stars: ✭ 116 (+364%)
Mutual labels:  dns, email
Dank Selfhosted
Automated solution for hosting email, web, DNS, XMPP, and ZNC on OpenBSD.
Stars: ✭ 800 (+3100%)
Mutual labels:  dns, email
Dart Basic Utils
A dart package for many helper methods fitting common situations
Stars: ✭ 153 (+512%)
Mutual labels:  dns, email
xip.name
Simple wildcard DNS inspired by xip.io
Stars: ✭ 143 (+472%)
Mutual labels:  dns
puppeteer-email
Email automation driven by headless chrome.
Stars: ✭ 135 (+440%)
Mutual labels:  email
dnstwister
Domain name permutation as a service
Stars: ✭ 46 (+84%)
Mutual labels:  dns
Smart-Mass-Mailer
Smart Bulk Email Sender with Mail Merge, Delay between Emails and HTML Content
Stars: ✭ 51 (+104%)
Mutual labels:  email
dnsping
DNS Ping: to check packet loss and latency issues with DNS servers
Stars: ✭ 55 (+120%)
Mutual labels:  dns
noc
Official read only mirror for
Stars: ✭ 84 (+236%)
Mutual labels:  dns
twitter-digest
✉️ A netlify lambda function that emails you tweets from a twitter list.
Stars: ✭ 14 (-44%)
Mutual labels:  email
SpamgourmetReloaded
SpamgourmetReloaded is a remake of the original spamgourmet.com service - made in Kotlin. The project includes a mailserver and a webinterface.
Stars: ✭ 18 (-28%)
Mutual labels:  email
Tweetstorm
🐦 Twitter UserStream APIの簡単な代替実装 / A simple substitute implementation for the Twitter UserStream
Stars: ✭ 55 (+120%)
Mutual labels:  dns
DANE-for-SMTP
'DANE for SMTP' wiki
Stars: ✭ 28 (+12%)
Mutual labels:  email
DnsTube
Access your computer from anywhere. DnsTube is a Windows .NET dynamic DNS client for Cloudflare.
Stars: ✭ 137 (+448%)
Mutual labels:  dns
bulk-email-sender
Send Templatized Dynamic Emails Automatically
Stars: ✭ 30 (+20%)
Mutual labels:  email
DnsServerDsc
This module contains DSC resources for the management and configuration of Windows Server DNS Server.
Stars: ✭ 51 (+104%)
Mutual labels:  dns

sender policy flattener

We had a problem in our organisation that caused our SPF records to become invalid:

When customers computers were querying our SPF records, there were more than 10 lookups required after following all of the include: remarks.

Solution? Query them ourselves, and create a much more condense list of SPF records.

But wait... What if the downstream records change?

Part of what the script does is that it creates a JSON file that keeps track of the last list of IP Addresses that your combination of SPF records had.

When the hashsum of your IP Addresses changes, it will send out an email (or just dump HTML if it can't find an email server) with a handy diff & BIND format for viewing what has changed, and promptly updating it.

You could theoretically extract the flat IP records from the resulting JSON file and automatically update your DNS configuration with it.

Installation

via git clone

Clone this repo and run

pip install poetry
poetry install

via pip

pip install sender_policy_flattener

Usage

usage: spflat [-h] [-c CONFIG] [-r RESOLVERS] [-e MAILSERVER] [-t TOADDR]
              [-f FROMADDR] [-s SUBJECT] [-D SENDING_DOMAIN] [-d DOMAINS]
              [-o OUTPUT]

A script that crawls and compacts SPF records into IP networks. This helps to
avoid exceeding the DNS lookup limit of the Sender Policy Framework (SPF)
https://tools.ietf.org/html/rfc7208#section-4.6.4

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Name/path of JSON configuration file
  -r RESOLVERS, --resolvers RESOLVERS
                        Comma separated DNS servers to be used
  -e MAILSERVER, -mailserver MAILSERVER
                        Server to use for mailing alerts
  -t TOADDR, -to TOADDR
                        Recipient address for email alert
  -f FROMADDR, -from FROMADDR
                        Sending address for email alert
  -s SUBJECT, -subject SUBJECT
                        Subject string, must contain {zone}
  -D SENDING_DOMAIN, --sending-domain SENDING_DOMAIN
                        The domain which emails are being sent from
  -d DOMAINS, --domains DOMAINS
                        Comma separated domain:rrtype to flatten to IP
                        addresses. Imagine these are your SPF include
                        statements.
  -o OUTPUT, --output OUTPUT
                        Name/path of output file

Example

spflat --resolvers 8.8.8.8,8.8.4.4 \
    --to [email protected] \
    --from [email protected] \
    --subject 'SPF for {zone} has changed!' \
    --domains gmail.com:txt,sendgrid.com:txt,yahoo.com:a \
    --sending-domain mydomain.com

or

spflat --config spf.json

You can specify a config file, or you can specify all of the optional arguments from the command line.

I've provided a settings.json file with an example configuration file.

Supported Python versions

See the latest result of the build: https://github.com/cetanu/sender_policy_flattener/actions

3rd party dependencies

  • netaddr
  • dnspython

Example email format

example screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].