Skip to main content

A Python script that processes DMARC reports from a mailbox and gives a basic summary.

Project description

simple-dmarc-parser

simple-dmarc-parser is a basic Python script that reads the contents of an IMAP mailbox, seeks out DMARC RUA reports, downloads and parses them in aggregate to provide a basic summary of passes and failures.

Function

The script will print any DMARC reports which had a failed result, so that you can review them. A summary will also be printed at the end by default, which shows how many reports had a pass/fail result from each provider, how many pass/fail results were found for each IP address, and how many pass/fail results were found for each domain.

The summary can be disabled if you only want to see failures. See the usage section for appropriate options.

Installation

It's recommended that you install simple-dmarc-parser via pip so that it is available on the system:

pip install simple-dmarc-parser

Usage

The script reads all unread messages in the mailbox provided, so you should only use this with a dedicated DMARC RUA address. simple-dmarc-parser does not process RUF reports.

simple-dmarc-parser accepts command line arguments, a config file, or it can prompt you for the IMAP server information.

Run simple-dmarc-parser -h for command line argument options. Or, just run simple-dmarc-parser and you will be prompted for the appropriate information. Your password will not be shown as you enter it.

A config file option is recommended for any sort of automation so that your credentials aren't potentially exposed in process lists. See the example config file, place it in an appropriate location with sensible permissions, and run using simple-dmarc-parser --config /path/to/config

Use the delete messages option with caution. Messages deleted with this option are not put in a deleted folder. They are immediately removed from the IMAP server with no option for recovery.

Automatic Reports

You can use cron to run simple-dmarc-parser regularly and send you its output via email, or whatever source you can send to via the command line.

For example, the following cron entry running on your mail server will result in nightly DMARC summaries being sent by cron to the user running the job:

0 0 * * * simple-dmarc-parser --config /path/to/config

If you prefer a version that only notifies you on errors, you can use this example script. Make sure you have mailutils installed, put the script in root's home directory, and install the following cronjob as root:

0 0 * * * /root/dmarc_report.sh

The script assumes your configuration is in /etc/simple-dmarc-parser.conf (make sure silent is true), and it will send its report to the root user on the local system. If you wish to send to send the reports off-system, change "root" to a full email address.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-dmarc-parser-1.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_dmarc_parser-1.0.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file simple-dmarc-parser-1.0.1.tar.gz.

File metadata

  • Download URL: simple-dmarc-parser-1.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.0 Windows/10

File hashes

Hashes for simple-dmarc-parser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0584ac38e287334bac7059ad0c6c23b2adad06c1eee8bf6b6c105efb267e6447
MD5 693d636c342e00698a11ef31671a423f
BLAKE2b-256 d0fce4a45f10bdb76fcbab86c367d642949bf0980427a5c04ed5c6d4c54d0e6d

See more details on using hashes here.

File details

Details for the file simple_dmarc_parser-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_dmarc_parser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1185ae85d6e4417be2aba76a8e79bfdb68e48bbeee200dfe418b4a84d128ed2d
MD5 130f6046f8c15178df91939af3d84295
BLAKE2b-256 e4b199d0408b461d71877d803c13ab9e2ce1639ca965faccf0f94b06244d3dde

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page