admin:infrastructure:mail
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| admin:infrastructure:mail [2017/07/11 16:40] – créée fpoulain | admin:infrastructure:mail [2021/09/17 13:43] (Version actuelle) – cpm | ||
|---|---|---|---|
| Ligne 4: | Ligne 4: | ||
| Les envois de mails vers l' | Les envois de mails vers l' | ||
| + | |||
| + | <note tip>Pour installer un postfix satellite, c'est ici : [[admin: | ||
| Le serveur de mails est un postfix et le serveur de réception de courrier dovecot. On ne va pas s' | Le serveur de mails est un postfix et le serveur de réception de courrier dovecot. On ne va pas s' | ||
| + | |||
| + | Enfin, sympa et l' | ||
| ===== Architecture de postfix ===== | ===== Architecture de postfix ===== | ||
| Ligne 20: | Ligne 24: | ||
| La configuration TLS est basique: un couple clé/ | La configuration TLS est basique: un couple clé/ | ||
| + | |||
| + | <note warning> | ||
| + | |||
| + | ===== Installation de Amavis ===== | ||
| <code bash> | <code bash> | ||
| - | apt-get install | + | apt install amavisd-new spamassassin clamav-daemon pyzor razor arj bzip2 cabextract cpio file gzip nomarch pax unzip zip |
| - | apt-get install libnet-dns-perl libmail-spf-perl | + | |
| - | apt-get install | + | |
| </ | </ | ||
| Ligne 46: | Ligne 52: | ||
| <code bash> | <code bash> | ||
| - | apt-get install clamav-testfiles | + | apt install |
| + | systemctl start clamav-daemon.service | ||
| + | systemctl restart clamav-freshclam.service | ||
| clamdscan / | clamdscan / | ||
| </ | </ | ||
| - | ==== Installation de fail2ban ==== | + | Enfin décommenter les lignes dans ''/ |
| + | <code conf / | ||
| + | @bypass_virus_checks_maps = ( | ||
| + | | ||
| + | |||
| + | @bypass_spam_checks_maps = ( | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | Et redémarrer amavis : | ||
| + | systemctl restart amavis | ||
| + | ===== Installation de fail2ban | ||
| L' | L' | ||
| Ligne 56: | Ligne 76: | ||
| <code bash> | <code bash> | ||
| apt-get install fail2ban | apt-get install fail2ban | ||
| - | / | ||
| - | ignoreip = 172.16.0.0/ | ||
| - | bantime | ||
| - | findtime = 600 | ||
| - | maxretry = 5 | ||
| - | destemail = admins-auto@april.org | ||
| - | sender = admins-auto@april.org | ||
| </ | </ | ||
| - | ==== Installation de Postgrey ==== | + | ===== Installation de Postgrey |
| Pour un aperçu sur le greylisting : https:// | Pour un aperçu sur le greylisting : https:// | ||
| Ligne 74: | Ligne 87: | ||
| Après ça postgrey tourne et écoute sur le 10023. Il faut ajouter une restriction au niveau de posftix : | Après ça postgrey tourne et écoute sur le 10023. Il faut ajouter une restriction au niveau de posftix : | ||
| - | <code postfix / | + | <code postfix / |
| smtpd_recipient_restrictions = | smtpd_recipient_restrictions = | ||
| [...] | [...] | ||
| | | ||
| - | | ||
| </ | </ | ||
| Et nous allons baisser fortement le délais de greylisting, | Et nous allons baisser fortement le délais de greylisting, | ||
| <code bash / | <code bash / | ||
| POSTGREY_OPTS=" | POSTGREY_OPTS=" | ||
| + | </ | ||
| + | |||
| + | Nous allons aussi ajouter une liste de gros comptes en whitelist car les messages venant d'eux peuvent « rebondir » depuis de nombreux serveurs d'un même pool avant de nous parvenir tel qu'on les attend | ||
| + | <code conf / | ||
| + | yahoo.com | ||
| + | google.com | ||
| + | hotmail.com | ||
| + | live.fr | ||
| + | outlook.com | ||
| + | mail-out.ovh.net | ||
| + | mxb.ovh.net | ||
| + | gandi.net | ||
| </ | </ | ||
| Et on redémarre le tout : | Et on redémarre le tout : | ||
| < | < | ||
| - | / | + | systemctl |
| postfix reload | postfix reload | ||
| </ | </ | ||
| - | ==== Déploiement de DKIM sur postfix ==== | + | ===== Déploiement de DKIM sur postfix |
| Pour le déploiement, | Pour le déploiement, | ||
| Ligne 100: | Ligne 124: | ||
| </ | </ | ||
| - | Édition de ''/ | + | Édition de ''/ |
| < | < | ||
| - | KeyTable | + | KeyTable |
| - | SigningTable | + | SigningTable |
| - | ExternalIgnoreList /etc/opendkim/ | + | ExternalIgnoreList |
| - | InternalHosts | + | |
| </ | </ | ||
| Ligne 112: | Ligne 135: | ||
| < | < | ||
| - | SOCKET=" | + | SOCKET=" |
| </ | </ | ||
| - | Puis, pour setuper toutes | + | <note important> |
| + | Puis, pour générer les clefs: | ||
| <code bash> | <code bash> | ||
| - | for domain in april.org listes.april.org localhost localhost.april.org mail.april.org agendadulibre.org candidats.fr flosspact.eu flosspact.org freesoftwarepact.eu freesoftwarepact.org informatiquedeloyale.info libreassociation.info libre-en-fete.net libre-en-fete.org libre-en-fete.org libre-et-accessible.org logiciel-libre.info logiciels-libres.info pactelogiciellibre.fr pactelogiciellibre.org agendadulibre.org agendadulibre.be agendadulibre.ch formatsouverts.education eucd.info ; | + | opendkim-genkey |
| - | do | + | |
| - | mkdir -p /etc/opendkim/keys/$domain | + | |
| - | cd / | + | |
| - | opendkim-genkey -r -d $domain | + | |
| - | chown opendkim: | + | |
| - | echo " | + | |
| - | le | + | |
| - | echo " | + | |
| - | + | ||
| - | done | + | |
| </ | </ | ||
| - | Ensuite, copie sur la machine dns de ''/ | + | On va alors obtenir |
| - | Dans Postfix | + | Par ailleurs |
| + | <code conf / | ||
| + | mail._domainkey.chapril.org chapril.org: | ||
| + | </ | ||
| + | < | ||
| + | chapril.org mail._domainkey.chapril.org | ||
| + | </ | ||
| + | et | ||
| + | <code conf / | ||
| + | 127.0.0.1 | ||
| + | localhost | ||
| + | 192.168.0.0/ | ||
| + | [:: | ||
| + | [::1]/128 | ||
| + | [2a01: | ||
| + | [2a01: | ||
| + | 88.191.250.11 | ||
| + | # 88.191.250.11 est galanga | ||
| + | </ | ||
| + | |||
| + | On pense à changer les permissions : | ||
| + | chgrp opendkim / | ||
| + | chmod g+r / | ||
| + | Enfin, dans Postfix on ajoute dans ''/ | ||
| < | < | ||
| milter_default_action = accept | milter_default_action = accept | ||
| - | milter_protocol = 6 | + | milter_protocol = 2 |
| - | smtpd_milters = inet: | + | smtpd_milters = inet: |
| - | non_smtpd_milters = inet: | + | non_smtpd_milters = inet: |
| </ | </ | ||
| Puis '' | Puis '' | ||
| - | |||
| < | < | ||
| service postfix reload | service postfix reload | ||
| </ | </ | ||
| + | |||
| + | ===== Adresse no-reply ===== | ||
| + | |||
| + | Une adresse devnull@chapril.org existe pour les besoins d'un no-reply. | ||
admin/infrastructure/mail.1499791214.txt.gz · Dernière modification : 2017/07/11 16:40 de fpoulain
