I am trying to setup my website (LAMP stack, CentOS 6.9) on Google compute engine. I use PHPMailer to send mails (Registration, Singup, Login, etc.)

I have setup smtp & all that good stuff in G-Suite & in my PHPMailer calls. But my mails don't go through. Most other people have solved this issue with

sudo setsebool -P httpd_can_sendmail 1
sudo setsebool -P httpd_can_network_connect 1

But in my case setsebool does not take effect (evident from below). And when I run setsebool as root, it gets killed!

[me]$ sudo setsebool -P httpd_can_sendmail 1
[me]$ sudo setsebool -P httpd_can_network_connect 1
[me]$ getsebool httpd_can_sendmail
httpd_can_sendmail --> off
[me]$ getsebool httpd_can_network_connect
httpd_can_network_connect --> off

// Try as root & it gets killed by ...?
[me]$ sudo su -
[root]# setsebool -P httpd_can_sendmail 1

Obviously I am missing something. Maybe google does not allow this. Any pointers will be greatly appreciated!

  • This works for me, on a freshly created CentOS 6 image using centos-6-v20180401. The setsebool commands under sudo take a while to complete but afterwards everything looks fine. Can you reproduce this on a freshly created machine? If it still fails, try to check out /var/log/audit/audit.log (you will need sudo for that) to see if it says something about it... – filbranden Apr 2 '18 at 18:04
  • @FilipeBrandenburger - Thanks! Apparently -P in there is the issue. So, looks like some permission issue on the policy file. tail audit.log shows all success - nothing suspicious there. – sambha Apr 2 '18 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.