Alors que mon serveur d’emails marchait nickel à part quelques réglages que j’ai dû faire par la suite pour empêcher les serveurs de spam d’utiliser mon serveur comme relais et expéditeur de leurs saletés, la mise à jour du serveur de base de données MySQL de la version 5.7 à la version 8.0 l’a totalement déréglé.
Plus de courriers dans Thunderbird : Mail server murviel-info.com is not an IMAP4 server, Roundcube ne se connecte plus. En allant voir les fichiers de logs :
1 2 3 4 5 6 7 8 |
xavier@machine:/var/log$ tail mail.log ... Oct 1 09:33:25 sd-97133 postfix/cleanup[24473]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf is unavailable. unsupported dictionary type: mysql Oct 1 09:33:25 sd-97133 postfix/cleanup[24473]: warning: mysql:/etc/postfix/mysql-virtual-alias-maps.cf lookup error for ... Oct 1 09:33:25 sd-97133 postfix/cleanup[24473]: warning: 915A63380429: virtual_alias_maps map lookup problem for ... -- message not accepted, try again later Oct 1 09:33:50 sd-97133 dovecot: auth: Fatal: Unknown database driver 'mysql' Oct 1 09:33:50 sd-97133 dovecot: master: Error: service(auth): command startup failed, throttling for 60 secs ... |
1 2 3 4 5 6 7 8 9 10 11 |
xavier@machine:/var/log$ tail mail.err Oct 1 09:36:23 machine postfix/smtpd[25274]: error: unsupported dictionary type: mysql Oct 1 09:36:25 machine postfix/trivial-rewrite[25275]: error: unsupported dictionary type: mysql Oct 1 09:36:25 machine postfix/trivial-rewrite[25275]: error: unsupported dictionary type: mysql Oct 1 09:36:32 machine postfix/smtpd[25254]: fatal: no SASL authentication mechanisms Oct 1 09:36:32 machine postfix/smtpd[25273]: fatal: no SASL authentication mechanisms Oct 1 09:36:50 machine dovecot: auth: Fatal: Unknown database driver 'mysql' Oct 1 09:36:50 machine dovecot: master: Error: service(auth): command startup failed, throttling for 60 secs Oct 1 09:36:57 machine postfix/smtpd[25285]: error: unsupported dictionary type: mysql Oct 1 09:36:57 machine postfix/smtpd[25285]: error: unsupported dictionary type: mysql Oct 1 09:37:20 machine dovecot: imap-login: Error: Timeout waiting for handshake from auth server. my pid=25284, input bytes=0 |
Donc, on y voit surtout unsupported dictionary type: mysql
et dovecot: auth: Fatal: Unknown database driver 'mysql'
. Il y a donc un problème avec Dovecot : le serveur IMAP et POP3 pour les systèmes d’exploitation Unix et donc Ubuntu, et le serveur de base données MySQL.
On regarde donc le statut du serveur Dovecot :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
xavier@machine:/var/log$ sudo systemctl status dovecot [sudo] password for ...: ● dovecot.service - Dovecot IMAP/POP3 email server Loaded: loaded (/lib/systemd/system/dovecot.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2020-09-21 18:37:46 CEST; 1 weeks 2 days ago Docs: man:dovecot(1) http://wiki2.dovecot.org/ Main PID: 8714 (dovecot) Tasks: 4 (limit: 4635) CGroup: /system.slice/dovecot.service ├─8714 /usr/sbin/dovecot -F ├─8716 dovecot/anvil ├─8717 dovecot/log └─8719 dovecot/config Oct 01 09:42:51 machine dovecot[8717]: auth: Fatal: Unknown database driver 'mysql' Oct 01 09:42:51 machine dovecot[8714]: master: Error: service(auth): command startup failed, throttling for 60 secs Oct 01 09:42:51 machine dovecot[8717]: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, Oct 01 09:42:51 machine dovecot[8717]: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, Oct 01 09:42:51 machine dovecot[8717]: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, Oct 01 09:43:51 machine dovecot[8717]: auth: Fatal: Unknown database driver 'mysql' Oct 01 09:43:51 machine dovecot[8714]: master: Error: service(auth): command startup failed, throttling for 60 secs Oct 01 09:43:51 machine dovecot[8717]: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, Oct 01 09:43:51 machine dovecot[8717]: imap-login: Disconnected: Auth process broken (disconnected before auth was ready, |
Il y a donc clairement un problème entre Dovecot et mysql
, les mails étant gérés en base de données.
En se rendant dans le répertoire /etc/dovecot
, on cherche d’où cela peut bien venir. On voit le mot driver
, c’est ce que l’on va chercher dans les fichiers de configuration :
1 2 3 4 5 6 |
xavier@machine:/var/log$ sudo grep -rne "driver" . ... ./dovecot-sql.conf.ext:31:# Database driver: mysql, pgsql, sqlite ./dovecot-sql.conf.ext:32:driver = mysql ./dovecot-sql.conf.ext:36:# Database connection string. This is driver-specific setting. xavier@machine:/etc/dovecot$ |
On commence à cerner le problème. Dovecot n’aime pas le driver
mysql
, déclaré dans le fichier de configuration dovecot-sql.conf.ext
à la ligne 32.
Mon système étant Ubuntu 18.04 LTS Bionic, on voit sur le repository Bionic/Universe un package dovecot-mysql – MySQL support, donc un utilitaire pour le support de MySQL par Dovecot.
On regarde si celui-ci est installé sur le système :
1 2 3 4 5 6 7 8 9 10 11 12 |
xavier@machine:/var/log$ apt-cache policy dovecot-mysql dovecot-mysql: Installed: (none) Candidate: 1:2.2.33.2-1ubuntu4.6 Version table: 1:2.2.33.2-1ubuntu4.6 500 500 http://mirrors.online.net/ubuntu bionic-updates/universe amd64 Packages 500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages 1:2.2.33.2-1ubuntu4 500 500 http://mirrors.online.net/ubuntu bionic/universe amd64 Packages 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages xavier@machine:/etc/dovecot$ |
On va donc se l’installer.
On arrête les serveurs mysql
et dovecot
pour plus de sécurité, et on lance l’installation avec apt-get
:
1 2 |
xavier@machine:/var/log$ sudo systemctl stop dovecot xavier@machine:/var/log$ sudo systemctl stop mysql |
On peut mettre à jour les repositories apt-get
, et les packages :
1 2 |
xavier@machine:/var/log$ sudo apt-get update xavier@machine:/var/log$ sudo apt-get upgrade |
Et on lance l’installation de dovecot-mysql
:
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 30 31 |
xavier@machine:/var/log$ sudo apt-get install dovecot-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: guile-2.0-libs libcgi-fast-perl libcgi-pm-perl libevent-core-2.1-6 libfcgi-perl libgc1c2 libgsasl7 libhtml-template-perl libkyotocabinet16v5 liblzo2-2 libntlm0 linux-headers-4.15.0-112 linux-headers-4.15.0-112-generic linux-headers-4.15.0-47 linux-headers-4.15.0-47-generic linux-image-4.15.0-112-generic linux-image-4.15.0-47-generic linux-modules-4.15.0-112-generic linux-modules-4.15.0-47-generic linux-modules-extra-4.15.0-112-generic linux-modules-extra-4.15.0-47-generic mailutils-common Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libmysqlclient20 The following NEW packages will be installed: dovecot-mysql libmysqlclient20 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/700 kB of archives. After this operation, 4,084 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Selecting previously unselected package libmysqlclient20:amd64. (Reading database ... 194597 files and directories currently installed.) Preparing to unpack .../libmysqlclient20_5.7.31-0ubuntu0.18.04.1_amd64.deb ... Unpacking libmysqlclient20:amd64 (5.7.31-0ubuntu0.18.04.1) ... Selecting previously unselected package dovecot-mysql. Preparing to unpack .../dovecot-mysql_1%3a2.2.33.2-1ubuntu4.6_amd64.deb ... Unpacking dovecot-mysql (1:2.2.33.2-1ubuntu4.6) ... Setting up libmysqlclient20:amd64 (5.7.31-0ubuntu0.18.04.1) ... Setting up dovecot-mysql (1:2.2.33.2-1ubuntu4.6) ... Processing triggers for dovecot-core (1:2.2.33.2-1ubuntu4.6) ... Processing triggers for libc-bin (2.27-3ubuntu1.2) ... xavier@machine:/etc/dovecot$ |
On redémarre les serveurs mysql
et dovecot
:
1 2 |
xavier@machine:/var/log$ sudo systemctl restart mysql xavier@machine:/var/log$ sudo systemctl restart dovecot |
Et maintenant Rouncube se connecte bien mais le serveur ne reçoit ni n’envoie rien. On redémarre postfix
, et c’est pareil. Dans la même logique que précédemment, on va faire un tour sur les logs et l’on regarde si un package postfix-mysql
n’existe pas. Et c’est la même chose : PostFix MySQL map support for Postfix.
On vérifie sur le système si le package est installé. Si non, on l’installe :
1 2 3 4 5 6 7 8 9 10 11 12 |
xavier@machine:/var/log$ apt-cache policy policy postfix-mysql postfix-mysql: Installed: (none) Candidate: 3.3.0-1ubuntu0.3 Version table: 3.3.0-1ubuntu0.3 500 500 http://mirrors.online.net/ubuntu bionic-updates/main amd64 Packages 3.3.0-1 500 500 http://mirrors.online.net/ubuntu bionic/main amd64 Packages N: Unable to locate package policy xavier@machine:/etc/dovecot$ xavier@machine:/etc/dovecot$ |
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 |
xavier@machine:/var/log$ sudo apt-get install postfix-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: guile-2.0-libs libcgi-fast-perl libcgi-pm-perl libevent-core-2.1-6 libfcgi-perl libgc1c2 libgsasl7 libhtml-template-perl libkyotocabinet16v5 liblzo2-2 libntlm0 linux-headers-4.15.0-112 linux-headers-4.15.0-112-generic linux-headers-4.15.0-47 linux-headers-4.15.0-47-generic linux-image-4.15.0-112-generic linux-image-4.15.0-47-generic linux-modules-4.15.0-112-generic linux-modules-4.15.0-47-generic linux-modules-extra-4.15.0-112-generic linux-modules-extra-4.15.0-47-generic mailutils-common Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: postfix-mysql 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 21.4 kB of archives. After this operation, 122 kB of additional disk space will be used. Get:1 http://mirrors.online.net/ubuntu bionic-updates/main amd64 postfix-mysql amd64 3.3.0-1ubuntu0.3 [21.4 kB] Fetched 21.4 kB in 0s (646 kB/s) Selecting previously unselected package postfix-mysql. (Reading database ... 194610 files and directories currently installed.) Preparing to unpack .../postfix-mysql_3.3.0-1ubuntu0.3_amd64.deb ... Unpacking postfix-mysql (3.3.0-1ubuntu0.3) ... Setting up postfix-mysql (3.3.0-1ubuntu0.3) ... Adding mysql map entry to /etc/postfix/dynamicmaps.cf Processing triggers for man-db (2.8.3-2ubuntu0.1) ... xavier@machine:/etc/dovecot$ |
On redémarre postfix et l’on teste :
1 2 |
xavier@machine:/var/log$ sudo systemctl restart postfix xavier@machine:/var/log$ |
Et hop, c’est reparti, les mails s’envoient et se reçoivent.