🟢 📩 OVH Stalwart Mail Server yannig.net
Stalwart Mail Server est une solution open source conçue pour simplifier l’auto-hébergement des serveurs de mail, en mettant l’accent sur la sécurité et la confidentialité. Écrit en Rust, il offre une alternative moderne aux logiciels de serveurs de mail existants, souvent complexes et obsolètes.
Stalwart Mail Server
- Stalwart Mail Server- Linux
- Stalwart - Serveur de Messagerie et de Collaboration Tout-en-un : Présentation (1/2)
- Stalwart - Serveur de Messagerie et de Collaboration Tout-en-un : Installation avec Docker (2/2)
Exigences :
- Un VPS avec un port 25 ouvert : OVH
- IPV6: 2001:41d0:305:2100::c1c
- IPV4: 51.38.37.240
- IPV6: 2001:41d0:305:2100::c1c
- Un nom de domaine enregistré : yannig.net
- Domaine mail: mail.yannig.net
OVH domaine yannig.net
Enregistrements DNS
Avant modifications
1
2
3
4
5
6
7
8
9
$TTL 3600
@ IN SOA dns14.ovh.net. tech.ovh.net. (2076760362 86400 3600 3600000 60)
IN NS dns14.ovh.net.
IN NS ns14.ovh.net.
IN MX 1 mx1.mail.ovh.net.
IN MX 5 mx2.mail.ovh.net.
IN MX 100 mx3.mail.ovh.net.
IN A 51.38.37.240
IN TXT "v=spf1 include:mx.ovh.com -all"
Configuration DNS OVH basique domaine yannig.net
1
2
3
4
5
6
7
$TTL 3600
@ IN SOA dns14.ovh.net. tech.ovh.net. (2076760577 86400 3600 3600000 60)
IN NS dns14.ovh.net.
IN NS ns14.ovh.net.
IN A 51.38.37.240
IN AAAA 2001:41d0:305:2100::c1c
IN TXT "v=spf1 include:mx.ovh.com -all"
Reverse DNS
Network –> Adresses IP publiques
Outils
1
sudo apt install dnsutils
Vérification
1
2
dig -x 51.38.37.240 +short # --> yannig.net.
dig -x 2001:41d0:305:2100::c1c +short # --> yannig.net.
VPS
SMTP Port 25
Vérifier que le fournisseur d’accès internet ne bloque pas le trafic SMTP port TCP 25
Depuis un poste externe :
1
sudo nmap -sS -p25 51.38.37.240
1
2
3
4
5
6
7
8
Starting Nmap 7.99 ( https://nmap.org ) at 2026-04-22 14:30 +0200
Nmap scan report for yannig.net (51.38.37.240)
Host is up (0.013s latency).
PORT STATE SERVICE
25/tcp open smtp
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
ACME.sh
Création des certificats SSL Let’s encrypt via Acme
1
2
3
4
5
6
# Git
git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
# Installation sans crontab --force
./acme.sh --install --force
Se reconnecter pour prise en charge
Les clé OVH
1
2
export OVH_AK="wxxxxxxxxxxxxxxxx"
export OVH_AS="yxxxxxxxxxxxxxxxxxxxxxxx"
Créer les certificats
1
acme.sh --dns dns_ovh --server letsencrypt --issue --keylength ec-384 -d 'yannig.net' -d '*.yannig.net'
Ouvrir le lien généré pour valider l’authentification OVH
puis relancer la commande
1
acme.sh --dns dns_ovh --server letsencrypt --issue --keylength ec-384 -d 'yannig.net' -d '*.yannig.net'
Les certificats
1
2
3
4
[mar. 21 avril 2026 16:10:41 CEST] Your cert is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.cer
[mar. 21 avril 2026 16:10:41 CEST] Your cert key is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.key
[mar. 21 avril 2026 16:10:41 CEST] The intermediate CA cert is in: /home/yann/.acme.sh/yannig.net_ecc/ca.cer
[mar. 21 avril 2026 16:10:41 CEST] And the full-chain cert is in: /home/yann/.acme.sh/yannig.net_ecc/fullchain.cer
Installation des certificats
Droits dossier
1
2
sudo chown $USER:stalwart /etc/ssl/private/
sudo chmod 750 /etc/ssl/private/
Si vous utilisez acme.sh pour gérer vos certificats, vous pouvez simplement exécuter
1
2
3
4
acme.sh --ecc --install-cert -d 'yannig.net' \
--key-file /etc/ssl/private/privkey.pem \
--fullchain-file /etc/ssl/private/fullchain.pem \
--reloadcmd "sudo systemctl restart stalwart"
Mise à jour des certificats
Le VPS n’a pas crontab installé, on va utiliser systemd timer
Le fichier de service
1
sudo nano /etc/systemd/system/update-certificat.service
contenu
1
2
3
4
[Unit]
Description="Update certificat"
[Service]
ExecStart="/home/yann/.acme.sh"/acme.sh --cron --home "/home/yann/.acme.sh"
Le fichier minuteur
1
sudo nano /etc/systemd/system/update-certificat.timer
Exécution service tous les jours (lundi au dimanche) à 1h20
1
2
3
4
5
6
7
[Unit]
Description="Renouvellement certificat si date validité atteinte"
[Timer]
OnCalendar=Mon..Sun *-*-* 1:20:00
Unit=update-certificat.service
[Install]
WantedBy=multi-user.target
Activer le minuteur
1
sudo systemctl enable update-certificat.timer --now
Vérification
1
systemctl list-timers
Résultat
1
2
NEXT LEFT LAST PASSED UNIT ACTIVATES
Wed 2026-04-22 01:20:00 CEST 9h - - update-certificat.timer update-certificat.service
Tester la mise à jour des certificats
On va forcer (--force) la procédure et voir le résultat
1
"/home/yann/.acme.sh"/acme.sh --force --cron --home "/home/yann/.acme.sh"
Résultat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[mer. 22 avril 2026 15:29:27 CEST] ===Starting cron===
[mer. 22 avril 2026 15:29:27 CEST] Renewing: 'yannig.net'
[mer. 22 avril 2026 15:29:27 CEST] Renewing using Le_API=https://acme-v02.api.letsencrypt.org/directory
[mer. 22 avril 2026 15:29:28 CEST] Using CA: https://acme-v02.api.letsencrypt.org/directory
[mer. 22 avril 2026 15:29:28 CEST] Multi domain='DNS:yannig.net,DNS:*.yannig.net'
[mer. 22 avril 2026 15:29:31 CEST] Getting webroot for domain='yannig.net'
[mer. 22 avril 2026 15:29:31 CEST] Getting webroot for domain='*.yannig.net'
[mer. 22 avril 2026 15:29:32 CEST] yannig.net is already verified, skipping dns-01.
[mer. 22 avril 2026 15:29:32 CEST] *.yannig.net is already verified, skipping dns-01.
[mer. 22 avril 2026 15:29:32 CEST] Verification finished, beginning signing.
[mer. 22 avril 2026 15:29:32 CEST] Let's finalize the order.
[mer. 22 avril 2026 15:29:32 CEST] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/3261565761/503263123221'
[mer. 22 avril 2026 15:29:34 CEST] Downloading cert.
[mer. 22 avril 2026 15:29:34 CEST] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/06f1d2dce6d6abf103b51aeacd877777dced'
[mer. 22 avril 2026 15:29:34 CEST] Cert success.
-----BEGIN CERTIFICATE-----
MIIDqzCCAzKgAwIBAgISBvHS3ObWq/EDtRrqzYd3d9ztMAoGCCqGSM49BAMDMDIx
................................................................
wlGN9+2d/jpHlXCDhVKto+dTRvSOSWpI4LLnyujefQ==
-----END CERTIFICATE-----
[mer. 22 avril 2026 15:29:34 CEST] Your cert is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.cer
[mer. 22 avril 2026 15:29:34 CEST] Your cert key is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.key
[mer. 22 avril 2026 15:29:34 CEST] The intermediate CA cert is in: /home/yann/.acme.sh/yannig.net_ecc/ca.cer
[mer. 22 avril 2026 15:29:34 CEST] And the full-chain cert is in: /home/yann/.acme.sh/yannig.net_ecc/fullchain.cer
[mer. 22 avril 2026 15:29:35 CEST] Installing key to: /etc/ssl/private/privkey.pem
[mer. 22 avril 2026 15:29:35 CEST] Installing full chain to: /etc/ssl/private/fullchain.pem
[mer. 22 avril 2026 15:29:35 CEST] Running reload cmd: sudo systemctl restart stalwart
[mer. 22 avril 2026 15:29:36 CEST] Reload successful
[mer. 22 avril 2026 15:29:36 CEST] ===End cron===
Les certificats ont été mis à jour et installés dans le dossier /etc/ssl/private/ puis le service stalwart est redémarré.
Parefeu
Ports essentiels à maintenir ouverts :
- Port 25 (SMTP) : Pour la réception d’e-mails d’autres serveurs de messagerie.
- Port 465 (SMTPS) : Recommandé pour l’envoi sécurisé d’e-mails sortants des clients utilisateurs avec TLS implicite. À privilégier par rapport au port 587.•
- Port 993 (IMAPS) : Pour l’accès sécurisé aux e-mails via les clients IMAP avec TLS implicite.
- Port 443 (HTTPS) : Pour l’administration web, JMAP, l’API REST, OAuth, le provisionnement de certificats TLS (ACME) et d’autres services web sécurisés.
Ports non essentiels à désactiver si non utilisés :
- Port 587 (SMTP Submission) : Si tous vos clients utilisent le port 465, ce port peut être désactivé.
- Port 143 (IMAP4) : Le port IMAP standard sans chiffrement. Il devrait généralement être désactivé au profit du port 993 (IMAPS).
- Port 4190 (ManageSieve) : À garder ouvert uniquement si vos utilisateurs gèrent activement des scripts Sieve.
- Port 110 (POP3) et Port 995 (POP3S) : POP3 est largement obsolète au profit d’IMAP. Désactivez-les sauf en cas de besoin spécifique.
- Port 8080 (HTTP) : Principalement fourni pour la configuration initiale. Il est fortement recommandé de désactiver ce port après la configuration pour prévenir les accès non authentifiés et non chiffrés.
Installation Debian / Ubuntu
1
sudo apt install ufw
Les règles à ajouter pour le serveur de messagerie
1
2
sudo ufw allow 53240 # ssh
sudo ufw allow 443
Activer le parefeu
1
sudo ufw enable
1
2
3
4
# Ouvrir les ports 25,465 et 993 pour le serveur messagerie
sudo ufw allow 25
sudo ufw allow 465
sudo ufw allow 993
Installer et configurer Stalwart
Stalwart est livré avec un script d’installation qui télécharge la dernière version, crée un compte de service dédié, installe le binaire sous les chemins Unix standard, écrit une unité de service et démarre le démon. L’accès root sur la machine cible et la connectivité HTTPS sortante sont nécessaires pour les étapes ci-dessous.
Ouvrez un terminal sur l’hôte cible et récupérez le script d’installation en mode utilisateur (PAS root):
1
curl --proto '=https' --tlsv1.2 -sSf https://get.stalw.art/install.sh -o install.sh
Exécutez le script comme root:
1
sudo sh install.sh
Aucun argument n’est requis. Le script suit la norme de hiérarchie du système de fichiers et place le binaire sous /usr/local/bin/stalwart, le fichier de configuration sous /etc/stalwart/config.json, variables d’environnement sous /etc/stalwart/stalwart.env, données d’application sous /var/lib/stalwart/et de journaux fichiers sous /var/log/stalwart/.
Un dédié stalwartUn compte de service est créé s’il n’existe pas déjà. Le script écrit alors l’unité de service appropriée (systemd, SysV init.d, ou launchden fonction du système d’exploitation), active le service au démarrage et le démarre immédiatement.
En utilisant les identifiants fournis, connectez-vous à votre Stalwart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
⏳ Downloading stalwart for x86_64-unknown-linux-gnu...
Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure
Warning: Not enforcing TLS v1.2, this is potentially less secure
📝 Writing env file at /etc/stalwart/stalwart.env...
🔐 Setting permissions...
🚀 Starting service...
Created symlink '/etc/systemd/system/multi-user.target.wants/stalwart.service' → '/etc/systemd/system/stalwart.service'.
🎉 Installation complete!
Stalwart is running in bootstrap mode. A temporary administrator
password was generated at startup and printed to the service logs.
👉 To find the password, inspect the service logs:
journalctl -u stalwart -n 200 | grep -A8 'bootstrap mode'
Or set STALWART_RECOVERY_ADMIN=admin:<password> in
/etc/stalwart/stalwart.env and restart the service to pin a credential.
Finish setup at: http://yannig.net:8080/admin
Le serveur n’a pas de carte graphique, on utilise le proxy ssh depuis un poste linux ayant les accès
1
ssh -L 9500:localhost:8080 -p 55240 -i ~/.ssh/vps-1780de45 yann@51.38.37.240
Ouvrir le lien http://localhost:9500/admin sur le poste appelant

Relever les information de connexion et redémarrer le service stalwart
1
sudo systemctl restart stalwart
Connexion sur le lien https://yannig.net/admin
Les certificats ne sont pas au bon endroits, il faut forcer la connexion
Se rendre dans settings
On copie le certificat /home/yann/.acme.sh/yannig.net_ecc/fullchain.cer et la clé /home/yann/.acme.sh/yannig.net_ecc/yannig.net.key

Lecture certificats par stalwart
on doit utiliser les ACLs
1
2
sudo apt install acl # si non installé
sudo setfacl -R -m u:stalwart:rX /etc/ssl/private/privkey.pem /etc/ssl/private/fullchain.pem
Vérification: sudo getfacl /etc/ssl/private/*.pem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
getfacl : suppression du premier « / » des noms de chemins absolus
# file: etc/ssl/private/fullchain.pem
# owner: yann
# group: yann
user::rw-
user:stalwart:r--
group::rw-
mask::rw-
other::r--
# file: etc/ssl/private/privkey.pem
# owner: yann
# group: yann
user::rw-
user:stalwart:r--
group::---
mask::r--
other::---
“Settings” –> “TLS” –> “Certificates”
Vérifications Management –> Domains
Domain yannig.net

Créer un compte de messagerie
Nous ajoutons un compte email.
Allez à Management > Directory > Accounts

Thunderbird
Stalwart n’a pas d’email web, donc nous devons utiliser un client de messagerie externe.
Aller dans Paramètre des comptes et ajouter






Test messagerie

Maintenant que nous avons connecté notre Stalwart à Thunderbird, laissez-nous tester notre e-mail.
Allez au testeur de courrier https://www.mail-tester.com/.
Je vais envoyer un e-mail de test.

⚠️ Il faut saisir un sujet et du contenu

Ajouter domaine yick.eu
Certificats TLS
On a une création de certificats existante pour le domaine yannig.net, regénérer les certificats en ajoutant le domaine yick.eu
Les clé OVH
1
2
export OVH_AK="wxxxxxxxxxxxxxxxx"
export OVH_AS="yxxxxxxxxxxxxxxxxxxxxxxx"
Générer les certificats des domaines
1
acme.sh --dns dns_ovh --server letsencrypt --issue --keylength ec-384 -d 'yannig.net' -d '*.yannig.net' -d 'yick.eu' -d 'cinay.eu'
Les certificats
1
2
3
4
[jeu. 23 avril 2026 16:40:34 CEST] Your cert is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.cer
[jeu. 23 avril 2026 16:40:34 CEST] Your cert key is in: /home/yann/.acme.sh/yannig.net_ecc/yannig.net.key
[jeu. 23 avril 2026 16:40:34 CEST] The intermediate CA cert is in: /home/yann/.acme.sh/yannig.net_ecc/ca.cer
[jeu. 23 avril 2026 16:40:34 CEST] And the full-chain cert is in: /home/yann/.acme.sh/yannig.net_ecc/fullchain.cer
Installer les certificats et redémarrer le service stalwart
1
2
3
4
acme.sh --ecc --install-cert -d 'yannig.net' \
--key-file /etc/ssl/private/privkey.pem \
--fullchain-file /etc/ssl/private/fullchain.pem \
--reloadcmd "sudo systemctl restart stalwart"
Résultat commande ci-dessus
1
2
3
4
[jeu. 23 avril 2026 16:50:28 CEST] Installing key to: /etc/ssl/private/privkey.pem
[jeu. 23 avril 2026 16:50:28 CEST] Installing full chain to: /etc/ssl/private/fullchain.pem
[jeu. 23 avril 2026 16:50:28 CEST] Running reload cmd: sudo systemctl restart stalwart
[jeu. 23 avril 2026 16:50:30 CEST] Reload successful
Stalwart domaine yick.eu
Connectez-vous au panneau d’administration de Stalwart avec un compte administrateur.
Dans la section Management –> Domains –> Domains
Ajouter un domaine, Cliquer sur “Create domain”





Créer un utilisateur yick@yick.eu
Ajout utilisateur à Thunderbird

Test https://www.mail-tester.com

Ajouter domaine cinay.eu
Certificats TLS
On a une création de certificats existante pour le domaine yannig.net, regénérer les certificats en ajoutant le domaine cinay.eu
Les clé OVH
1
2
export OVH_AK="wxxxxxxxxxxxxxxxx"
export OVH_AS="yxxxxxxxxxxxxxxxxxxxxxxx"
Générer les certificats des domaines
1
acme.sh --dns dns_ovh --server letsencrypt --issue --keylength ec-384 -d 'yannig.net' -d '*.yannig.net' -d 'yick.eu' -d 'cinay.eu'
Installer les certificats et redémarrer le service stalwart
1
2
3
4
acme.sh --ecc --install-cert -d 'yannig.net' \
--key-file /etc/ssl/private/privkey.pem \
--fullchain-file /etc/ssl/private/fullchain.pem \
--reloadcmd "sudo systemctl restart stalwart"
Stalwart domaine cinay.eu
Connectez-vous au panneau d’administration de Stalwart avec un compte administrateur.
Dans la section Management –> Domains –> Domains
Ajouter un domaine, Cliquer sur “Create domain”






“View Zone File”

Les enregistrements du domaine cinay.eu sont mises à jour automatiquement par API DNS OVH
Créer un compte de messagerie “yani”
Nous ajoutons un compte email.
Allez à Management > Directory > Accounts
Cliquer sur “Create user”

























