Configuration Serveur · 10 min read · Sep 22, 2025
Configuration parfaite de multiserveur ISPConfig sur Ubuntu 20.04 et Debian 10 - Page 3

4 Installation du premier serveur de messagerie
Connectez-vous en tant que root ou exécutez
su -pour devenir utilisateur root sur votre serveur avant de continuer. IMPORTANT : Vous devez utiliser ‘su -‘ et non juste ‘su’, sinon votre variable PATH est mal définie par Debian.
4.1 Configurer le nom d’hôte
Le nom d’hôte de votre serveur doit être un sous-domaine comme “mx1.example.com”. N’utilisez pas un nom de domaine sans partie sous-domaine comme “example.com” comme nom d’hôte car cela causera des problèmes plus tard avec votre configuration de messagerie. Tout d’abord, vous devez vérifier le nom d’hôte dans /etc/hosts et le changer si nécessaire. La ligne doit être : “Adresse IP - espace - nom d’hôte complet incluant le domaine - espace - partie sous-domaine”. Pour notre nom d’hôte mx1.example.com, le fichier doit ressembler à ceci :
nano /etc/hosts127.0.0.1 localhost.localdomain localhost
# Cette ligne doit être changée sur chaque nœud au nom de serveur correct :
127.0.1.1 mx1.example.com mx1
# Ces lignes sont les mêmes sur chaque nœud :
10.0.64.12 panel.example.com panel
10.0.64.13 web01.example.com web01
10.0.64.14 mx1.example.com mx1
10.0.64.15 mx2.example.com mx2
10.0.64.16 ns1.example.com ns1
10.0.64.17 ns2.example.com ns2
10.0.64.18 webmail.example.com webmail
# Les lignes suivantes sont souhaitables pour les hôtes compatibles IPv6
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allroutersComme vous pouvez le voir, nous avons également ajouté les noms d’hôte de nos autres serveurs afin qu’ils puissent communiquer sur le réseau interne plus tard.
Ensuite, éditez le fichier /etc/hostname :
nano /etc/hostnameIl doit contenir uniquement la partie sous-domaine, dans notre cas :
mx1Enfin, redémarrez le serveur pour appliquer le changement :
systemctl rebootReconnectez-vous et vérifiez si le nom d’hôte est correct maintenant avec ces commandes :
hostname
hostname -fLa sortie doit ressembler à ceci :
root@mx1:~$ hostname
mx1
root@mx1:~$ hostname -f
mx1.example.com4.2 Installation d’ISPConfig
Maintenant, nous pouvons exécuter l’autoinstalleur pour tous les packages et ISPConfig :
wget -O - https://get.ispconfig.org | sh -s -- --no-dns --no-roundcube --no-mailman --use-php=system --use-unbound --interactiveAprès un certain temps, vous verrez :
WARNING! This script will reconfigure your complete server!
It should be run on a freshly installed server and all current configuration that you have done will most likely be lost!
Type 'yes' if you really want to continue:Répondez “yes” et appuyez sur entrée. L’installateur va maintenant commencer.
Lorsque l’installation et la configuration des packages sont terminées, le mot de passe root pour MySQL sur mx1 sera affiché. Notez-le (avec le nom de serveur, pour éviter toute confusion plus tard).
Maintenant, nous devrons répondre à quelques questions car nous utilisons le mode interactif. Cela est nécessaire car ce serveur sera ajouté à votre configuration multiserveur.
[INFO] Installing ISPConfig3.
[INFO] Your MySQL root password is: kl3994aMsfkkeE
--------------------------------------------------------------------------------
_____ ___________ _____ __ _ ____
|_ _| ___| ___ \ / __ \ / _(_) /__ \
| | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ /
| | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ |
|_| |_|\__/ / | | \__/\ (_) | | | | | | (_| | ___\ \
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/
__/ |
|___/
--------------------------------------------------------------------------------
>> Initial configuration
Operating System: Debian 10.0 (Buster) or compatible
Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with .
Tap in "quit" (without the quotes) to stop the installer.
Select language (en,de) [en]: <-- Hit enter
Installation mode (standard,expert) [standard]: <-- expert
Full qualified hostname (FQDN) of the server, eg server1.domain.tld [mx1.example.com]: <-- Hit Enter
MySQL server hostname [localhost]: <-- Hit Enter
MySQL server port [3306]: <-- Hit Enter
MySQL root username [root]: <-- Hit Enter
MySQL root password []: <-- Enter the MySQL password the script just gave you
MySQL database to create [dbispconfig]: <-- Hit Enter
MySQL charset [utf8]: <-- Hit Enter
The next two questions are about the internal ISPConfig database user and password.
It is recommended to accept the defaults which are 'ispconfig' as username and a random password.
If you use a different password, use only numbers and chars for the password.
ISPConfig mysql database username [ispconfig]: <-- Hit Enter
ISPConfig mysql database password [aakl203920459853sak20284204]: <-- Hit Enter
Shall this server join an existing ISPConfig multiserver setup (y,n) [n]: <-- y
MySQL master server hostname []: <-- panel.example.com
MySQL master server port []: <-- Hit Enter
MySQL master server root username [root]: <-- Hit Enter
MySQL master server root password []: <-- the password you gave the external root user on the master server.
MySQL master server database name [dbispconfig]: <-- Hit Enter
Adding ISPConfig server record to database.
Configure Mail (y,n) [y]: <-- Hit enter
Configuring Postgrey
Configuring Postfix
Generating a RSA private key
......................................................................++++
....................++++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- Hit enter
State or Province Name (full name) [Some-State]: <-- Hit enter
Locality Name (eg, city) []: <-- Hit enter
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Hit enter
Organizational Unit Name (eg, section) []: <-- Hit enter
Common Name (e.g. server FQDN or YOUR name) []: <-- Hit enter
Email Address []: <-- Hit enter
[WARN] autodetect for Mailman failed
Force configure Mailman (y,n) [n]: <-- Hit enter
Skipping Mailman
Configuring Dovecot
Creating new DHParams file, this takes several minutes. Do not interrupt the script.
Configuring Spamassassin
[WARN] autodetect for Amavisd failed
Force configure Amavisd (y,n) [n]: <-- Hit enter
Skipping Amavisd
Configuring Rspamd
Configuring Getmail
Configuring Jailkit
Configuring Pureftpd
Configure DNS Server (y,n) [y]: <-- n
The Web Server option has to be enabled when you want run a web server or when this node shall host the ISPConfig interface.
Configure Web Server (y,n) [y]: <-- Hit enter
Configuring Apache
Configuring vlogger
[WARN] autodetect for OpenVZ failed
Force configure OpenVZ (y,n) [n]: <-- Hit Enter
Skipping OpenVZ
Configure Firewall Server (y,n) [y]: <-- Hit Enter
Configuring Ubuntu Firewall
[WARN] autodetect for Metronome XMPP Server failed
Force configure Metronome XMPP Server (y,n) [n]: <-- Hit Enter
Skipping Metronome XMPP Server
Configuring Fail2ban
Install ISPConfig Web Interface (y,n) [n]: <-- Hit Enter
Do you want to create SSL certs for your server? (y,n) [y]: <-- Hit Enter
Checking / creating certificate for mx1.example.com
Using certificate path /etc/letsencrypt/live/mx1.example.com
Using apache for certificate validation
Symlink ISPConfig SSL certs to Postfix? (y,n) [y]: <-- Hit Enter
Symlink ISPConfig SSL certs to Pure-FTPd? Creating dhparam file may take some time. (y,n) [y]: <-- Hit Enter
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
......................+...........................................+...............
Configuring Apps vhost
Configuring DBServer
Installing ISPConfig crontab
no crontab for getmail
Detect IP addresses
Restarting services ...
Installation completed.
[INFO] Adding php versions to ISPConfig.
[INFO] Checking all services are running.
[INFO] mysql: OK
[INFO] clamav-daemon: OK
[INFO] postfix: OK
[INFO] bind9: OK
[INFO] pureftpd: OK
[INFO] apache2: OK
[INFO] rspamd: OK
[INFO] redis-server: OK
[INFO] dovecot: OK
[INFO] Installation ready.
[INFO] Your MySQL root password is: kl3994aMsfkkeE
[INFO] Warning: Please delete the log files in /tmp/ispconfig-ai/var/log/setup-* once you don't need them anymore because they contain your passwords! 4.3 Configuration de la réplication pour Dovecot
Nous allons utiliser dsync pour synchroniser les e-mails entre mx1 et mx2, pour redondance.
Les paramètres personnalisés pour dovecot doivent être stockés dans /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.master afin que vous ne les perdiez pas lors de la mise à jour d’ISPConfig.
nano /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.masterMettez ce qui suit :
protocol imap {
mail_plugins = $mail_plugins quota imap_quota notify replication
}
protocol pop3 {
mail_plugins = $mail_plugins quota notify replication
}
protocol lda {
mail_plugins = $mail_plugins sieve quota notify replication
}
protocol lmtp {
mail_plugins = $mail_plugins sieve quota notify replication
}
doveadm_password = /(:&p-J:4e%?\@Q-;VSE#3Dmfm[fVK&r-mx1
doveadm_port = 12345
replication_max_conns = 50
ssl_client_ca_dir = /etc/ssl/certs
# Le processus de réplication doit être démarré au démarrage, afin qu'il puisse commencer à répliquer les utilisateurs immédiatement :
service replicator {
process_min_avail = 1
}
# Les processus de messagerie doivent avoir accès à la fifo de notification de réplication et au socket.
service aggregator {
fifo_listener replication-notify-fifo {
user = vmail
mode = 0666
}
unix_listener replication-notify {
user = vmail
mode = 0666
}
}
# Activer les commandes de réplication doveadm
service replicator {
unix_listener replicator-doveadm {
mode = 0666
}
}
# Créer un écouteur pour le serveur doveadm
service doveadm {
user = vmail
inet_listener {
port = 12345
ssl = yes
}
}
service config {
unix_listener config {
user = vmail
}
}
plugin {
mail_replica = tcps:mx2.example.com
}Remplacez doveadm_password par votre propre mot de passe - faites-en une chaîne longue et aléatoire pour des raisons de sécurité.
Remplacez
mail_replica = tcps:mx2.example.compar votre propre nom d’hôte de mx2.
Pour appliquer ces changements, copiez le fichier dans le dossier dovecot et redémarrez dovecot :
cp /usr/local/ispconfig/server/conf-custom/install/dovecot_custom.conf.master /etc/dovecot/conf.d/99-ispconfig-custom-config.conf
systemctl restart dovecot4.4 Configuration de la synchronisation pour Rspamd
Rspamd a une belle interface web. Nous allons configurer nos serveurs comme voisins afin que vous puissiez voir les paramètres, les statistiques et d’autres données dans un seul panneau.
nano /usr/local/ispconfig/server/conf-custom/install/rspamd_options.inc.masterAjoutez ces lignes :
# Configuration du modèle ISPConfig (doit être mise à jour s'il y a des changements)
# Adresses locales à ce serveur.
local_addrs = [
"127.0.0.0/8",
"::1",
];
# Cette liste est générée par ISPConfig, placez les adresses/réseaux personnalisés dans local_networks.inc.
local_networks = "/etc/rspamd/local.d/local_networks.inc";
dns {
nameserver = ["127.0.0.1:53:10"];
}
# Configuration personnalisée :
neighbours {
mx1 {
host = "https://mx1.example.com:443";
path = "/rspamd/";
}
mx2 {
host = "https://mx2.example.com:443";
path = "/rspamd/";
}
}
# Dernière mise à jour : 19-01-2022Remplacez les noms d’hôte par les noms d’hôte corrects pour votre serveur de messagerie principal et secondaire. Cette configuration doit être mise à jour si le modèle change, alors assurez-vous de vérifier cela lors de la mise à jour d’ISPConfig.
Nous allons maintenant ajouter un site web pour ce serveur dans ISPConfig. Allez dans Sites -> Ajouter un nouveau site web et ajoutez le site web “mx1.example.com”. Assurez-vous de le créer sur le serveur correct (mx1.example.com). Désactivez le sous-domaine automatique, et activez SSL + Let’s Encrypt. Ensuite, allez dans les options, et collez ceci dans la section des directives Apache :
RewriteEngine On
RewriteRule ^/rspamd$ /rspamd/ [R,L]
RewriteRule ^/rspamd/(.*) http://127.0.0.1:11334/$1 [P]
Header set Access-Control-Allow-Origin https://mx2.example.comRemplacez mx2.example.com par le nom d’hôte de votre serveur de noms secondaire.
Enfin, nous devons activer certains modules Apache et redémarrer nos services :
a2enmod proxy_balancer proxy_http
systemctl restart rspamd
systemctl restart apache24.5 Sécuriser le serveur de messagerie avec un certificat SSL valide
Pour une configuration DSYNC et Roundcube fonctionnelle, vous devez avoir un certificat SSL valide en place pour les noms d’hôte utilisés. Ce certificat ne peut pas être auto-signé. Si vous allez utiliser des noms d’hôte supplémentaires pour ce serveur, comme imap.example.com et smtp.example.com, ou si l’installateur n’a pas pu créer un certificat valide lors de l’installation, suivez ce guide pour configurer un certificat valide pour votre serveur de messagerie : https://www.howtoforge.com/securing-your-ispconfig-3-managed-mailserver-with-a-valid-lets-encrypt-certificate/
4.6 Configuration du pare-feu
La dernière chose à faire est de configurer notre pare-feu.
Connectez-vous à l’interface ISPConfig, et allez dans Système -> Pare-feu. Ensuite, cliquez sur “Ajouter un nouvel enregistrement de pare-feu”.
Assurez-vous de sélectionner le bon serveur. Pour notre serveur de messagerie, nous devons ouvrir les ports suivants :
TCP :
22,25,80,110,143,443,465,587,993,995Aucun port UDP ne doit être ouvert via l’interface.
Nous allons également ouvrir le port 3306, qui est utilisé pour MySQL, et le port 12345, qui est utilisé pour dsync, mais seulement depuis notre réseau local pour des raisons de sécurité. Pour ce faire, exécutez la commande suivante depuis la CLI, après que le changement du panneau ISPConfig a été propagé (lorsque le point rouge a disparu) :
ufw allow from 10.0.64.0/24 to any port 3306 proto tcp
ufw allow from 10.0.64.0/24 to any port 12345 proto tcpRecevez de nouveaux articles dans votre boîte de réception.
Aucun spam. Désabonnez-vous à tout moment.