Pré-requis:
- Postfix
- Dovecot
- OpenDKIM,
- OpenDMARC,
- Apache 2.4,
- PHP 8.4 FPM,
- Python 3.13.5.
- PostgreSQL
- doivent être fonctionnel
| CREATE ROLE parsedmarc LOGIN PASSWORD 'MOT_DE_PASSE_PG'; CREATE DATABASE parsedmarc OWNER parsedmarc; CREATE ROLE dmarcweb LOGIN PASSWORD 'MOT_DE_PASSE_WEB'; GRANT CONNECT ON DATABASE parsedmarc TO dmarcweb; GRANT USAGE ON SCHEMA public TO dmarcweb; GRANT SELECT ON ALL TABLES IN SCHEMA public TO dmarcweb; ALTER DEFAULT PRIVILEGES FOR ROLE parsedmarc IN SCHEMA public GRANT SELECT ON TABLES TO dmarcweb; |
| useradd --system --create-home --home-dir /opt/parsedmarc --shell /usr/sbin/nologin parsedmarc python3 -m venv /opt/parsedmarc/venv /opt/parsedmarc/venv/bin/pip install --upgrade pip /opt/parsedmarc/venv/bin/pip install parsedmarc chown -R parsedmarc:parsedmarc /opt/parsedmarc |
/opt/parsedmarc/venv/bin/parsedmarc. Le cache de la base IP est /opt/parsedmarc/.cache/parsedmarc.|
[general] [mailbox] [imap] [postgresql] |
| chown root:parsedmarc /etc/parsedmarc/parsedmarc.ini chmod 640 /etc/parsedmarc/parsedmarc.ini |
|
[Unit] [Service] |
Environment=HOME=/opt/parsedmarc est nécessaire : le cache de la base IP est cherché sous ~/.cache/parsedmarc.)|
[Unit] [Timer] [Install] |
| systemctl daemon-reload systemctl enable --now parsedmarc.timer |
| apt install -y apt-transport-https gnupg curl mkdir -p /etc/apt/keyrings curl -fsSL https://apt.grafana.com/gpg.key | gpg --dearmor -o /etc/apt/keyrings/grafana.gpg echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" > /etc/apt/sources.list.d/grafana.list apt update apt install -y grafana systemctl enable --now grafana-server |
| [server] http_addr = 127.0.0.1 http_port = 3000 domain = votre-domaine.tld root_url = https://votre-domaine.tld/ |
|
apiVersion: 1 datasources: |
| curl -L -o /root/dmarc-pg.json \ https://raw.githubusercontent.com/domainaware/parsedmarc/master/dashboards/grafana/Grafana-DMARC_Reports-PostgreSQL.json mkdir -p /var/lib/grafana/dashboards sed 's/${DS_POSTGRESQL}/parsedmarc-pg/g' /root/dmarc-pg.json > /var/lib/grafana/dashboards/dmarc-pg.json chown -R grafana:grafana /var/lib/grafana/dashboards |
| apiVersion: 1 providers: - name: parsedmarc orgId: 1 folder: DMARC type: file updateIntervalSeconds: 30 options: path: /var/lib/grafana/dashboards |
| systemctl restart grafana-server |
| grafana cli admin reset-admin-password 'NOUVEAU_MOT_DE_PASSE' systemctl restart grafana-server |
| a2enmod proxy proxy_http |
|
<VirtualHost *:443>
ServerName <votre_sous-domaine.tld> SSLEngine on
SSLCertificateFile <votre_certificat_au_format_pem> SSLCertificateKeyFile <votre_cle_privé> SSLCertificateChainFile <votre_certificat_intermédiaire> SSLUseStapling on Protocols h2 http/1.1 ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/ ErrorLog ${APACHE_LOG_DIR}/<votre_vhost>error.log
CustomLog ${APACHE_LOG_DIR}/<votre_vhost>-access.log combined </VirtualHost> |
| a2ensite rapport-dmarc apache2ctl configtest && systemctl reload apache2 |