SELinux blocking httpd & PHPMailer

General support questions
Post Reply
stripie
Posts: 6
Joined: 2021/12/07 03:21:00

SELinux blocking httpd & PHPMailer

Post by stripie » 2021/12/21 22:42:56

I'm attempting to use PHPMailer in my site to send mail over SMTP. I was getting the following error from PHPMailer:

Code: Select all

php_network_getaddresses: getaddrinfo failed: Name or service not known
I turned on 'httpd_can_network_connect' and 'httpd_can_sendmail' and it still gave that error. I ended up disabling SELinux to see if that was the problem, and it was. I had the following alerts from SELinux:

Code: Select all

sendmail.postfix:getattr:resolv.conf
sendmail.postfix:read:hosts
postdrop:read:hosts
cleanup:read:hosts
local:read:hosts
pickup:read:hosts
dnsmasq:getattr:resolv.conf
dnsmasq:read:hosts
qmgr:read:hosts
plymouthd:map:fb0
avahi-daemon:read:resolv.conf
cupsd:getattr:resolv.conf
postfix:read:hosts
gdm:setattr:gdm
geoclue:getattr:resolv.conf
sshd:read:resolv.conf
chronyd:getattr:resolv.conf
chronyd:read:hosts
gdm:getattr:custom.conf
systemmd-hostnamed:read:hostname
httpd:getattr:resolv.conf
httpd:read:resolv.conf
gdm-session-worker:read:custom.conf
systemd-hostnam:open:hostname
systemd-hostnam:getattr:hostname
Some of these might not be relevant but I included them just in case. The only SELinux policies that I found that were recommended to change were the two I mentioned previously. I'm not sure what other policy would relevant to this situation so any help would be appreciated.

Post Reply