« Info:: apsi.net: setup-ovh2-relay » : différence entre les versions

De wiki_pcwiki2
Aller à la navigationAller à la recherche
Aucun résumé des modifications
Contenu remplacé par « KEYWORDS: MAIL, SERVER, APSI.NET, OVH1, MAIL.APSI.NET, OVH2, BACKUP.APSI.NET '''Le 02/01/2026:''' cf: ovh1:/root/IA/MAIL.API.NET/setup-ovh2-relay.sh »
 
Ligne 2 : Ligne 2 :


  '''Le 02/01/2026:'''
  '''Le 02/01/2026:'''
=============================================================================== Configuration d’ovh2 comme serveur relay de backup ===============================================================================
cf: ovh1:/root/IA/MAIL.API.NET/setup-ovh2-relay.sh
 
[INFO] Configuration : - Hostname: backup.apsi.net - IP: 51.68.207.177 - Serveur principal: mail.apsi.net - Domaines relay: apsi.net, voilou.nl
 
[INFO] Étape 1/7 : Installation de Postfix Get:1 file:/etc/apt/mirrors/debian.list Mirrorlist [30 B] Get:2 file:/etc/apt/mirrors/debian-security.list Mirrorlist [39 B] Hit:3 https://deb.debian.org/debian bookworm InRelease<br />
Hit:4 https://deb.debian.org/debian bookworm-updates InRelease<br />
Hit:5 https://deb.debian.org/debian bookworm-backports InRelease<br />
Hit:6 https://deb.debian.org/debian-security bookworm-security InRelease<br />
Hit:7 https://deb.nodesource.com/node_20.x nodistro InRelease<br />
Hit:8 https://packages.sury.org/php bookworm InRelease<br />
Reading package lists… Done<br />
Building dependency tree… Done Reading state information… Done 163 packages can be upgraded. Run ‘apt list –upgradable’ to see them. Reading package lists… Done Building dependency tree… Done Reading state information… Done mailutils is already the newest version (1:3.15-4). The following packages were automatically installed and are no longer required: libavahi-core7 libdaemon0 libnss-mdns mate-user-share-common Use ‘apt autoremove’ to remove them. Suggested packages: procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin | dovecot-common libsasl2-modules | dovecot-common postfix-cdb postfix-mta-sts-resolver ufw postfix-doc The following packages will be REMOVED: msmtp-mta The following NEW packages will be installed: postfix 0 upgraded, 1 newly installed, 1 to remove and 163 not upgraded. Need to get 0 B/1510 kB of archives. After this operation, 3986 kB of additional disk space will be used. Preconfiguring packages … dpkg: msmtp-mta: dependency problems, but removing anyway as you requested: bsd-mailx depends on default-mta | mail-transport-agent; however: Package default-mta is not installed. Package exim4-daemon-light which provides default-mta is not installed. Package mail-transport-agent is not installed. Package msmtp-mta which provides mail-transport-agent is to be removed. Package exim4-daemon-light which provides mail-transport-agent is not installed .
 
(Reading database … 255917 files and directories currently installed.) Removing msmtp-mta (1.8.23-1) … Selecting previously unselected package postfix. (Reading database … 255903 files and directories currently installed.) Preparing to unpack …/postfix_3.7.11-0+deb12u1_amd64.deb … Unpacking postfix (3.7.11-0+deb12u1) … Setting up postfix (3.7.11-0+deb12u1) … Adding group <code>postfix' (GID 133) ... Done. Adding system user</code>postfix’ (UID 123) … Adding new user <code>postfix' (UID 123) with group</code>postfix’ … Not creating home directory <code>/var/spool/postfix'. Creating /etc/postfix/dynamicmaps.cf Adding group</code>postdrop’ (GID 134) … Done. setting myhostname: ovh2 setting alias maps setting alias database setting myorigin setting destinations: $myhostname, ovh2.pcstreet.org, ovh2, localhost.localdomain , localhost setting relayhost: setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 setting mailbox_size_limit: 0 setting recipient_delimiter: + setting inet_interfaces: all setting inet_protocols: all WARNING: /etc/aliases exists, but does not have a root alias.
 
