Postfix » Historique » Version 26
Patrice Nadeau, 2015-06-21 17:37
| 1 | 13 | Patrice Nadeau | h1. Postfix |
|---|---|---|---|
| 2 | 1 | Patrice Nadeau | |
| 3 | 12 | Patrice Nadeau | > Issue : #16 |
| 4 | |||
| 5 | 4 | Patrice Nadeau | http://www.postfix.org |
| 6 | 1 | Patrice Nadeau | |
| 7 | Logiciel de courrier électronique permettant, le transfert de courrier électronique (Message Transfert Agent). |
||
| 8 | |||
| 9 | Souvent installé de base pour l’envoie des message du serveur à une adresse externe. |
||
| 10 | 14 | Patrice Nadeau | |
| 11 | ---- |
||
| 12 | |||
| 13 | {{toc}} |
||
| 14 | |||
| 15 | 5 | Patrice Nadeau | Si le serveur doit envoyer et recevoir des messages de et vers l’Internet, les items suivant sont obligatoire : |
| 16 | * Domaine : Un nom de domaine enregistrer et sa gestion disponible |
||
| 17 | 1 | Patrice Nadeau | * MX records : pour permettre la réception de courriel. |
| 18 | 5 | Patrice Nadeau | * SPF records : pour permettre l’envoie de messages sans être bannis par les « reverse lookup ». |
| 19 | 1 | Patrice Nadeau | |
| 20 | 21 | Patrice Nadeau | Un serveur de relais (SMTP) externe seras nécessaire pour envoyer des courriels vers l’Internet si le port 25 est bloqué en entré (la majorité des cas). |
| 21 | 1 | Patrice Nadeau | |
| 22 | Les fichiers de configuration sont : |
||
| 23 | 5 | Patrice Nadeau | * _/etc/postfix/master.cf_ |
| 24 | * _/etc/postfix/main.cf_ |
||
| 25 | |||
| 26 | 13 | Patrice Nadeau | h2. Installation |
| 27 | 5 | Patrice Nadeau | |
| 28 | <pre><code class="bash"> |
||
| 29 | zypper install postfix |
||
| 30 | 15 | Patrice Nadeau | systemctl enable postfix |
| 31 | systemctl start postfix |
||
| 32 | 17 | Patrice Nadeau | # Ouvrir dans le pare-feu seulement si le serveur doit recevoir des courriels |
| 33 | 22 | Patrice Nadeau | yast firewall services add service=service:smtp zone=EXT |
| 34 | 5 | Patrice Nadeau | </code></pre> |
| 35 | |||
| 36 | 13 | Patrice Nadeau | h2. Configuration |
| 37 | 5 | Patrice Nadeau | |
| 38 | 21 | Patrice Nadeau | Si les courriels doivent sortir via un relais sur un autre serveur SMTP, modifier le fichier _/etc/postfix/main.cf_ : |
| 39 | 5 | Patrice Nadeau | <pre><code class="bash"> |
| 40 | # Inscrire votre serveur SMTP de sortie |
||
| 41 | relayhost = smtp_server |
||
| 42 | # Spécifier toutes les interfaces |
||
| 43 | inet_interfaces = all |
||
| 44 | # A la ligne mydestination, ajouter |
||
| 45 | $mydomain |
||
| 46 | # Permettre aux machines du réseau local, l'utilisation du serveur |
||
| 47 | smtpd_client_restrictions = permit_mynetworks |
||
| 48 | </code></pre> |
||
| 49 | > La ligne myhostname DOIT être la même que l’enregistrement DNS de type MX sur internet pour ce domaine. |
||
| 50 | 1 | Patrice Nadeau | |
| 51 | 13 | Patrice Nadeau | h2. Création de «blacklist» et de «whitelist». |
| 52 | 1 | Patrice Nadeau | |
| 53 | 6 | Patrice Nadeau | Informations provenant de : http://www.postfix.org/RESTRICTION_CLASS_README.html |
| 54 | 1 | Patrice Nadeau | |
| 55 | 6 | Patrice Nadeau | Fichier _/etc/postfix/main.cf_ |
| 56 | <pre><code class="bash"> |
||
| 57 | smtpd_recipient_restrictions = |
||
| 58 | check_sender_access hash: /etc/postfix/sender_access |
||
| 59 | </code></pre> |
||
| 60 | 1 | Patrice Nadeau | |
| 61 | 6 | Patrice Nadeau | Créer un fichier _/etc/postfix/sender_access_. |
| 62 | Placer à l’intérieur, l’adresse de courriel, le nom de domaine ou l’adresse IP avec l’une des options : |
||
| 63 | * OK |
||
| 64 | * REJECT |
||
| 65 | 1 | Patrice Nadeau | |
| 66 | 6 | Patrice Nadeau | Modifier le fichier _/etc/postfix/sender_access_ : |
| 67 | <pre><code class="bash"> |
||
| 68 | # myfriend.com OK |
||
| 69 | # myennemies.com REJECT |
||
| 70 | # myfriend@example.com OK |
||
| 71 | # junk@spam.com REJECT |
||
| 72 | # marketing@ REJECT |
||
| 73 | # theboss@ OK |
||
| 74 | # deals.marketing.com REJECT |
||
| 75 | # somedomain.com OK |
||
| 76 | 101.15.251.176 REJECT |
||
| 77 | </code></pre> |
||
| 78 | |||
| 79 | 7 | Patrice Nadeau | Relancer : |
| 80 | <pre><code class="bash"> |
||
| 81 | postmap /etc/postfix/sender_access |
||
| 82 | postfix reload |
||
| 83 | </code></pre> |
||
| 84 | |||
| 85 | 13 | Patrice Nadeau | h3. Utilisation de services de « blacklist » internet : |
| 86 | 7 | Patrice Nadeau | |
| 87 | Modifier le fichier _/etc/postfix/main.cf_ : |
||
| 88 | <pre><code class="bash"> |
||
| 89 | smtpd_recipient_restrictions = |
||
| 90 | reject_rbl_client zen.spamhaus.org, |
||
| 91 | reject_rhsbl_helo dbl.spamhaus.org, |
||
| 92 | reject_rhsbl_sender dbl.spamhaus.org, |
||
| 93 | </code></pre> |
||
| 94 | 6 | Patrice Nadeau | |
| 95 | 13 | Patrice Nadeau | h3. Alias |
| 96 | 10 | Patrice Nadeau | |
| 97 | 20 | Patrice Nadeau | Usagers systèmes devant être redirigé vers des comptes utilisateurs réel. |
| 98 | 10 | Patrice Nadeau | |
| 99 | 20 | Patrice Nadeau | Les ajouter dans le fichier _/etc/postfix/aliases_ |
| 100 | |||
| 101 | Lancer la commande _newaliases_ pour activer les changements. |
||
| 102 | |||
| 103 | 10 | Patrice Nadeau | |
| 104 | 13 | Patrice Nadeau | h3. Options courantes |
| 105 | 11 | Patrice Nadeau | |
| 106 | Dans _main.cf_ : |
||
| 107 | * *message_size_limit* : |
||
| 108 | |||
| 109 | 13 | Patrice Nadeau | h2. Entrés DNS |
| 110 | 6 | Patrice Nadeau | |
| 111 | 13 | Patrice Nadeau | h3. A record |
| 112 | 6 | Patrice Nadeau | |
| 113 | 13 | Patrice Nadeau | h3. MX record |
| 114 | 6 | Patrice Nadeau | |
| 115 | 13 | Patrice Nadeau | h3. SPF record |
| 116 | 6 | Patrice Nadeau | |
| 117 | 2 | Patrice Nadeau | Ajouter ceux du fournisseur internet (le fournisseur et et tous ses abonnées pourront "se faire passer" pour le domaine) |
| 118 | |||
| 119 | 13 | Patrice Nadeau | h2. Test |
| 120 | 2 | Patrice Nadeau | |
| 121 | 13 | Patrice Nadeau | h3. SPF |
| 122 | 3 | Patrice Nadeau | |
| 123 | Envoyer un courriel à une des adresses suivantes : |
||
| 124 | * check-auth@verifier.port25.com |
||
| 125 | 6 | Patrice Nadeau | * check-auth2@verifier.port25.com |
| 126 | 8 | Patrice Nadeau | |
| 127 | 19 | Patrice Nadeau | h3. TLS |
| 128 | |||
| 129 | Site internet pour vérifier la configuration TLS : |
||
| 130 | * Envoie : https://www.checktls.com/perl/TestSender.pl |
||
| 131 | * Réception : https://www.checktls.com/perl/TestReceiver.pl |
||
| 132 | |||
| 133 | 13 | Patrice Nadeau | h2. Dépannage |
| 134 | 8 | Patrice Nadeau | |
| 135 | La commande *mailq* permet de voir les requêtes en attentes. |
||
| 136 | 18 | Patrice Nadeau | |
| 137 | h3. Droits sur les dossiers |
||
| 138 | |||
| 139 | h4. openSUSE |
||
| 140 | |||
| 141 | Les droits doivent être _rwxr-s-r-x_ avec comme proprietaire _root:maildrop_ sur les fichiers suivants : |
||
| 142 | /usr/sbin/ |
||
| 143 | * postqueue |
||
| 144 | * postdrop |
||
| 145 | |||
| 146 | Pour les corriger : |
||
| 147 | <pre><code class="bash"> |
||
| 148 | chown -R root:maildrop /usr/bin/postqueu |
||
| 149 | chmod -R g+s /usr/bin/postqueue |
||
| 150 | chown -R root:maildrop /usr/bin/postdrop |
||
| 151 | 1 | Patrice Nadeau | chmod -R g+s /usr/bin/postdrop |
| 152 | 23 | Patrice Nadeau | </code></pre> |
| 153 | |||
| 154 | h3. Messages ne s'envoient pas |
||
| 155 | |||
| 156 | 26 | Patrice Nadeau | > Vu sur une nouvelle installation openSUSE 13.2 |
| 157 | |||
| 158 | Modififer le fichier */etc/postfix/main.cf* |
||
| 159 | <pre><code class="bash"> |
||
| 160 | disable_dns_lookups = yes |
||
| 161 | </code></pre> |
||
| 162 | 25 | Patrice Nadeau | |
| 163 | 23 | Patrice Nadeau | h3. Messages *error: open database /etc/postfix/relay.db: No such file or directory* |
| 164 | |||
| 165 | > Vu sur une nouvelle installation openSUSE 13.2 |
||
| 166 | |||
| 167 | Exécuter la commande |
||
| 168 | <pre><code class="bash"> |
||
| 169 | postmap /etc/postfix/relay |
||
| 170 | 18 | Patrice Nadeau | </code></pre> |