|
@@ -9,11 +9,11 @@ Nous allons maintenant ajouter un enregistrement **spf** à notre configuration.
|
|
|
|
|
|
La syntaxe de la ligne à ajouter est assez simple. Il existe des générateurs de ligne SPF, comme:
|
|
|
|
|
|
- * [spfwizard](https://www.spfwizard.net/)
|
|
|
+* [spfwizard](https://www.spfwizard.net/)
|
|
|
|
|
|
ou
|
|
|
|
|
|
-* [mxtoolbox](https://mxtoolbox.com/SPFRecordGenerator.aspx).
|
|
|
+* [mxtoolbox](https://mxtoolbox.com/SPFRecordGenerator.aspx).
|
|
|
|
|
|
Le site [openspf](http://www.openspf.org/) contient tout ce qu'il faut savoir à propos de SPF, syntaxe, paramètres etc ...
|
|
|
|
|
@@ -21,90 +21,79 @@ Pour mon serveur, j'ai choisi une politique stricte de rejet des mails qui ne vi
|
|
|
|
|
|
Voici la ligne à rajouter au fichier de zone. C'est le paramètre "-all" qui détermine la politique (de rejet ici). Nous aurions pu mettre **~all** pour une politique moins stricte. (notez le **~** à la place du **-**)
|
|
|
|
|
|
-```shell
|
|
|
-; spf
|
|
|
-yojik.net. IN TXT "v=spf1 a mx mx:adara.yojik.net a:adara.yojik.net -all"
|
|
|
-yojik.net. IN SPF "v=spf1 a mx mx:adara.yojik.net a:adara.yojik.net -all"
|
|
|
-```
|
|
|
+ ; spf
|
|
|
+ yojik.net. IN TXT "v=spf1 a mx mx:adara.yojik.net a:adara.yojik.net -all"
|
|
|
+ yojik.net. IN SPF "v=spf1 a mx mx:adara.yojik.net a:adara.yojik.net -all"
|
|
|
|
|
|
On recharge bind pour la prise en compte des modifications:
|
|
|
|
|
|
-```shell
|
|
|
-service bind9 restart
|
|
|
-```
|
|
|
+ service bind9 restart
|
|
|
|
|
|
Il nous reste à configurer postfix pour prendre en compte cet enregistrement et effectuer les validations.
|
|
|
|
|
|
### Installation des logiciels nécessaires
|
|
|
|
|
|
-```shell
|
|
|
-root@atom:/etc/bind# apt-get install postfix-policyd-spf-python
|
|
|
-Lecture des listes de paquets... Fait
|
|
|
-Construction de l'arbre des dépendances
|
|
|
-Lecture des informations d'état... Fait
|
|
|
-The following additional packages will be installed:
|
|
|
- python3-authres python3-dns python3-spf
|
|
|
-Paquets suggérés :
|
|
|
- python3-yaml
|
|
|
-Les NOUVEAUX paquets suivants seront installés :
|
|
|
- postfix-policyd-spf-python python3-authres python3-dns python3-spf
|
|
|
-0 mis à jour, 4 nouvellement installés, 0 à enlever et 12 non mis à jour.
|
|
|
-Il est nécessaire de prendre 153 ko dans les archives.
|
|
|
-Après cette opération, 494 ko d'espace disque supplémentaires seront utilisés.
|
|
|
-Souhaitez-vous continuer ? [O/n] o
|
|
|
-Réception de:1 http://deb.debian.org/debian stretch/main amd64 python3-dns all 3.1.1-1 [27,5 kB]
|
|
|
-Réception de:2 http://deb.debian.org/debian stretch/main amd64 python3-authres all 0.900-1 [17,5 kB]
|
|
|
-Réception de:3 http://deb.debian.org/debian stretch/main amd64 python3-spf all 2.0.12t-3 [64,1 kB]
|
|
|
-Réception de:4 http://deb.debian.org/debian stretch/main amd64 postfix-policyd-spf-python all 2.0.1-1 [43,8 kB]
|
|
|
-153 ko réceptionnés en 0s (1 533 ko/s)
|
|
|
-Sélection du paquet python3-dns précédemment désélectionné.
|
|
|
-(Lecture de la base de données... 40435 fichiers et répertoires déjà installés.)
|
|
|
-Préparation du dépaquetage de .../python3-dns_3.1.1-1_all.deb ...
|
|
|
-Dépaquetage de python3-dns (3.1.1-1) ...
|
|
|
-Sélection du paquet python3-authres précédemment désélectionné.
|
|
|
-Préparation du dépaquetage de .../python3-authres_0.900-1_all.deb ...
|
|
|
-Dépaquetage de python3-authres (0.900-1) ...
|
|
|
-Sélection du paquet python3-spf précédemment désélectionné.
|
|
|
-Préparation du dépaquetage de .../python3-spf_2.0.12t-3_all.deb ...
|
|
|
-Dépaquetage de python3-spf (2.0.12t-3) ...
|
|
|
-Sélection du paquet postfix-policyd-spf-python précédemment désélectionné.
|
|
|
-Préparation du dépaquetage de .../postfix-policyd-spf-python_2.0.1-1_all.deb ...
|
|
|
-Dépaquetage de postfix-policyd-spf-python (2.0.1-1) ...
|
|
|
-Paramétrage de python3-authres (0.900-1) ...
|
|
|
-Paramétrage de python3-dns (3.1.1-1) ...
|
|
|
-Traitement des actions différées (« triggers ») pour man-db (2.7.6.1-2) ...
|
|
|
-Paramétrage de python3-spf (2.0.12t-3) ...
|
|
|
-Paramétrage de postfix-policyd-spf-python (2.0.1-1) ...
|
|
|
-root@atom:/etc/bind#
|
|
|
-```
|
|
|
+ root@atom:/etc/bind# apt-get install postfix-policyd-spf-python
|
|
|
+ Lecture des listes de paquets... Fait
|
|
|
+ Construction de l'arbre des dépendances
|
|
|
+ Lecture des informations d'état... Fait
|
|
|
+ The following additional packages will be installed:
|
|
|
+ python3-authres python3-dns python3-spf
|
|
|
+ Paquets suggérés :
|
|
|
+ python3-yaml
|
|
|
+ Les NOUVEAUX paquets suivants seront installés :
|
|
|
+ postfix-policyd-spf-python python3-authres python3-dns python3-spf
|
|
|
+ 0 mis à jour, 4 nouvellement installés, 0 à enlever et 12 non mis à jour.
|
|
|
+ Il est nécessaire de prendre 153 ko dans les archives.
|
|
|
+ Après cette opération, 494 ko d'espace disque supplémentaires seront utilisés.
|
|
|
+ Souhaitez-vous continuer ? [O/n] o
|
|
|
+ Réception de:1 http://deb.debian.org/debian stretch/main amd64 python3-dns all 3.1.1-1 [27,5 kB]
|
|
|
+ Réception de:2 http://deb.debian.org/debian stretch/main amd64 python3-authres all 0.900-1 [17,5 kB]
|
|
|
+ Réception de:3 http://deb.debian.org/debian stretch/main amd64 python3-spf all 2.0.12t-3 [64,1 kB]
|
|
|
+ Réception de:4 http://deb.debian.org/debian stretch/main amd64 postfix-policyd-spf-python all 2.0.1-1 [43,8 kB]
|
|
|
+ 153 ko réceptionnés en 0s (1 533 ko/s)
|
|
|
+ Sélection du paquet python3-dns précédemment désélectionné.
|
|
|
+ (Lecture de la base de données... 40435 fichiers et répertoires déjà installés.)
|
|
|
+ Préparation du dépaquetage de .../python3-dns_3.1.1-1_all.deb ...
|
|
|
+ Dépaquetage de python3-dns (3.1.1-1) ...
|
|
|
+ Sélection du paquet python3-authres précédemment désélectionné.
|
|
|
+ Préparation du dépaquetage de .../python3-authres_0.900-1_all.deb ...
|
|
|
+ Dépaquetage de python3-authres (0.900-1) ...
|
|
|
+ Sélection du paquet python3-spf précédemment désélectionné.
|
|
|
+ Préparation du dépaquetage de .../python3-spf_2.0.12t-3_all.deb ...
|
|
|
+ Dépaquetage de python3-spf (2.0.12t-3) ...
|
|
|
+ Sélection du paquet postfix-policyd-spf-python précédemment désélectionné.
|
|
|
+ Préparation du dépaquetage de .../postfix-policyd-spf-python_2.0.1-1_all.deb ...
|
|
|
+ Dépaquetage de postfix-policyd-spf-python (2.0.1-1) ...
|
|
|
+ Paramétrage de python3-authres (0.900-1) ...
|
|
|
+ Paramétrage de python3-dns (3.1.1-1) ...
|
|
|
+ Traitement des actions différées (« triggers ») pour man-db (2.7.6.1-2) ...
|
|
|
+ Paramétrage de python3-spf (2.0.12t-3) ...
|
|
|
+ Paramétrage de postfix-policyd-spf-python (2.0.1-1) ...
|
|
|
+ root@atom:/etc/bind#
|
|
|
|
|
|
### Configuration de postfix: master.cf
|
|
|
|
|
|
Dans le fichier /etc/postfix/master.cf, il faut rajouter le service suivant:
|
|
|
|
|
|
-```shell
|
|
|
-policyd-spf unix - n n - 0 spawn
|
|
|
- user=policyd-spf argv=/usr/bin/policyd-spf
|
|
|
-```
|
|
|
+ policyd-spf unix - n n - 0 spawn
|
|
|
+ user=policyd-spf argv=/usr/bin/policyd-spf
|
|
|
+
|
|
|
### Configuration de postfix: main.cf
|
|
|
|
|
|
Il nous faut ajouter la règle correspondante dans la lsite des restrictions de main.cf. Bien afire attention de positionner **check_policy_service** APRÈS **reject_unauth_destination**, sinon, votre serveur mail devient **openrelay**!
|
|
|
|
|
|
-```shell
|
|
|
-smtpd_recipient_restrictions =
|
|
|
- ...
|
|
|
- reject_unauth_destination
|
|
|
- check_policy_service unix:private/policyd-spf
|
|
|
- ...
|
|
|
+ smtpd_recipient_restrictions =
|
|
|
+ ...
|
|
|
+ reject_unauth_destination
|
|
|
+ check_policy_service unix:private/policyd-spf
|
|
|
+ ...
|
|
|
|
|
|
-policyd-spf_time_limit = 3600
|
|
|
-```
|
|
|
+ policyd-spf_time_limit = 3600
|
|
|
|
|
|
Relancez **postfix**:
|
|
|
|
|
|
-```shell
|
|
|
-service postfix restart
|
|
|
-```
|
|
|
+ service postfix restart
|
|
|
|
|
|
### Test
|
|
|
|
|
@@ -118,50 +107,42 @@ Les tests ne fonctionnent pas ... en fait, cela vient de la config IPV6 du serve
|
|
|
|
|
|
La solution a été de configurer manuellement l'adresse IPV6 dans /etc/network/interfaces de la façon suivante:
|
|
|
|
|
|
-```shell
|
|
|
-iface enp2s0 inet6 static
|
|
|
-address 2a01:e0a:54:c220:3aea:a7ff:fea6:cf93
|
|
|
-netmask 64
|
|
|
-gateway 2a01:e0a:54:c220:OOOO:0000:000:0001
|
|
|
-```
|
|
|
+ iface enp2s0 inet6 static
|
|
|
+ address 2a01:e0a:54:c220:3aea:a7ff:fea6:cf93
|
|
|
+ netmask 64
|
|
|
+ gateway 2a01:e0a:54:c220:OOOO:0000:000:0001
|
|
|
|
|
|
On va aussi modifier la configuration de Postfix pour permettre l'envoi de messages de l'extérieur de la machine (uniquement les utilisateurs enregistrés, bien sûr).
|
|
|
|
|
|
J'ai modifié /etc/postfix/main.cf de la façon suivante: j'ai ajouté ceci au fichier:
|
|
|
|
|
|
-```shell
|
|
|
-smtpd_recipient_restrictions =
|
|
|
- permit_sasl_authenticated,
|
|
|
- permit_mynetworks,
|
|
|
- reject_unauth_destination,
|
|
|
- check_policy_service unix:private/policyd-spf
|
|
|
-```
|
|
|
+ smtpd_recipient_restrictions =
|
|
|
+ permit_sasl_authenticated,
|
|
|
+ permit_mynetworks,
|
|
|
+ reject_unauth_destination,
|
|
|
+ check_policy_service unix:private/policyd-spf
|
|
|
|
|
|
et commenté les lignes correspondantes dans la section submission et smtps du fichier /etc/postfix/master.cf:
|
|
|
|
|
|
-```shell
|
|
|
-# -o smtpd_sender_restrictions=$mua_sender_restrictions
|
|
|
-```
|
|
|
+ # -o smtpd_sender_restrictions=$mua_sender_restrictions
|
|
|
|
|
|
J'ai simplement transféré les restrictions **smtpd_sender_restrictions** qui étaient dans main.cf dans master.cf.
|
|
|
|
|
|
Après modifications, tout marche comme il faut, vérification SPF comprise.
|
|
|
|
|
|
-```shell
|
|
|
-root@atom:/home/ericadmin# tail -f /var/log/mail.log
|
|
|
-May 28 11:58:06 atom dovecot: imap-login: Login: user=<ericadmin>, method=PLAIN, rip=192.168.111.150, lip=192.168.111.240, mpid=1901, TLS, session=<I0V6J0FtWODAqG+W>
|
|
|
-May 28 11:58:26 atom postfix/smtpd[1902]: connect from adara.yojik.eu[91.121.72.10]
|
|
|
-May 28 11:58:26 atom policyd-spf[1907]: prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=91.121.72.10; helo=adara.yojik.eu; envelope-from=eric@yojik.eu; receiver=<UNKNOWN>
|
|
|
-May 28 11:58:26 atom postfix/smtpd[1902]: C701DD004F2: client=adara.yojik.eu[91.121.72.10]
|
|
|
-May 28 11:58:26 atom postfix/cleanup[1908]: C701DD004F2: message-id=<4c621385-3822-cb78-9c1d-7e9f43c3fc52@yojik.eu>
|
|
|
-May 28 11:58:26 atom postfix/qmgr[867]: C701DD004F2: from=<eric@yojik.eu>, size=1414, nrcpt=1 (queue active)
|
|
|
-May 28 11:58:26 atom postfix/smtpd[1902]: disconnect from adara.yojik.eu[91.121.72.10] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
|
|
|
-May 28 11:58:26 atom postfix/local[1909]: C701DD004F2: to=<ericadmin@yojik.net>, relay=local, delay=0.23, delays=0.21/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
|
|
|
-May 28 11:58:26 atom postfix/qmgr[867]: C701DD004F2: removed
|
|
|
-May 28 11:59:00 atom dovecot: imap-login: Login: user=<ericadmin>, method=PLAIN, rip=192.168.111.150, lip=192.168.111.240, mpid=1915, TLS, session=<FoqwKkFtduDAqG+W>
|
|
|
-```
|
|
|
-
|
|
|
-La ligne **May 28 11:43:12 atom policyd-spf[1830]: prepend Received-SPF: Pass (mailfrom) identity=mailfrom; ** montre que notre contrôle SPF fonctionne comme il faut.
|
|
|
+ root@atom:/home/ericadmin# tail -f /var/log/mail.log
|
|
|
+ May 28 11:58:06 atom dovecot: imap-login: Login: user=<ericadmin>, method=PLAIN, rip=192.168.111.150, lip=192.168.111.240, mpid=1901, TLS, session=<I0V6J0FtWODAqG+W>
|
|
|
+ May 28 11:58:26 atom postfix/smtpd[1902]: connect from adara.yojik.eu[91.121.72.10]
|
|
|
+ May 28 11:58:26 atom policyd-spf[1907]: prepend Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=91.121.72.10; helo=adara.yojik.eu; envelope-from=eric@yojik.eu; receiver=<UNKNOWN>
|
|
|
+ May 28 11:58:26 atom postfix/smtpd[1902]: C701DD004F2: client=adara.yojik.eu[91.121.72.10]
|
|
|
+ May 28 11:58:26 atom postfix/cleanup[1908]: C701DD004F2: message-id=<4c621385-3822-cb78-9c1d-7e9f43c3fc52@yojik.eu>
|
|
|
+ May 28 11:58:26 atom postfix/qmgr[867]: C701DD004F2: from=<eric@yojik.eu>, size=1414, nrcpt=1 (queue active)
|
|
|
+ May 28 11:58:26 atom postfix/smtpd[1902]: disconnect from adara.yojik.eu[91.121.72.10] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
|
|
|
+ May 28 11:58:26 atom postfix/local[1909]: C701DD004F2: to=<ericadmin@yojik.net>, relay=local, delay=0.23, delays=0.21/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
|
|
|
+ May 28 11:58:26 atom postfix/qmgr[867]: C701DD004F2: removed
|
|
|
+ May 28 11:59:00 atom dovecot: imap-login: Login: user=<ericadmin>, method=PLAIN, rip=192.168.111.150, lip=192.168.111.240, mpid=1915, TLS, session=<FoqwKkFtduDAqG+W>
|
|
|
+
|
|
|
+La ligne **May 28 11:43:12 atom policyd-spf[1830]: prepend Received-SPF:Pass (mailfrom) identity=mailfrom;** montre que notre contrôle SPF fonctionne comme il faut.
|
|
|
|
|
|
## DKIM
|
|
|
|
|
@@ -173,201 +154,182 @@ L'installation et la configuration de DKIM nécessite 3 étapes:
|
|
|
|
|
|
Nous commençons par l'installation de opendkim.
|
|
|
|
|
|
-```shell
|
|
|
-root@atom:/home/ericadmin# apt install opendkim
|
|
|
-Lecture des listes de paquets... Fait
|
|
|
-Construction de l'arbre des dépendances
|
|
|
-Lecture des informations d'état... Fait
|
|
|
-The following additional packages will be installed:
|
|
|
-dns-root-data liblua5.1-0 libmemcached11 libmemcachedutil2 libmilter1.0.1 libopendbx1 libopendbx1-sqlite3 libopendkim11 librbl1 libunbound2 libvbr2
|
|
|
-Paquets suggérés :
|
|
|
-... etc ...
|
|
|
-```
|
|
|
+ root@atom:/home/ericadmin# apt install opendkim
|
|
|
+ Lecture des listes de paquets... Fait
|
|
|
+ Construction de l'arbre des dépendances
|
|
|
+ Lecture des informations d'état... Fait
|
|
|
+ The following additional packages will be installed:
|
|
|
+ dns-root-data liblua5.1-0 libmemcached11 libmemcachedutil2 libmilter1.0.1 libopendbx1 libopendbx1-sqlite3 libopendkim11 librbl1 libunbound2 libvbr2
|
|
|
+ Paquets suggérés :
|
|
|
+ ... etc ...
|
|
|
|
|
|
Une fois installé, nous allons configurer opendkim: cela se fait dans le fichier /etc/opendkim.conf
|
|
|
|
|
|
Création des répertoires:
|
|
|
|
|
|
-```shell
|
|
|
-mkdir -p /etc/opendkim/keys/yojik.net/
|
|
|
-```
|
|
|
+ mkdir -p /etc/opendkim/keys/yojik.net/
|
|
|
|
|
|
Permissions:
|
|
|
|
|
|
-```shell
|
|
|
-chmod u=rw,go=r /etc/opendkim.conf
|
|
|
-chown -R opendkim:opendkim /etc/opendkim
|
|
|
-chmod go-rw /etc/opendkim/keys
|
|
|
-```
|
|
|
+ chmod u=rw,go=r /etc/opendkim.conf
|
|
|
+ chown -R opendkim:opendkim /etc/opendkim
|
|
|
+ chmod go-rw /etc/opendkim/keys
|
|
|
|
|
|
Un fichier opendkim.conf entièrement commenté est disponible dans:
|
|
|
|
|
|
-> /usr/share/doc/opendkim/examples
|
|
|
+ /usr/share/doc/opendkim/examples
|
|
|
|
|
|
Voici notre fichier de configuration; adaptez-le en fonction de votre domaine, bien sûr:
|
|
|
|
|
|
-```shell
|
|
|
-# This is a basic configuration that can easily be adapted to suit a standard
|
|
|
-# installation. For more advanced options, see opendkim.conf(5) and/or
|
|
|
-# /usr/share/doc/opendkim/examples/opendkim.conf.sample.
|
|
|
-
|
|
|
-# Log to syslog
|
|
|
-Syslog yes
|
|
|
-# Required to use local socket with MTAs that access the socket as a non-
|
|
|
-# privileged user (e.g. Postfix)
|
|
|
-## UMask 002
|
|
|
-
|
|
|
-# Sign for example.com with key in /etc/mail/dkim.key using
|
|
|
-# selector '2007' (e.g. 2007._domainkey.example.com)
|
|
|
-Domain yojik.net
|
|
|
-KeyFile /etc/opendkim/keys/yojik.net/yojik.private
|
|
|
-Selector yojik
|
|
|
-
|
|
|
-# Commonly-used options; the commented-out versions show the defaults.
|
|
|
-#Canonicalization simple
|
|
|
-#Mode sv
|
|
|
-#SubDomains no
|
|
|
-#ADSPAction continue
|
|
|
-
|
|
|
-# Always oversign From (sign using actual From and a null From to prevent
|
|
|
-# malicious signatures header fields (From and/or others) between the signer
|
|
|
-# and the verifier. From is oversigned by default in the Debian pacakge
|
|
|
-# because it is often the identity key used by reputation systems and thus
|
|
|
-# somewhat security sensitive.
|
|
|
-OversignHeaders From
|
|
|
-
|
|
|
-# List domains to use for RFC 6541 DKIM Authorized Third-Party Signatures
|
|
|
-# (ATPS) (experimental)
|
|
|
-
|
|
|
-#ATPSDomains example.com
|
|
|
-
|
|
|
-AutoRestart Yes
|
|
|
-AutoRestartRate 10/1h
|
|
|
-UMask 002
|
|
|
-Syslog yes
|
|
|
-SyslogSuccess Yes
|
|
|
-LogWhy Yes
|
|
|
-Canonicalization relaxed/simple
|
|
|
-
|
|
|
-ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
|
|
|
-InternalHosts refile:/etc/opendkim/TrustedHosts
|
|
|
-KeyTable refile:/etc/opendkim/KeyTable
|
|
|
-SigningTable refile:/etc/opendkim/SigningTable
|
|
|
-
|
|
|
-Mode sv
|
|
|
-PidFile /var/run/opendkim/opendkim.pid
|
|
|
-SignatureAlgorithm rsa-sha256
|
|
|
-
|
|
|
-UserID opendkim:opendkim
|
|
|
-
|
|
|
-Socket inet:12301@localhost
|
|
|
-```
|
|
|
+ # This is a basic configuration that can easily be adapted to suit a standard
|
|
|
+ # installation. For more advanced options, see opendkim.conf(5) and/or
|
|
|
+ # /usr/share/doc/opendkim/examples/opendkim.conf.sample.
|
|
|
+
|
|
|
+ # Log to syslog
|
|
|
+ Syslog yes
|
|
|
+ # Required to use local socket with MTAs that access the socket as a non-
|
|
|
+ # privileged user (e.g. Postfix)
|
|
|
+ ## UMask 002
|
|
|
+
|
|
|
+ # Sign for example.com with key in /etc/mail/dkim.key using
|
|
|
+ # selector '2007' (e.g. 2007._domainkey.example.com)
|
|
|
+ Domain yojik.net
|
|
|
+ KeyFile /etc/opendkim/keys/yojik.net/yojik.private
|
|
|
+ Selector yojik
|
|
|
+
|
|
|
+ # Commonly-used options; the commented-out versions show the defaults.
|
|
|
+ #Canonicalization simple
|
|
|
+ #Mode sv
|
|
|
+ #SubDomains no
|
|
|
+ #ADSPAction continue
|
|
|
+
|
|
|
+ # Always oversign From (sign using actual From and a null From to prevent
|
|
|
+ # malicious signatures header fields (From and/or others) between the signer
|
|
|
+ # and the verifier. From is oversigned by default in the Debian pacakge
|
|
|
+ # because it is often the identity key used by reputation systems and thus
|
|
|
+ # somewhat security sensitive.
|
|
|
+ OversignHeaders From
|
|
|
+
|
|
|
+ # List domains to use for RFC 6541 DKIM Authorized Third-Party Signatures
|
|
|
+ # (ATPS) (experimental)
|
|
|
+
|
|
|
+ #ATPSDomains example.com
|
|
|
+
|
|
|
+ AutoRestart Yes
|
|
|
+ AutoRestartRate 10/1h
|
|
|
+ UMask 002
|
|
|
+ Syslog yes
|
|
|
+ SyslogSuccess Yes
|
|
|
+ LogWhy Yes
|
|
|
+ Canonicalization relaxed/simple
|
|
|
+
|
|
|
+ ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
|
|
|
+ InternalHosts refile:/etc/opendkim/TrustedHosts
|
|
|
+ KeyTable refile:/etc/opendkim/KeyTable
|
|
|
+ SigningTable refile:/etc/opendkim/SigningTable
|
|
|
+
|
|
|
+ Mode sv
|
|
|
+ PidFile /var/run/opendkim/opendkim.pid
|
|
|
+ SignatureAlgorithm rsa-sha256
|
|
|
+
|
|
|
+ UserID opendkim:opendkim
|
|
|
+
|
|
|
+ Socket inet:12301@localhost
|
|
|
|
|
|
Postix accédera à opendkim à travers le port 12301.
|
|
|
|
|
|
Il nous reste 3 fichiers à configurer/créer, ainsi que générer les clefs privées et publiques.
|
|
|
|
|
|
- * /etc/opendkim/SigningTable
|
|
|
-
|
|
|
- Ce fichier ne contient qu'une seule ligne:
|
|
|
-
|
|
|
- > *@yojik.net yojik._domainkey.yojik.net
|
|
|
-
|
|
|
- * /etc/opendkim/KeyTable
|
|
|
+* /etc/opendkim/SigningTable
|
|
|
|
|
|
- Ce fichier ne contient qu'une seule ligne:
|
|
|
+ Ce fichier ne contient qu'une seule ligne:
|
|
|
|
|
|
- > yojik._domainkey.yojik.net yojik.net:yojik:/etc/opendkim/keys/yojik.net/yojik.private
|
|
|
+ `*@yojik.net yojik._domainkey.yojik.net`
|
|
|
|
|
|
- * /etc/opendkim/TrustedHosts
|
|
|
+* /etc/opendkim/KeyTable
|
|
|
|
|
|
- > 127.0.0.1
|
|
|
+ Ce fichier ne contient qu'une seule ligne:
|
|
|
|
|
|
- > ::1
|
|
|
+ yojik._domainkey.yojik.net yojik.net:yojik:/etc/opendkim/keys/yojik.net/yojik.private
|
|
|
|
|
|
- > localhost
|
|
|
+* /etc/opendkim/TrustedHosts
|
|
|
|
|
|
- > yojik.net
|
|
|
+ 127.0.0.1
|
|
|
+ ::1
|
|
|
+ localhost
|
|
|
+ yojik.net
|
|
|
|
|
|
- Ne pas modifier les 3 premières lignes qui sont nécessaires à opendkim ...
|
|
|
+ Ne pas modifier les 3 premières lignes qui sont nécessaires à opendkim ...
|
|
|
|
|
|
- * Création des clefs publiques et privées
|
|
|
+* Création des clefs publiques et privées
|
|
|
|
|
|
- > cd /etc/opendkim/keys/yojik.net/
|
|
|
+ cd /etc/opendkim/keys/yojik.net/
|
|
|
+ opendkim-genkey -b 2048 -h rsa-sha256 -r -s yojik -d yojik.net -v
|
|
|
|
|
|
- > opendkim-genkey -b 2048 -h rsa-sha256 -r -s yojik -d yojik.net -v
|
|
|
+ Une erreur apparaît: il nous faut installer opendkim-tools:
|
|
|
|
|
|
- Une erreur apparaît: il nous faut installer opendkim-tools:
|
|
|
+ apt install opendkim-tools
|
|
|
|
|
|
- > apt install opendkim-tools
|
|
|
+ 2 fichiers sont crées: la clef publique et la clef privée. Nous allons renommer ces 2 clefs.
|
|
|
|
|
|
- 2 fichiers sont crées: la clef publique et la clef privée. Nous allons renommer ces 2 clefs.
|
|
|
+ mv mv 201805.private yojik.private
|
|
|
+ mv 201805.txt yojik.txt
|
|
|
|
|
|
- > mv mv 201805.private yojik.private
|
|
|
+ Note du 9 décembre 2018: les fichiers sont crées avec les noms corrects; pas besoin de les renommer.
|
|
|
|
|
|
- > mv 201805.txt yojik.txt
|
|
|
+ On réapplique la modification des permissions:
|
|
|
|
|
|
- Note du 9 décembre 2018: les fichiers sont crées avec les noms corrects; pas besoin de les renommer.
|
|
|
- On réapplique la modification des permissions:
|
|
|
+ root@atom:/etc/opendkim/keys# cd /etc
|
|
|
+ root@atom:/etc# chown -R opendkim:opendkim /etc/opendkim
|
|
|
+ root@atom:/etc# chmod -R go-rw /etc/opendkim/keys
|
|
|
+ root@atom:/etc#
|
|
|
|
|
|
-```shell
|
|
|
-root@atom:/etc/opendkim/keys# cd /etc
|
|
|
-root@atom:/etc# chown -R opendkim:opendkim /etc/opendkim
|
|
|
-root@atom:/etc# chmod -R go-rw /etc/opendkim/keys
|
|
|
-root@atom:/etc#
|
|
|
-```
|
|
|
+ On relance opendkim pour voir s'il y a des erreurs:
|
|
|
|
|
|
- On relance opendkim pour voir s'il y a des erreurs:
|
|
|
+ systemctl restart opendkim
|
|
|
|
|
|
- > systemctl restart opendkim
|
|
|
+ On lance:
|
|
|
|
|
|
- On lance:
|
|
|
+ netstat -tlnp
|
|
|
|
|
|
- > netstat -tlnp
|
|
|
+ et on voit la ligne:
|
|
|
|
|
|
- et on voit la ligne:
|
|
|
-
|
|
|
- > tcp 0 0 127.0.0.1:12301 0.0.0.0:* LISTEN 2395/opendkim
|
|
|
-
|
|
|
- C'est bon .. le service est en place.
|
|
|
+ tcp 0 0 127.0.0.1:12301 0.0.0.0:* LISTEN 2395/opendkim
|
|
|
|
|
|
+ C'est bon .. le service est en place.
|
|
|
|
|
|
### Ajout de DKIM à Postix
|
|
|
|
|
|
- On va rajouter la gestion de DKIM à Postfix dans le fichier /etc/postfix/main.cf
|
|
|
-
|
|
|
- On ajoute les lignes suivantes:
|
|
|
-
|
|
|
- > milter_default_action = accept
|
|
|
-
|
|
|
- > milter_protocol = 2
|
|
|
-
|
|
|
- > smtpd_milters = inet:localhost:12301
|
|
|
+On va rajouter la gestion de DKIM à Postfix dans le fichier /etc/postfix/main.cf
|
|
|
|
|
|
- > non_smtpd_milters = inet:localhost:12301
|
|
|
+On ajoute les lignes suivantes:
|
|
|
|
|
|
- On relance Postfix par:
|
|
|
+ milter_default_action = accept
|
|
|
+ milter_protocol = 2
|
|
|
+ smtpd_milters = inet:localhost:12301
|
|
|
+ non_smtpd_milters = inet:localhost:12301
|
|
|
|
|
|
- > service postfix restart
|
|
|
+On relance Postfix par:
|
|
|
|
|
|
+ service postfix restart
|
|
|
|
|
|
### Ajout d'un enregistrement DNS
|
|
|
|
|
|
- On ajoute la partie entre double-quotes du fichier /etc/opendkim/keys/yojik.net/yojik.txt à la ligne suivante:
|
|
|
+On ajoute la partie entre double-quotes du fichier /etc/opendkim/keys/yojik.net/yojik.txt à la ligne suivante:
|
|
|
|
|
|
- Attention à la syntaxe: ne pas oublier le "." derrière yojik.net!
|
|
|
+Attention à la syntaxe: ne pas oublier le "." derrière yojik.net!
|
|
|
|
|
|
- > yojik._domainkey.yojik.net.<>IN<->TXT<>( "v=DKIM1; h=rsa-sha256; k=rsa; s=email; p=;")
|
|
|
+ yojik._domainkey.yojik.net.<>IN<->TXT<>( "v=DKIM1; h=rsa-sha256; k=rsa; s=email; p=;")
|
|
|
|
|
|
- Ajouter la clef derrière p= (supprimer les doubles quotes du début, milieu et fin de clef: ex:
|
|
|
- "ljjoj" "dfjj")
|
|
|
+Ajouter la clef derrière p= (supprimer les doubles quotes du début, milieu et fin de clef: ex:
|
|
|
|
|
|
-### Test
|
|
|
+ "ljjoj" "dfjj")
|
|
|
|
|
|
- > opendkim-testkey -d yojik.net -s yojik
|
|
|
+### Test de Opendkim
|
|
|
|
|
|
- Si votre clef est de longueur 2048, il va falloir la découper ... et utiliser le format "multi-lignes" comme ce qui suit:
|
|
|
+ opendkim-testkey -d yojik.net -s yojik
|
|
|
|
|
|
+Si votre clef est de longueur 2048, il va falloir la découper ... et utiliser le format "multi-lignes" comme ce qui suit:
|
|
|
|
|
|
### Notes
|
|
|
|
|
@@ -377,62 +339,58 @@ Cette fois-ci, tout est bon.
|
|
|
|
|
|
* J'ai adopté une technique pour coller ma clef dans l'enregistrement dns: je fais un:
|
|
|
|
|
|
-> cat fichier_de_zone fichier_de_clef > fichier_de_zone.new
|
|
|
+ cat fichier_de_zone fichier_de_clef > fichier_de_zone.new
|
|
|
|
|
|
J'édite le fichier (les retours-chariot etc ...) et je remplace le fichier original (que je sauve d'abord) en incrémentant le numero de série dans le fichier.
|
|
|
|
|
|
-### Test
|
|
|
-
|
|
|
- On envoie un message pour voir s'il est bien signé.
|
|
|
+### Nouveau Test
|
|
|
|
|
|
- Je redémarre le serveur et j'envoie un message.
|
|
|
+On envoie un message pour voir s'il est bien signé.
|
|
|
|
|
|
- Voilà les résultats:
|
|
|
+Je redémarre le serveur et j'envoie un message.
|
|
|
|
|
|
-```shell
|
|
|
-> ARC-Authentication-Results: i=1; mx.google.com;
|
|
|
-> dkim=pass header.i=@yojik.net header.s=yojik header.b=CE0b13ii;
|
|
|
-> spf=pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > smtp.mailfrom=ericadmin@yojik.net
|
|
|
-> Received-SPF: pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > client-ip=82.64.48.5;
|
|
|
-> Authentication-Results: mx.google.com;
|
|
|
-> dkim=pass header.i=@yojik.net header.s=yojik header.b=CE0b13ii;
|
|
|
-> spf=pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > smtp.mailfrom=ericadmin@yojik.net
|
|
|
-> Received: from [192.168.111.150] (unknown [192.168.111.150])
|
|
|
-> by atom.yojik.net (Postfix) with ESMTPSA id AFB9ED004F3
|
|
|
-> for <ericounet26200@gmail.com>; Thu, 31 May 2018 12:09:41 +0200 (CEST)
|
|
|
-> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yojik.net; s=yojik;
|
|
|
-> t=1527761381; bh=ay9Odp/rKTenfDlpDmHqBM+YFfCITM3u/keXU6iwx20=;
|
|
|
-> h=To:From:Subject:Date:From;
|
|
|
-> b=CE0b13iiZgEQgrd7EngBovulGeU6QnSU/cKzia42u9s9B+S/dxUsm1u7JRjBrTLLg
|
|
|
-> /c/uW05pdE5QS+9y3dvZtji0hogr0H87nRpZE7QBZaFLpVWGpUTukRsJ47JskO+Cwi
|
|
|
-> 4cRYjeyUOLTY8Gc8uQaiS79CDko8E107fsfoUGV8=
|
|
|
-```
|
|
|
+Voilà les résultats:
|
|
|
|
|
|
+ > ARC-Authentication-Results: i=1; mx.google.com;
|
|
|
+ > dkim=pass header.i=@yojik.net header.s=yojik header.b=CE0b13ii;
|
|
|
+ > spf=pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > smtp.mailfrom=ericadmin@yojik.net
|
|
|
+ > Received-SPF: pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > client-ip=82.64.48.5;
|
|
|
+ > Authentication-Results: mx.google.com;
|
|
|
+ > dkim=pass header.i=@yojik.net header.s=yojik header.b=CE0b13ii;
|
|
|
+ > spf=pass (google.com: domain of ericadmin@yojik.net designates 82.64.48.5 as permitted sender) > smtp.mailfrom=ericadmin@yojik.net
|
|
|
+ > Received: from [192.168.111.150] (unknown [192.168.111.150])
|
|
|
+ > by atom.yojik.net (Postfix) with ESMTPSA id AFB9ED004F3
|
|
|
+ > for <ericounet26200@gmail.com>; Thu, 31 May 2018 12:09:41 +0200 (CEST)
|
|
|
+ > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yojik.net; s=yojik;
|
|
|
+ > t=1527761381; bh=ay9Odp/rKTenfDlpDmHqBM+YFfCITM3u/keXU6iwx20=;
|
|
|
+ > h=To:From:Subject:Date:From;
|
|
|
+ > b=CE0b13iiZgEQgrd7EngBovulGeU6QnSU/cKzia42u9s9B+S/dxUsm1u7JRjBrTLLg
|
|
|
+ > /c/uW05pdE5QS+9y3dvZtji0hogr0H87nRpZE7QBZaFLpVWGpUTukRsJ47JskO+Cwi
|
|
|
+ > 4cRYjeyUOLTY8Gc8uQaiS79CDko8E107fsfoUGV8=
|
|
|
|
|
|
Tout est bon ....
|
|
|
|
|
|
**IL est recommandé de changer les clefs DKIM tous les mois!** ... Je pense qu'il va falloir créer des scripts pour toute la maintenance des clefs et de leur renouvellement.
|
|
|
|
|
|
-
|
|
|
## ADSP
|
|
|
|
|
|
- Author Domain Signing Practices (ADSP)Permalink (technique obsolète ...)
|
|
|
+Author Domain Signing Practices (ADSP)Permalink (technique obsolète ...)
|
|
|
|
|
|
- Nous allons rajouter un enregistrement DNS qui va indiquer que tous les émails issus par yojik.net doivent être signés par DKIM. C'est une sécurité supplémentaire.
|
|
|
+Nous allons rajouter un enregistrement DNS qui va indiquer que tous les émails issus par yojik.net doivent être signés par DKIM. C'est une sécurité supplémentaire.
|
|
|
|
|
|
- La syntaxe est assez simple:
|
|
|
+La syntaxe est assez simple:
|
|
|
|
|
|
- > _adsp._domainkey.yojik.net. IN TXT "dkim=all"
|
|
|
- >
|
|
|
- * Le paramètre dkim accepte d'autres valeurs moins strictes, mais j'ai choisi la plus stricte.
|
|
|
- * Ne pas oublier d'incrémenter le numéro de série du fichier de zone après modification.
|
|
|
- * Rechargez bind.
|
|
|
+ _adsp._domainkey.yojik.net. IN TXT "dkim=all"
|
|
|
|
|
|
- > service bind9 restart (ou reload)
|
|
|
+* Le paramètre dkim accepte d'autres valeurs moins strictes, mais j'ai choisi la plus stricte.
|
|
|
+* Ne pas oublier d'incrémenter le numéro de série du fichier de zone après modification.
|
|
|
+* Rechargez bind.
|
|
|
|
|
|
- Tout est OK.
|
|
|
+ service bind9 restart (ou reload)
|
|
|
|
|
|
- Note: ADSP et Dmarc remplissent le même rôle. Après consultation d'experts, ADSP est "obsolète". Nous allons donc enlever ce service (commenter la ligne DNS) et configurer DMARC.
|
|
|
+ Tout est OK.
|
|
|
+
|
|
|
+Note: ADSP et Dmarc remplissent le même rôle. Après consultation d'experts, ADSP est "obsolète". Nous allons donc enlever ce service (commenter la ligne DNS) et configurer DMARC.
|
|
|
|
|
|
## DMARC
|
|
|
|
|
@@ -442,21 +400,19 @@ La mise en place de DMARC nécessite de configurer/installer opendmarc, de mettr
|
|
|
|
|
|
### Installation de Opendmarc
|
|
|
|
|
|
-```
|
|
|
-root@atom:/home/ericadmin# apt install opendmarc
|
|
|
-Lecture des listes de paquets... Fait
|
|
|
-Construction de l'arbre des dépendances
|
|
|
-Lecture des informations d'état... Fait
|
|
|
-The following additional packages will be installed:
|
|
|
- libdbd-mysql-perl libdbi-perl libencode-locale-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libopendbx1-mysql libopendmarc2
|
|
|
- libspf2-2 libtimedate-perl liburi-perl publicsuffix
|
|
|
-etc ...
|
|
|
-
|
|
|
-Paramétrage de libdbd-mysql-perl (4.041-2) ...
|
|
|
-Paramétrage de opendmarc (1.3.2-2+deb9u1) ...
|
|
|
-Traitement des actions différées (« triggers ») pour libc-bin (2.24-11+deb9u3) ...
|
|
|
-Traitement des actions différées (« triggers ») pour systemd (232-25+deb9u3) ...
|
|
|
-```
|
|
|
+ root@atom:/home/ericadmin# apt install opendmarc
|
|
|
+ Lecture des listes de paquets... Fait
|
|
|
+ Construction de l'arbre des dépendances
|
|
|
+ Lecture des informations d'état... Fait
|
|
|
+ The following additional packages will be installed:
|
|
|
+ libdbd-mysql-perl libdbi-perl libencode-locale-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libopendbx1-mysql libopendmarc2
|
|
|
+ libspf2-2 libtimedate-perl liburi-perl publicsuffix
|
|
|
+ etc ...
|
|
|
+
|
|
|
+ Paramétrage de libdbd-mysql-perl (4.041-2) ...
|
|
|
+ Paramétrage de opendmarc (1.3.2-2+deb9u1) ...
|
|
|
+ Traitement des actions différées (« triggers ») pour libc-bin (2.24-11+deb9u3) ...
|
|
|
+ Traitement des actions différées (« triggers ») pour systemd (232-25+deb9u3) ...
|
|
|
|
|
|
Voilà, opendmarc est installé. Passons à sa configuration.
|
|
|
|
|
@@ -470,146 +426,133 @@ Comme d'habitude, faite une copie de sauvegarde du fichier d'origine avant modif
|
|
|
|
|
|
**Fichier /etc/opendmarc.conf**:
|
|
|
|
|
|
-```shell
|
|
|
-# This is a basic configuration that can easily be adapted to suit a standard
|
|
|
-# installation. For more advanced options, see opendkim.conf(5) and/or
|
|
|
-# /usr/share/doc/opendmarc/examples/opendmarc.conf.sample.
|
|
|
-
|
|
|
-## AuthservID (string)
|
|
|
-## <-->defaults to MTA name
|
|
|
-#
|
|
|
-# AuthservID name
|
|
|
-
|
|
|
-## FailureReports { true | false }
|
|
|
-## <-->default "false"
|
|
|
-##
|
|
|
-# FailureReports false
|
|
|
-
|
|
|
-PidFile /var/run/opendmarc/opendmarc.pid
|
|
|
-
|
|
|
-## RejectFailures { true | false }
|
|
|
-## <-->default "false"
|
|
|
-##
|
|
|
-RejectFailures false
|
|
|
-
|
|
|
-## Socket socketspec
|
|
|
-## <-->default (none)
|
|
|
-##
|
|
|
-## Specifies the socket that should be established by the filter to receive
|
|
|
-## connections from sendmail(8) in order to provide service. socketspec is
|
|
|
-## in one of two forms: local:path, which creates a UNIX domain socket at
|
|
|
-## the specified path, or inet:port[@host] or inet6:port[@host] which creates
|
|
|
-## a TCP socket on the specified port for the appropriate protocol family.
|
|
|
-## If the host is not given as either a hostname or an IP address, the
|
|
|
-## socket will be listening on all interfaces. This option is mandatory
|
|
|
-## either in the configuration file or on the command line. If an IP
|
|
|
-## address is used, it must be enclosed in square brackets.
|
|
|
-#
|
|
|
-# Socket local:/var/run/opendmarc/opendmarc.sock
|
|
|
-Socket inet:54444@localhost
|
|
|
-
|
|
|
-## Syslog { true | false }
|
|
|
-## <-->default "false"
|
|
|
-##
|
|
|
-## Log via calls to syslog(3) any interesting activity.
|
|
|
-#
|
|
|
-Syslog true
|
|
|
-
|
|
|
-## SyslogFacility facility-name
|
|
|
-## <-->default "mail"
|
|
|
-##
|
|
|
-## Log via calls to syslog(3) using the named facility. The facility names
|
|
|
-## are the same as the ones allowed in syslog.conf(5).
|
|
|
-#
|
|
|
-# SyslogFacility mail
|
|
|
-
|
|
|
-## TrustedAuthservIDs string
|
|
|
-## <-->default HOSTNAME
|
|
|
-##
|
|
|
-## Specifies one or more "authserv-id" values to trust as relaying true
|
|
|
-## upstream DKIM and SPF results. The default is to use the name of
|
|
|
-## the MTA processing the message. To specify a list, separate each entry
|
|
|
-## with a comma. The key word "HOSTNAME" will be replaced by the name of
|
|
|
-## the host running the filter as reported by the gethostname(3) function.
|
|
|
-#
|
|
|
-# TrustedAuthservIDs HOSTNAME
|
|
|
-
|
|
|
-
|
|
|
-## UMask mask
|
|
|
-## <-->default (none)
|
|
|
-##
|
|
|
-## Requests a specific permissions mask to be used for file creation. This
|
|
|
-## only really applies to creation of the socket when Socket specifies a
|
|
|
-## UNIX domain socket, and to the HistoryFile and PidFile (if any); temporary
|
|
|
-## files are normally created by the mkstemp(3) function that enforces a
|
|
|
-## specific file mode on creation regardless of the process umask. See
|
|
|
-## umask(2) for more information.
|
|
|
-#
|
|
|
-UMask 0002
|
|
|
-
|
|
|
-## UserID user[:group]
|
|
|
-## <-->default (none)
|
|
|
-##
|
|
|
-## Attempts to become the specified userid before starting operations.
|
|
|
-## The process will be assigned all of the groups and primary group ID of
|
|
|
-## the named userid unless an alternate group is specified.
|
|
|
-#
|
|
|
-UserID opendmarc
|
|
|
-
|
|
|
-## Path to system copy of PSL (needed to determine organizational domain)
|
|
|
-#
|
|
|
-PublicSuffixList /usr/share/publicsuffix/
|
|
|
-
|
|
|
-IgnoreHosts /etc/opendmarc/ignore.hosts
|
|
|
-HistoryFile /var/run/opendmarc/opendmarc.dat
|
|
|
-#for testing:
|
|
|
-SoftwareHeader true
|
|
|
-```
|
|
|
+ # This is a basic configuration that can easily be adapted to suit a standard
|
|
|
+ # installation. For more advanced options, see opendkim.conf(5) and/or
|
|
|
+ # /usr/share/doc/opendmarc/examples/opendmarc.conf.sample.
|
|
|
+
|
|
|
+ ## AuthservID (string)
|
|
|
+ ## <-->defaults to MTA name
|
|
|
+ #
|
|
|
+ # AuthservID name
|
|
|
+
|
|
|
+ ## FailureReports { true | false }
|
|
|
+ ## <-->default "false"
|
|
|
+ ##
|
|
|
+ # FailureReports false
|
|
|
+
|
|
|
+ PidFile /var/run/opendmarc/opendmarc.pid
|
|
|
+
|
|
|
+ ## RejectFailures { true | false }
|
|
|
+ ## <-->default "false"
|
|
|
+ ##
|
|
|
+ RejectFailures false
|
|
|
+
|
|
|
+ ## Socket socketspec
|
|
|
+ ## <-->default (none)
|
|
|
+ ##
|
|
|
+ ## Specifies the socket that should be established by the filter to receive
|
|
|
+ ## connections from sendmail(8) in order to provide service. socketspec is
|
|
|
+ ## in one of two forms: local:path, which creates a UNIX domain socket at
|
|
|
+ ## the specified path, or inet:port[@host] or inet6:port[@host] which creates
|
|
|
+ ## a TCP socket on the specified port for the appropriate protocol family.
|
|
|
+ ## If the host is not given as either a hostname or an IP address, the
|
|
|
+ ## socket will be listening on all interfaces. This option is mandatory
|
|
|
+ ## either in the configuration file or on the command line. If an IP
|
|
|
+ ## address is used, it must be enclosed in square brackets.
|
|
|
+ #
|
|
|
+ # Socket local:/var/run/opendmarc/opendmarc.sock
|
|
|
+ Socket inet:54444@localhost
|
|
|
+
|
|
|
+ ## Syslog { true | false }
|
|
|
+ ## <-->default "false"
|
|
|
+ ##
|
|
|
+ ## Log via calls to syslog(3) any interesting activity.
|
|
|
+ #
|
|
|
+ Syslog true
|
|
|
+
|
|
|
+ ## SyslogFacility facility-name
|
|
|
+ ## <-->default "mail"
|
|
|
+ ##
|
|
|
+ ## Log via calls to syslog(3) using the named facility. The facility names
|
|
|
+ ## are the same as the ones allowed in syslog.conf(5).
|
|
|
+ #
|
|
|
+ # SyslogFacility mail
|
|
|
+
|
|
|
+ ## TrustedAuthservIDs string
|
|
|
+ ## <-->default HOSTNAME
|
|
|
+ ##
|
|
|
+ ## Specifies one or more "authserv-id" values to trust as relaying true
|
|
|
+ ## upstream DKIM and SPF results. The default is to use the name of
|
|
|
+ ## the MTA processing the message. To specify a list, separate each entry
|
|
|
+ ## with a comma. The key word "HOSTNAME" will be replaced by the name of
|
|
|
+ ## the host running the filter as reported by the gethostname(3) function.
|
|
|
+ #
|
|
|
+ # TrustedAuthservIDs HOSTNAME
|
|
|
+
|
|
|
+
|
|
|
+ ## UMask mask
|
|
|
+ ## <-->default (none)
|
|
|
+ ##
|
|
|
+ ## Requests a specific permissions mask to be used for file creation. This
|
|
|
+ ## only really applies to creation of the socket when Socket specifies a
|
|
|
+ ## UNIX domain socket, and to the HistoryFile and PidFile (if any); temporary
|
|
|
+ ## files are normally created by the mkstemp(3) function that enforces a
|
|
|
+ ## specific file mode on creation regardless of the process umask. See
|
|
|
+ ## umask(2) for more information.
|
|
|
+ #
|
|
|
+ UMask 0002
|
|
|
+
|
|
|
+ ## UserID user[:group]
|
|
|
+ ## <-->default (none)
|
|
|
+ ##
|
|
|
+ ## Attempts to become the specified userid before starting operations.
|
|
|
+ ## The process will be assigned all of the groups and primary group ID of
|
|
|
+ ## the named userid unless an alternate group is specified.
|
|
|
+ #
|
|
|
+ UserID opendmarc
|
|
|
+
|
|
|
+ ## Path to system copy of PSL (needed to determine organizational domain)
|
|
|
+ #
|
|
|
+ PublicSuffixList /usr/share/publicsuffix/
|
|
|
+
|
|
|
+ IgnoreHosts /etc/opendmarc/ignore.hosts
|
|
|
+ HistoryFile /var/run/opendmarc/opendmarc.dat
|
|
|
+ #for testing:
|
|
|
+ SoftwareHeader true
|
|
|
|
|
|
On crée le répertoire suivant: /etc/opendmarc et on crée un fichier qui va contenir la liste des machines auxquelles vous avez confiance.
|
|
|
|
|
|
-```shell
|
|
|
-root@atom:/etc# mkdir /etc/opendmarc
|
|
|
-```
|
|
|
+ root@atom:/etc# mkdir /etc/opendmarc
|
|
|
|
|
|
On crée le fichier **/etc/opendmarc/ignore.hosts** avec le contenu suivant (le fichier ignore.hosts a été déclaré dans le fichier /etc/opendmarc.conf):
|
|
|
|
|
|
-> localhost
|
|
|
-> 192.168.111.0/24
|
|
|
+ localhost
|
|
|
+ 192.168.111.0/24
|
|
|
|
|
|
Les mails envoyés par les machines listées dans ce fichier ne seront pas testés. Ici, le serveur de mail lui-même et les machines du réseau local familial.
|
|
|
|
|
|
On ajoute la ligne suivante à /etc/default/opendmarc:
|
|
|
|
|
|
-> SOCKET=inet:54444@localhost
|
|
|
+ SOCKET=inet:54444@localhost
|
|
|
|
|
|
Notre daemon écoutera sur le port 54444. On relance opendmarc par la commande suivante:
|
|
|
|
|
|
-> service opendmarc restart
|
|
|
+ service opendmarc restart
|
|
|
|
|
|
Mise en place du hook dans postfix:
|
|
|
|
|
|
Nous modifierons les 2 lignes suivantes dans le fichier: /etc/postfix/main.cf:
|
|
|
|
|
|
-> smtpd_milters = inet:localhost:12301,inet:localhost:54444
|
|
|
-> non_smtpd_milters = inet:localhost:12301,inet:localhost:54444
|
|
|
+ smtpd_milters = inet:localhost:12301,inet:localhost:54444
|
|
|
+ non_smtpd_milters = inet:localhost:12301,inet:localhost:54444
|
|
|
|
|
|
On recharge postfix (comme d'habitude ...)
|
|
|
Configuration de l'enregistrement DNS dans le fichier de zone (ne pas oublier d'incrémenter le compteur!):
|
|
|
|
|
|
-> _dmarc.yojik.net. TXT ( "v=DMARC1; p=none; sp=reject; pct=10; adkim=r;aspf=r;fo=1;ri=86400;rua=mailto:ericadmin@yojik.net")
|
|
|
+ _dmarc.yojik.net. TXT ( "v=DMARC1; p=none; sp=reject; pct=10; adkim=r;aspf=r;fo=1;ri=86400;rua=mailto:ericadmin@yojik.net")
|
|
|
|
|
|
Test d'envoi de messages:
|
|
|
|
|
|
-> Authentication-Results: atom.yojik.net; dmarc=**pass**
|
|
|
+ Authentication-Results: atom.yojik.net; dmarc=**pass**
|
|
|
|
|
|
Ça fonctionne :)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-```
|