OpenDMARK Report (Ubuntu 18.04): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→Script) |
(→Links) |
||
Zeile 120: | Zeile 120: | ||
sudo chown opendmarc:opendmarc /usr/local/bin/create_opendmarc_report.sh | sudo chown opendmarc:opendmarc /usr/local/bin/create_opendmarc_report.sh | ||
sudo chmod 750 /usr/local/bin/create_opendmarc_report.sh | sudo chmod 750 /usr/local/bin/create_opendmarc_report.sh | ||
</pre> | |||
== Cron-Jobs == | |||
<pre> | |||
# dmarc | |||
0 */2 * * * /root/scripts/dmarc.sh import | |||
15 0 * * * /root/scripts/dmarc.sh report | |||
0 1 * * * /root/scripts/dmarc.sh expire | |||
</pre> | </pre> | ||
Version vom 29. März 2020, 18:04 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
sudo chown opendmarc:opendmarc /usr/local/bin/create_opendmarc_report.sh sudo chmod 750 /usr/local/bin/create_opendmarc_report.sh
Cron-Jobs
# dmarc 0 */2 * * * /root/scripts/dmarc.sh import 15 0 * * * /root/scripts/dmarc.sh report 0 1 * * * /root/scripts/dmarc.sh expire
Links
https://blog.schaal-24.de/mail/dmarc-reports-erstellen/
Zurück zu OpenDMARK