Skip to content

Instantly share code, notes, and snippets.

@alinradut
Last active April 11, 2019 08:16
Show Gist options
  • Select an option

  • Save alinradut/f9f073e73e65ce6259ba326d69d08d26 to your computer and use it in GitHub Desktop.

Select an option

Save alinradut/f9f073e73e65ce6259ba326d69d08d26 to your computer and use it in GitHub Desktop.

Revisions

  1. alinradut revised this gist Apr 11, 2019. 1 changed file with 18 additions and 0 deletions.
    18 changes: 18 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,47 +2,65 @@ 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.
  2. alinradut renamed this gist Apr 11, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. alinradut created this gist Apr 3, 2019.
    48 changes: 48 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    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.