mysqldebianmariadbpostfix-mtadovecot

Strange errors in postfix mail.warn log


How to avoid getting strange records in the mail.warn file? I started to receive it after Debian upgrade from jessie to stretch and postfix upgrade from 2.11.3 to 3.1.8. It is generated once, just after the system reboot.

Despite the strange errors recorded in mail.warn file, it seems that postfix works fine.

My current environment is the following: Debian 9 stretch Postfix 3.1.8 Dovecot 2.2.27 (c0f36b0) 10.1.23-MariaDB-9+deb9u1

Mar 18 12:57:52 jessie postfix/proxymap[862]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
Mar 18 12:57:52 jessie postfix/cleanup[861]: warning: proxy:mysql:/etc/postfix/virtual_alias_maps.cf lookup error for "email@example.com"
Mar 18 12:57:52 jessie postfix/cleanup[861]: warning: 3B61C40601: virtual_alias_maps map lookup problem for email@example.com -- message not accepted, try again later
Mar 18 12:57:54 jessie postfix/cleanup[861]: warning: proxy:mysql:/etc/postfix/virtual_alias_maps.cf lookup error for "email@example.com"
Mar 18 12:57:54 jessie postfix/cleanup[861]: warning: 7FA7542CC4: virtual_alias_maps map lookup problem for email@example.com -- message not accepted, try again later
Mar 18 12:57:54 jessie postfix/cleanup[861]: warning: proxy:mysql:/etc/postfix/virtual_alias_maps.cf lookup error for "email@example.com"
Mar 18 12:57:54 jessie postfix/cleanup[861]: warning: 8017A42CC4: virtual_alias_maps map lookup problem for email@example.com -- message not accepted, try again later
Mar 18 12:58:51 jessie postfix/cleanup[861]: warning: proxy:mysql:/etc/postfix/virtual_alias_maps.cf lookup error for "email@example.com"
Mar 18 12:58:51 jessie postfix/cleanup[861]: warning: 889C33FAA1: virtual_alias_maps map lookup problem for email@example.com -- message not accepted, try again later
Mar 18 12:58:51 jessie postfix/cleanup[861]: warning: proxy:mysql:/etc/postfix/virtual_alias_maps.cf lookup error for "email@example.com"
Mar 18 12:58:51 jessie postfix/cleanup[861]: warning: 894A13FAA1: virtual_alias_maps map lookup problem for email@example.com -- message not accepted, try again later

postfix main.cf:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
anvil_rate_time_unit = 60s
append_dot_mydomain = no
biff = no
compatibility_level = 1
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
local_recipient_maps = $virtual_mailbox_maps
local_transport = virtual
mailbox_command =
mailbox_size_limit = 0
mime_header_checks = regexp:/etc/postfix/block_attachments
mydestination = localhost
myhostname = waw.homeip.net
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relay_domains = $mydestination
relayhost =
smtp_tls_loglevel = 1
smtp_tls_mandatory_protocols = !SSLv2,!SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 5
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org
smtpd_error_sleep_time = 5s
smtpd_hard_error_limit = 10
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, check_helo_access hash:/etc/postfix/helo_access
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, check_client_access hash:/etc/postfix/rbl_override, reject_rbl_client zen.spamhaus.org, reject_rbl_client cbl.abuseat.org, permit
smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, check_client_access hash:/etc/postfix/rbl_override, reject_rbl_client zen.spamhaus.org, reject_rbl_client cbl.abuseat.org, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_soft_error_limit = 5
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/waw.homeip.net/fullchain.pem
smtpd_tls_dh1024_param_file = /etc/ssl_test/dhparam/dhparams.pem
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
smtpd_tls_key_file = /etc/letsencrypt/live/waw.homeip.net/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = proxy:mysql:/etc/postfix/virtual_alias_maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/virtual_mailbox_domains.cf
virtual_mailbox_limit = 512000000
virtual_mailbox_maps = proxy:mysql:/etc/postfix/virtual_mailbox_maps.cf
virtual_minimum_uid = 5000
virtual_transport = virtual
virtual_uid_maps = static:5000

virtual_alias_maps.cf

user = postfix_user
password = password
hosts = localhost
dbname = postfix_db
table = alias
select_field = goto
where_field = address

Solution

    1. Try to connect to MariaDB using credentials from the file:

    # mysql -upostfix_user -p

    Or with localhost IP address:

    # mysql -h 127.0.0.1 -upostfix_user -p

    If the connection is possible only when the IP address is specified, you can simply change hosts = localhost to hosts = 127.0.0.1 in virtual_alias_maps.cf.

    If it fails both ways, the password may be incorrect. Use the following query to reset it in MariaDB:

    mysql> UPDATE mysql.user SET authentication_string=PASSWORD('password') where User='postfix_user' and Host='localhost'
    

    If the user does not exist at all (very unlikely), create it.

    1. Check if the database name postfix_db is correct and exists in MariaDB.