Skip to content

Instantly share code, notes, and snippets.

@alinradut
Last active April 11, 2019 08:16
Show Gist options
  • Save alinradut/f9f073e73e65ce6259ba326d69d08d26 to your computer and use it in GitHub Desktop.
Save alinradut/f9f073e73e65ce6259ba326d69d08d26 to your computer and use it in GitHub Desktop.
Setting up dmarc reports for a domain on Ubuntu

Create a user/database combo in MySQL, username dmarc, password [generated]

Install the dependencies:

apt-get install libmail-imapclient-perl libmime-tools-perl libxml-simple-perl \
libclass-dbi-mysql-perl libio-socket-inet6-perl libio-socket-ip-perl libperlio-gzip-perl \
libmail-mbox-messageparser-perl unzip

Download and install dmarcts-report-parser to /opt:

cd /opt
git clone https://github.com/techsneeze/dmarcts-report-parser
cd dmarcts-report-parser

Rename dmarcts-report-parser.conf.sample:

mv dmarcts-report-parser.conf.sample dmarcts-report-parser.conf

Edit dmarcts-report-parser.conf and set the MySQL username and password, ignore IMAP:

nano dmarcts-report-parser.conf

Test if this works correctly:

/opt/dmarcts-report-parser/dmarcts-report-parser.pl -d -e /var/vmail/[domain]/[user]/Maildir/cur/*

Set up crontab, once per hour:

crontab -e 
# check both cur and new folders
0 * * * * /opt/dmarcts-report-parser/dmarcts-report-parser.pl -e /var/vmail/[domain]/[user]/Maildir/cur/* >/dev/null 2>&1
0 * * * * /opt/dmarcts-report-parser/dmarcts-report-parser.pl -e /var/vmail/[domain]/[user]/Maildir/new/* >/dev/null 2>&1

Download the viewer:

cd /var/www/[domain]/public_html
git clone https://github.com/techsneeze/dmarcts-report-viewer.git
cd dmarcts-report-viewer

Rename the configuration file:

mv dmarcts-report-viewer-config.php.sample dmarcts-report-viewer-config.php

Edit dmarcts-report-parser.conf and set the MySQL username and password, ignore IMAP:

nano dmarcts-report-parser.conf

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment