You see errors like this in the mail log:
Jan 1 03:30:45 busy-gates amavis[18902]: (18902-01) (!)connect_to_sql: unable to connect to DSN 'DBI:MariaDB:database=danami_warden;host=localhost': Can't connect to local server through socket '/var/lib/mysql/mysql.sock' (13) Jan 1 03:30:45 busy-gates amavis[18902]: (18902-01) (!!)TROUBLE in check_mail: gen_mail_id FAILED: connect_to_sql: unable to connect to any dataset at (eval 100) line 253.
1. SELinux Issues
This can be caused by SELinux issues with rpm based systems using MariaDB 10.5+ with SELinux enabled. There is a bug in MariaDB where it is not setting the correct SELinux context on the MariDB socket so nothing can connect to it (MDEV-24941 bug report). To fix the issue:
Run the following commands:
semanage fcontext -a -t mysqld_exec_t -s system_u "/usr/sbin/mariadbd"
restorecon -v /usr/sbin/mariadbd
systemctl restart mariadb
This should fix the issue until MariaDB fixes their RPM packages.
2. Corrupted DB Credential Issues
This can also be caused by a missing or corrupted DB credentials in the Warden config. Admins can reset the credentials using the instructions below:
// reset the Amavis database credentials
warden --task=contentfilter:contentfilter --default=yes --reload=yes
// reset the SpamAssassin learning database credentials
warden --task=antispam:learning --default=yes --reload