Postfix » Historique » Version 34
Patrice Nadeau, 2015-08-10 14:06
| 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 | 29 | Patrice Nadeau | smtpd_recipient_restrictions = reject_rbl_client zen.spamhaus.org, reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org |
| 90 | </code></pre> |
||
| 91 | |||
| 92 | Relire la configuration |
||
| 93 | <pre><code class="bash"> |
||
| 94 | systemctl reload postix |
||
| 95 | 7 | Patrice Nadeau | </code></pre> |
| 96 | 6 | Patrice Nadeau | |
| 97 | 13 | Patrice Nadeau | h3. Alias |
| 98 | 10 | Patrice Nadeau | |
| 99 | 20 | Patrice Nadeau | Usagers systèmes devant être redirigé vers des comptes utilisateurs réel. |
| 100 | 10 | Patrice Nadeau | |
| 101 | 20 | Patrice Nadeau | Les ajouter dans le fichier _/etc/postfix/aliases_ |
| 102 | |||
| 103 | Lancer la commande _newaliases_ pour activer les changements. |
||
| 104 | |||
| 105 | 10 | Patrice Nadeau | |
| 106 | 13 | Patrice Nadeau | h3. Options courantes |
| 107 | 11 | Patrice Nadeau | |
| 108 | Dans _main.cf_ : |
||
| 109 | * *message_size_limit* : |
||
| 110 | |||
| 111 | 13 | Patrice Nadeau | h2. Entrés DNS |
| 112 | 6 | Patrice Nadeau | |
| 113 | 13 | Patrice Nadeau | h3. A record |
| 114 | 6 | Patrice Nadeau | |
| 115 | 13 | Patrice Nadeau | h3. MX record |
| 116 | 6 | Patrice Nadeau | |
| 117 | 13 | Patrice Nadeau | h3. SPF record |
| 118 | 6 | Patrice Nadeau | |
| 119 | 2 | Patrice Nadeau | Ajouter ceux du fournisseur internet (le fournisseur et et tous ses abonnées pourront "se faire passer" pour le domaine) |
| 120 | |||
| 121 | 13 | Patrice Nadeau | h2. Test |
| 122 | 2 | Patrice Nadeau | |
| 123 | 13 | Patrice Nadeau | h3. SPF |
| 124 | 3 | Patrice Nadeau | |
| 125 | Envoyer un courriel à une des adresses suivantes : |
||
| 126 | * check-auth@verifier.port25.com |
||
| 127 | 6 | Patrice Nadeau | * check-auth2@verifier.port25.com |
| 128 | 8 | Patrice Nadeau | |
| 129 | 19 | Patrice Nadeau | h3. TLS |
| 130 | |||
| 131 | Site internet pour vérifier la configuration TLS : |
||
| 132 | * Envoie : https://www.checktls.com/perl/TestSender.pl |
||
| 133 | * Réception : https://www.checktls.com/perl/TestReceiver.pl |
||
| 134 | |||
| 135 | 31 | Patrice Nadeau | h4. De Postfix vers un autre serveur SMTP |
| 136 | |||
| 137 | Dans le fichier_/erc/postfix/main.cf_ |
||
| 138 | <pre><code class="bash"> |
||
| 139 | |||
| 140 | </code></pre> |
||
| 141 | 30 | Patrice Nadeau | |
| 142 | h4. D'un client vers Postfix |
||
| 143 | |||
| 144 | 32 | Patrice Nadeau | Dans le fichier _/etc/postfix/main./cf_ |
| 145 | <pre><code class="bash"> |
||
| 146 | smtpd_tls_security_level = may |
||
| 147 | </code></pre> |
||
| 148 | |||
| 149 | 34 | Patrice Nadeau | Les valeurs suivante peuvent être utiliser |
| 150 | 32 | Patrice Nadeau | * *none* : TLs n'est pas utilisé |
| 151 | 1 | Patrice Nadeau | * *may* : TLS est utilisé annoncé au client distant mais n'est pas obligatoire (Opportunistic) |
| 152 | 34 | Patrice Nadeau | * *encrypt* : TLS DOIT être utilisé. Selon le "RFC 2487":http://tools.ietf.org/html/rfc2487, cette option ne devrait pas être utilisée avec des serveur publiques. |
| 153 | > Voir #54 |
||
| 154 | 32 | Patrice Nadeau | |
| 155 | 13 | Patrice Nadeau | h2. Dépannage |
| 156 | 8 | Patrice Nadeau | |
| 157 | La commande *mailq* permet de voir les requêtes en attentes. |
||
| 158 | 18 | Patrice Nadeau | |
| 159 | 23 | Patrice Nadeau | h3. Messages ne s'envoient pas |
| 160 | |||
| 161 | 26 | Patrice Nadeau | > Vu sur une nouvelle installation openSUSE 13.2 |
| 162 | |||
| 163 | 27 | Patrice Nadeau | La commande _postqueue -p_ affiche : *address resolver failure* |
| 164 | |||
| 165 | 26 | Patrice Nadeau | Modififer le fichier */etc/postfix/main.cf* |
| 166 | <pre><code class="bash"> |
||
| 167 | disable_dns_lookups = yes |
||
| 168 | </code></pre> |
||
| 169 | 25 | Patrice Nadeau | |
| 170 | 23 | Patrice Nadeau | h3. Messages *error: open database /etc/postfix/relay.db: No such file or directory* |
| 171 | |||
| 172 | > Vu sur une nouvelle installation openSUSE 13.2 |
||
| 173 | |||
| 174 | Exécuter la commande |
||
| 175 | <pre><code class="bash"> |
||
| 176 | postmap /etc/postfix/relay |
||
| 177 | 18 | Patrice Nadeau | </code></pre> |