OpenDMARK Report (Ubuntu 18.04): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→Script) |
|||
Zeile 90: | Zeile 90: | ||
REPORT_EMAIL=dmarc-report@kirner.or.at | REPORT_EMAIL=dmarc-report@kirner.or.at | ||
REPORT_DIR=/ | REPORT_DIR=/var/spool/opendmarc/reports/ | ||
export OPENDMARC_DBHOST= | export OPENDMARC_DBHOST=10.0.0.156 # default localhost | ||
export OPENDMARC_DB=opendmarc # default opendmarc | export OPENDMARC_DB=opendmarc # default opendmarc | ||
export OPENDMARC_PASSWORD= | export OPENDMARC_PASSWORD=<password> # default opendmarc | ||
export OPENDMARC_USER=opendmarc # default opendmarc | export OPENDMARC_USER=opendmarc # default opendmarc | ||
Version vom 29. März 2020, 17:18 Uhr
Noch in Bearbeitung
Voraussetzungen
OpenDMARK muss bereits installiert sein.
Konfiguration
Datei für Roh-Daten
Die Datei
sudo vi /etc/opendmarc.conf
bearbeiten und am Ende folgenden Parameter hinzufügen:
## HistoryFile path ## default (none) ## ## If set, specifies the location of a text file to which records are written ## that can be used to generate DMARC aggregate reports. Records are groups ## of rows containing information about a single received message, and ## include all relevant information needed to generate a DMARC aggregate ## report. It is expected that this will not be used in its raw form, but ## rather periodically imported into a relational database from which the ## aggregate reports can be extracted by a tool such as opendmarc-import(8). HistoryFile /var/spool/opendmarc/opendmarc.dat
Danach das Verzeichnis dafür (+ für Reports) erstellen:
sudo mkdir -p /var/spool/opendmarc/reports sudo chown -R opendmarc:opendmarc /var/spool/opendmarc/ sudo chmod -R 775 /var/spool/opendmarc/
Zum Abschluss den Service wieder neustarten:
sudo systemctl restart opendmarc.service
Datenbank
Da bei mit die Datei /usr/share/doc/opendmarc/schema.mysql
gefehlt hat, musste ich sie erst von https://sources.debian.org/src/opendmarc/1.3.2-7/db/ runterladen (mittels opendmarc -V
die Versin prüfen):
cd /usr/share/doc/opendmarc/ sudo wget https://sources.debian.org/data/main/o/opendmarc/1.3.2-7/db/schema.mysql sudo wget https://sources.debian.org/data/main/o/opendmarc/1.3.2-7/db/update-db-schema.mysql
Danach die herunter geladenen SQL-Patches anpassen:
cd ~/temp cp /usr/share/doc/opendmarc/schema.mysql . vi schema.mysql
Am Ende die 2 Zeilen für den Benutzer anpassen:
CREATE USER 'opendmarc'@'%' IDENTIFIED BY '<password>'; GRANT ALL ON opendmarc.* to 'opendmarc'@'%';
Die angepasste Datei mittels folgenden Befehl ausführen:
mysql -u root -p < schema.mysql
Script
sudo vi /usr/local/bin/create_opendmarc_report.sh
#!/bin/bash # Script to create DMARC reports DAT_FILE=/var/spool/opendmarc/opendmarc.dat REPORT_EMAIL=dmarc-report@kirner.or.at REPORT_DIR=/var/spool/opendmarc/reports/ export OPENDMARC_DBHOST=10.0.0.156 # default localhost export OPENDMARC_DB=opendmarc # default opendmarc export OPENDMARC_PASSWORD=<password> # default opendmarc export OPENDMARC_USER=opendmarc # default opendmarc case $1 in import) if [ -e $DAT_FILE ]; then /usr/sbin/opendmarc-import < $DAT_FILE &> /dev/null fi ;; report) if [ ! -d "$REPORT_DIR" ]; then mkdir -p $REPORT_DIR; fi cd $REPORT_DIR /usr/sbin/opendmarc-reports --day --keepfiles --verbose --report-email $REPORT_EMAIL ;; expire) /usr/sbin/opendmarc-expire --expire=90 ;; *) echo use "import", "report" or "expire" ;; esac
Links
https://blog.schaal-24.de/mail/dmarc-reports-erstellen/
Zurück zu OpenDMARK