tierpod / dmarc-report-converter

Convert dmarc reports from xml to human-readable formats
MIT License
237 stars 25 forks source link
dkim dmarc dmarc-reports golang html imap spf xml

dmarc-report-converter

Convert DMARC report files from xml to human-readable formats. Files can be located on a local filesystem or on an IMAP server.

Example of html_static output: html

Support input formats:

Support output formats:

Installation

  1. Get installation archive. There are two ways: download pre-built archive from github releases page or build from sources

  2. Unpack to destination directory, for example to "/opt":

    sudo tar -xvf dmarc-report-converter*.tar.gz -C /opt
  3. Copy example config file and edit:

    cd /opt/dmarc-report-converter/
    sudo cp config.dist.yaml config.yaml
    sudo nano config.yaml
  4. If you want to use "html" output, you have to configure your web server to serve assets directory and change assets_path in configuration file. Example for nginx:

    sudo cp -r assets /usr/share/nginx/html

    config.yaml:

    output:
     assets_path: "/dmarc/assets"

    location configuration:

    location /dmarc/ {
       root /usr/share/nginx/html;
       autoindex           on;
       autoindex_localtime on;
    }

    and go to the http://your-web-server/dmarc

docker compose

There is a Docker Compose wrapper created by @nielsbom (thanks!):

https://github.com/nielsbom/dmarc_report_viewer

Nix

There is a Nix package dmarc-report-converter created by @Nebucatnetzer (thanks!):

Configuration

Copy config/config.dist.yaml to config.yaml and change parameters:

input section:

output section:

Templates

External templates can reference to dmarc.Report struct as . (dot, see consts.go for example).

Additional functions can be used:

Daily reports

If you want to convert reports daily:

Weekly or monthly reports

Many providers send reports to your email address every day. If you want to make weekly or monthly reports:

Building from sources

  1. Install go compiler and building tools:

    # debian/ubuntu
    sudo apt-get install golang-go make git tar
    
    # centos/fedora, enable epel-release repo first
    sudo yum install epel-release
    sudo yum install golang make git tar

    or follow official instruction

  2. Download sources:

    git clone https://github.com/tierpod/dmarc-report-converter.git
  3. Build binary and create installation archive:

    cd dmarc-report-converter
    make release
  4. Installation archive will be places inside dist directory. Also, if you want to test dmarc-report-converter without installation, you can execute:

    ./bin/dmarc-report-converter -config /path/to/config.yaml

Thanks

And we have a lot of contributors!