Symptoms
-
Postfix cannot send emails leaving the messages in queue.
-
RHEL/CentOS/CloudLinux is installed on the server.
-
The following entries can be found in
/var/log/audit/audit.log
:PLESK_INFO: type=AVC msg=audit(1375899192.013:10985): avc: denied { read } for pid=2769 comm=”tcp-env” name=”resolv.conf” dev=sda1 ino=1892366 scontext=unconfined_u:system_r:sendmail_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file
PLESK_INFO: type=AVC msg=audit(1528811014.613:26279): avc: denied { read } for pid=512 comm=”smtp” name=”resolv.conf” dev=”dm-0″ ino=392479 scontext=system_u:system_r:postfix_smtp_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=file
-
The SELinux context on
/etc/resolv.conf
file looks as follows:# ll -Z /etc/resolv.conf
-rw-r–r–. root root system_u:object_r:httpd_sys_content_t:s0 /etc/resolv.conf -
Following entries can be found in
/var/log/maillog
:PLESK_INFO: postfix/smtp[25846]: D615A60A1CE: to=[email protected], relay=none, delay=0.15, delays=0.15/0/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
Cause
SELinux is blocking access to /etc/resolv.conf
and therefore the mail server cannot resolve destination where the message should be sent.
Resolution
Restore the default context for /etc/resolv.conf file:
-
Connect to the server using SSH
-
Restore the default context on
/etc/resolv.conf
:# restorecon /etc/resolv.conf
Additional information
Mail queue contains deferred emails: Host or domain name not found
RedHat Bugzilla: NetworkManager writing out resolv.conf with wrong context