Postfix (main.cf) is now set up with a default configuration. If you need to make changes, edit /etc/postfix/main.cf (and others) as needed. To view Postfix configuration values, see postconf(1).
 
After modifying main.cf, be sure to run ‘systemctl reload postfix’.
 
Running newaliases Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /li b/systemd/system/postfix.service. Processing triggers for man-db (2.11.2-2) … Processing triggers for rsyslog (8.2302.0-1+deb12u1) … Scanning processes…<br />
Scanning processor microcode…<br />
Scanning linux images…
 
Running kernel seems to be up-to-date.
 
The processor microcode seems to be up-to-date.
 
No services need to be restarted.
 
No containers need to be restarted.
 
No user sessions are running outdated binaries.
 
No VM guests are running outdated hypervisor (qemu) binaries on this host. [INFO] Étape 2/7 : Configuration du hostname [INFO] Étape 3/7 : Configuration de Postfix [INFO] Configuration Postfix créée [INFO] Étape 4/7 : Configuration du firewall [INFO] Ouverture du port 25 (SMTP) [INFO] Mise à jour du script firewall dans /etc/iptables.d.new [INFO] Étape 5/7 : Configuration de Fail2ban [INFO] Fail2ban actif, ajout des jails Postfix [INFO] Fail2ban configuré [INFO] Étape 6/7 : Redémarrage de Postfix Synchronizing state of postfix.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable postfix [INFO] Étape 7/7 : Tests et vérification [INFO] ✓ Postfix écoute sur le port 25 [INFO] ✓ Configuration Postfix valide [INFO] Configuration relay : myhostname = backup.apsi.net myorigin = $myhostname relay_domains = apsi.net, voilou.nl relay_transport = smtp:[mail.apsi.net]:25 smtpd_banner = $myhostname ESMTP $mail_name (Backup MX)
 
=============================================================================== [INFO] Configuration terminée avec succès ! ===============================================================================
 
📧 Serveur relay de backup configuré - Hostname: backup.apsi.net - Domaines relay: apsi.net, voilou.nl - Serveur principal: mail.apsi.net
 
⚠️ ACTIONS REQUISES :
 
<ol style="list-style-type: decimal;">
<li><p>Configurer les enregistrements DNS : backup.apsi.net. A 51.68.207.177 apsi.net. MX 10 mail.apsi.net. apsi.net. MX 20 backup.apsi.net. voilou.nl. MX 10 mail.apsi.net. voilou.nl. MX 20 backup.apsi.net.</p></li>
<li><p>Tester la configuration : # Envoyer un email de test echo ‘Test relay’ | mail -s ‘Test’ pchevalier@apsi.net</p>
<span id="vérifier-les-logs"></span>
= Vérifier les logs =
 
<p>tail -f /var/log/postfix.log</p>
<span id="voir-la-queue"></span>
= Voir la queue =
 
<p>postqueue -p</p></li>
<li><p>Simuler une panne d’ovh1 : # Sur ovh1: systemctl stop postfix # Envoyer un email, il sera mis en queue sur ovh2 # Sur ovh1: systemctl start postfix # Sur ovh2: postqueue -f (forcer la livraison)</p></li>
<li><p>Monitoring de la queue : watch -n 60 ‘postqueue -p | tail -1’</p></li></ol>
 
[INFO] Logs disponibles dans /var/log/postfix.log [INFO] Création du script de monitoring… [INFO] ✓ Script de monitoring créé: /usr/local/bin/check-mail-queue.sh
 
Pour monitorer la queue: /usr/local/bin/check-mail-queue.sh
 
=============================================================================== root@ovh2:~#

Dernière version du 2 janvier 2026 à 10:14

KEYWORDS: MAIL, SERVER, APSI.NET, OVH1, MAIL.APSI.NET, OVH2, BACKUP.APSI.NET

Le 02/01/2026:
cf: ovh1:/root/IA/MAIL.API.NET/setup-ovh2-relay.sh