iRedMail + Nginx

P4sh0u

Padawan
31 Juillet 2022
83
11
8
Bonjour à tous,

Je rencontre quelques complications concernant mon serveur mail, le port 993 de l'IMAP SSL n'a pas l'air d'être visible par des services comme Outlook ou Thunderbird. J'arrive à recevoir des mails mais je pense que certains n'ont pas été reçu...
Je l'installe en docker sous OMV.

Voici ma config :

version: '3'
services:
iredmail:
container_name: iredmail
image: iredmail/mariadb:stable
hostname: mail.exemple.com
ports:
- "8080:80"
- "4443:443"
- "110:110"
- "995:995"
- "143:143"
- "993:993"
- "25:25"
- "465:465"
- "587:587"
- "4190:4190"
environment :
- HOSTNAME=mail.exemple.com
- FIRST_MAIL_DOMAIN=exemple.com
- FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=***
- ROUNDCUBE_DES_KEY=***
volumes:
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/backup-mysql:/var/vmail/backup/mysql
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/mailboxes:/var/vmail/vmail1
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/mlmmj:/var/vmail/mlmmj
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/mlmmj-archive:/var/vmail/mlmmj-archive
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/imapsieve_copy:/var/vmail/imapsieve_copy
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/custom:/opt/iredmail/custom
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/ssl:/opt/iredmail/ssl
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/mysql:/var/lib/mysql
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/clamav:/var/lib/clamav
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/sa_rules:/var/lib/spamassassin
- /srv/dev-disk-by-uuid-111ebfb2-241a-43b2-aa8b-8ded8f04ab93/docker/iredmail/data/postfix_queue:/var/spool/postfix
restart: unless-stopped


J'ai bien récupéré le certificat SSL mail.exemple.com via Nginx et je m'en sert également pour arriver sur la page de roundcube.

Ai-je manqué une étape ? Merci d'avance :)
 
Salut,
Quelques questions et remarques :
1- Tu mentionnes Nginx ; je suppose que tu ne caches pas ton serveur de courriels derrière ton proxy inverse ?
2- Tu indiques que tu as récupéré un certificat via Nginx ; peux-tu être plus précis (Nginx n'est pas un outil d'échange de certificats) ? Peux-tu également indiquer où (sur le serveur hôte) est stocké ton certificat ?
3- Je ne vois pas de volume permettant à ton serveur de courriel d'accéder à ton certificat.
4- Qu'est-ce qui te fait supposer que ton problème est lié au certificat ?
5- Peux-tu relancer le conteneur du serveur de courriels et nous transmettre son journal (log) ?

EDIT : le serveur Iredmail/mariadb est déconseillé par le développeur pour la production car instable ; peut-être devrais-tu tenter une autre image ?
 
1- En gros j'ai enregistré en reverse proxy mon mail.exemple.com sur Nginx Proxy Manager
2-Nginx est installé sur la même machine que iredmail via docker
3-J'ai utilisé ce tuto : https://github.com/iredmail/dockerized
4- Quand j'essaye de me connecter via soit l'appli gmail, nextcloud ou thunderbird, le résultat est le même l'IMAP 993 n'est pas joignable alors que le 143 oui via la commande :
telnet mail.exemple.com 143
5-
[iRedMail] Remove leftover pid files which may cause service fail to start.
[iRedMail] [Entrypoint] /docker/entrypoints/rsyslog.sh
[iRedMail] [Entrypoint] /docker/entrypoints/cron.sh
[iRedMail] [Entrypoint] /docker/entrypoints/mariadb.sh
[iRedMail] Starting temporary MariaDB instance.
2024-04-10 17:00:50 0 [Note] mysqld (mysqld 10.3.31-MariaDB-0ubuntu0.20.04.1-log)
starting as process 210 ...
[iRedMail] Reset password for SQL user 'root'%'localhost'.
[iRedMail] [Run] /docker/mariadb/pre_start/0-vmail_db.sh
[iRedMail] Grant privileges to SQL user 'vmail' and 'vmailadmin'.
[iRedMail] Make sure postmaster@exemple.com is a global admin.
[iRedMail] [Run] /docker/mariadb/pre_start/amavisd_db.sh
[iRedMail] [Run] /docker/mariadb/pre_start/fail2ban_db.sh
[iRedMail] [Run] /docker/mariadb/pre_start/iredadmin_db.sh
[iRedMail] [Run] /docker/mariadb/pre_start/iredapd_db.sh
[iRedMail] [Run] /docker/mariadb/pre_start/roundcube.sh
[iRedMail] [Run] /docker/mariadb/pre_start/sa_bayes.sh
[iRedMail] Stopping the temporary mysql instance.
[iRedMail] Stopped the temporary mysql instance.
[iRedMail] [Entrypoint] /docker/entrypoints/dovecot.sh
[iRedMail] [Entrypoint] /docker/entrypoints/postfix.sh
[iRedMail] [Entrypoint] /docker/entrypoints/mlmmj.sh
[iRedMail] [Entrypoint] /docker/entrypoints/mlmmjadmin.sh
[iRedMail] [Entrypoint] /docker/entrypoints/iredapd.sh
[iRedMail] [Entrypoint] /docker/entrypoints/antispam.sh
[iRedMail] Run 'sa-update' (required by Amavisd).
Update finished, no fresh updates were available
[iRedMail] [Entrypoint] /docker/entrypoints/nginx.sh
[iRedMail] [Entrypoint] /docker/entrypoints/phpfpm.sh
[iRedMail] [Entrypoint] /docker/entrypoints/roundcube.sh
[iRedMail] [Entrypoint] /docker/entrypoints/fail2ban.sh
[iRedMail] [Entrypoint] /docker/entrypoints/iredadmin.sh
[iRedMail] CMD: /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/amavisd.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/clamav.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/dovecot.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/fail2ban.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/iredadmin.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/iredapd.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/mariadb.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/mlmmjadmin.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/nginx.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/phpfpm.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/postfix.conf" during parsing
2024-04-10 17:00:58,004 INFO Included extra file "/etc/supervisor/conf.d/rsyslog.conf" during parsing
2024-04-10 17:00:58,004 INFO Set uid to user 0 succeeded
2024-04-10 17:00:58,007 INFO RPC interface 'supervisor' initialized
2024-04-10 17:00:58,007 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-04-10 17:00:58,007 INFO supervisord started with pid 1
2024-04-10 17:00:59,010 INFO spawned: 'rsyslog' with pid 729
2024-04-10 17:00:59,012 INFO spawned: 'cron' with pid 730
2024-04-10 17:00:59,014 INFO spawned: 'mariadb' with pid 731
2024-04-10 17:00:59,016 INFO spawned: 'clamav' with pid 732
2024-04-10 17:00:59,018 INFO spawned: 'dovecot' with pid 733
2024-04-10 17:00:59,020 INFO spawned: 'iredadmin' with pid 734
2024-04-10 17:00:59,021 INFO spawned: 'iredapd' with pid 737
2024-04-10 17:00:59,023 INFO spawned: 'mlmmjadmin' with pid 738
2024-04-10 17:00:59,026 INFO spawned: 'amavisd' with pid 740
2024-04-10 17:00:59,029 INFO spawned: 'phpfpm' with pid 742
2024-04-10 17:00:59,032 INFO spawned: 'nginx' with pid 743
2024-04-10 17:00:59,035 INFO spawned: 'postfix' with pid 744
2024-04-10 17:00:59,037 INFO spawned: 'fail2ban' with pid 745
2024-04-10 17:00:59,038 INFO reaped unknown pid 512
2024-04-10 17:00:59,040 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,041 INFO success: cron entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,041 INFO success: mariadb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,041 INFO success: clamav entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,041 INFO success: dovecot entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,042 INFO success: iredadmin entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,042 INFO success: iredapd entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,042 INFO success: mlmmjadmin entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,042 INFO success: amavisd entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,043 INFO success: phpfpm entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,043 INFO success: nginx entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,043 INFO success: postfix entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-04-10 17:00:59,043 INFO success: fail2ban entered RUNNING state, process has
stayed up for > than 0 seconds (startsecs)

