tech:notes_postfix
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_postfix [2026/02/16 15:56] – Jean-Baptiste | tech:notes_postfix [2026/06/29 14:11] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes Postfix | ||
| + | |||
| + | Voir | ||
| + | * http:// | ||
| + | * [Mettre en place une limite sur le nombre de mails envoyés par IP sur Postfix](https:// | ||
| + | * Relay SMTP : https:// | ||
| + | |||
| + | |||
| + | Source : http:// | ||
| + | |||
| + | Voir la file d' | ||
| + | |||
| + | ~~~bash | ||
| + | mailq | ||
| + | ~~~ | ||
| + | |||
| + | Vérif syntax | ||
| + | ~~~bash | ||
| + | postfix check | ||
| + | ~~~ | ||
| + | |||
| + | Sortir les mails de la file attentes (essaye de les ré-envoyer) | ||
| + | ~~~bash | ||
| + | postfix flush | ||
| + | ~~~ | ||
| + | |||
| + | Effacer tous les courriels de la file d' | ||
| + | ~~~bash | ||
| + | postsuper -d ALL | ||
| + | ~~~ | ||
| + | |||
| + | Effacer tous les mails de la " | ||
| + | ~~~bash | ||
| + | postsuper -d ALL deferred | ||
| + | ~~~ | ||
| + | |||
| + | Source : http:// | ||
| + | |||
| + | `postfix-delete.pl` | ||
| + | ~~~perl | ||
| + | # | ||
| + | |||
| + | $REGEXP = shift || die "no email-adress given (regexp-style, | ||
| + | |||
| + | @data = qx</ | ||
| + | for (@data) { | ||
| + | if (/ | ||
| + | | ||
| + | } | ||
| + | if($queue_id) { | ||
| + | if (/ | ||
| + | $Q{$queue_id} = 1; | ||
| + | $queue_id = ""; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # | ||
| + | open(POSTSUPER," | ||
| + | |||
| + | foreach (keys %Q) { | ||
| + | print POSTSUPER " | ||
| + | }; | ||
| + | close(POSTSUPER); | ||
| + | ~~~ | ||
| + | |||
| + | Efface de la file d' | ||
| + | ~~~bash | ||
| + | ./ | ||
| + | ~~~ | ||
| + | |||
| + | Efface tous les courriel contenant le mot " | ||
| + | ~~~bash | ||
| + | ./ | ||
| + | ~~~ | ||
| + | |||
| + | http:// | ||
| + | |||
| + | Supprimer un message de la file d' | ||
| + | ~~~bash | ||
| + | postsuper -d E795D42A16 | ||
| + | ~~~ | ||
| + | |||
| + | Mettre un messages en attente (hold) : | ||
| + | ~~~bash | ||
| + | postsuper -h E795D42A16 | ||
| + | ~~~ | ||
| + | |||
| + | Remettre en file d' | ||
| + | ~~~bash | ||
| + | postsuper -r E795D42A16 | ||
| + | ~~~ | ||
| + | |||
| + | Afficher le contenu d'un message : | ||
| + | ~~~bash | ||
| + | postcat -q E795D42A16 | ||
| + | ~~~ | ||
| + | |||
| + | Pour forcer l' | ||
| + | |||
| + | Ajouter cette ligne dans le fichier main.cf : | ||
| + | |||
| + | `main.cf` | ||
| + | ~~~ini | ||
| + | fast_flush_domains = $relay_domains mondomain.fr | ||
| + | ~~~ | ||
| + | |||
| + | Puis : | ||
| + | ~~~bash | ||
| + | postqueue -s mondomain.fr | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autre | ||
| + | |||
| + | ### Exemple de config | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | plop: plop@localhost.acme.fr | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | postalias / | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | myorigin = localhost.acme.fr | ||
| + | mydestination = $myhostname, | ||
| + | transport_maps = hash:/ | ||
| + | |||
| + | mydomain = acme.fr | ||
| + | myhostname = myhostname | ||
| + | relayhost = 192.168.6.28 | ||
| + | default_transport = smtp | ||
| + | relay_transport = smtp | ||
| + | # | ||
| + | inet_interfaces = loopback-only | ||
| + | inet_protocols = ipv4 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | systemctl reload postfix | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | laposte.fr : | ||
| + | acme.fr : | ||
| + | localhost.acme.fr local: | ||
| + | * error: domaine non autorise | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | postmap / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Conf sur Debian | ||
| + | |||
| + | Serveur de référence | ||
| + | ~~~bash | ||
| + | apt-get install debconf-utils | ||
| + | debconf-get-selections | ||
| + | ~~~ | ||
| + | |||
| + | Nouveau serveur | ||
| + | ~~~bash | ||
| + | LANG=C dpkg-reconfigure postfix | ||
| + | ~~~ | ||
| + | |||
| + | Serveur de référence | ||
| + | ~~~bash | ||
| + | postconf -n | ||
| + | ~~~ | ||
| + | |||
| + | Nouveau serveur | ||
| + | ~~~bash | ||
| + | # Exemple | ||
| + | postconf -e relayhost= | ||
| + | postconf -e myorigin=/ | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | FQDN ici `/ | ||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ### Pb FQDN | ||
| + | |||
| + | Erreur : | ||
| + | * Helo command rejected: need fully-qualified hostname; | ||
| + | * Sender address rejected: Domain not found (in reply to RCPT TO command)) | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | Helo command rejected: need fully-qualified hostname; | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | smtp.acme.fr | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | postconf -e myhostname=smtp.belaris.fr | ||
| + | postfix check | ||
| + | service postfix reload | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Test Question | ||
| + | |||
| + | What is the function of this Postfix configuration ? | ||
| + | |||
| + | ~~~ini | ||
| + | relayhost = | ||
| + | relay_transport = relay | ||
| + | relay_domains = static:ALL | ||
| + | smtpd_end_of_data_restrictions = check_client_access static: | ||
| + | ~~~ | ||
| + | |||
| + | |||