Je ne savais pas qu'il était déconseillé, une alternative possible toujours sous docker ?
 
Enfaite pour les ports c'est ok, j'ai tout testé et tous les ports sont bien ouvert et configuré. C'est bien un problème de certificat.
 
J'ai vu que l'application n'avait pas fait l'objet de version nouvelle depuis 2 ans donc je pars de l'hypothèse que ce n'est pas le meilleur choix.
Par ailleurs, sache que monter son serveur courriel est un véritable parcours du combattant car il faut mettre en place tout un paramétrage susceptible de te permettre d'acquérir la confiance des principaux acteurs du secteur (gmail, ...), sinon ils rejettent tes courriels. Donc de manière générale, je déconseille vivement aux non-initiés de se lancer dans cette voie.
Mais si tu tiens à tenter l'expérience il y a de nombreuses solutions telles que mailcow, mailu, mailserver, ... Et chercher-toi un tuto qui t'emmène plus loin que les seuls aspects techniques, mais aussi le paramétrage DKIM, DMARC, ...
EDIT : si le problème concerne effectivement le certificat, il faut que tu aies en tête que l'application prévoit d'aller chercher le certificat elle-même. Je pense qu'elle échoue en cela car tu n'as probablement pas routé le port 80 de ton routeur vers le port 8080 de ton NAS (puisque tu l'utilises pour Nginx), et par ailleurs tu as déjà un certificat pour le même sous-domaine (mais ce dernier point n'est pas à l'origine du problème).
 
Dernière édition:
Alors je reviens sur mon problème, j'ai pris en compte ce que tu m'as dis sur l'obsolescence de iredmail et maintenant je suis passé chez mailcow, et clairement ça n'a rien a voir. C'est juste parfait, la config est simple et clair. Ça t'explique comment bien configurer ton DNS, franchement c'est parfait. Mon serveur mail marche du feu de dieu 👌
Merci d'avoir apporté des conseils :)
 
Alors je reviens sur mon problème, j'ai pris en compte ce que tu m'as dis sur l'obsolescence de iredmail et maintenant je suis passé chez mailcow, et clairement ça n'a rien a voir. C'est juste parfait, la config est simple et clair. Ça t'explique comment bien configurer ton DNS, franchement c'est parfait. Mon serveur mail marche du feu de dieu 👌
Merci d'avoir apporté des conseils :)
Avec plaisir. Maintenant il te faut franchir tous les obstacles DKIM, DMARC et autres joyeusetés, afin de t'assurer que les principaux relais de courriels ne rejettent pas les tiens. Pour t'améliorer, et avant de te faire mettre sur liste noire, je te conseille de tester tes courriels sur https://www.mail-tester.com/
 
Avec plaisir. Maintenant il te faut franchir tous les obstacles DKIM, DMARC et autres joyeusetés, afin de t'assurer que les principaux relais de courriels ne rejettent pas les tiens. Pour t'améliorer, et avant de te faire mettre sur liste noire, je te conseille de tester tes courriels sur https://www.mail-tester.com/
Tout est déjà réglé pour les paramètres DNS et effectivement j'ai pu faire quelques test d'envoi de courriel via https://www.mail-tester.com/ et tout est ok :)
Merci :)
 
  • J'aime
Réactions: Eirikr70