Between Linux and Anime

Kind of like Schrodinger's Cat

Allowing PHP/httpd to use sendmail on Fedora

I had to Google hard for this – twice, because I was too busy to blog this when I solved it the first time. Anyway, people not accustomed to sysadmin-ing on Fedora will find themselves quickly acquainted with this rather unfriendly beast called SELinux, which firmly prevents you from doing a bunch of stuff – sometimes quietly.

Anyway, it turns out that although sendmail is installed and working on Fedora by default, SELinux will by default prevent httpd (and thus your PHP scripts) from using it to send email. To fix this, simply tell SELinux to don’t do that, like so:

$ restorecon /usr/sbin/sendmail.sendmail
$ setsebool -P httpd_can_sendmail 1

Or, if you prefer, look for the httpd_can_sendmail boolean in the SELinux configuration GUI and tick it off. Restart httpd after that:

/etc/init.d/httpd restart

Source

929
Rate this post
Thanks!
An error occurred!


  • Facebook
  • Twitter
  • Identi.ca
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • RSS
  • Reddit

Previous

Hiding Kate Session Applet Items

Next

The Disappearance of HTT (K-ON!! up to 23)

8 Comments

  1. You deserve kudos for not just adding selinux=0 to grub.conf like every weak-willed earthling does.

  2. Jason "moofang"

    Hehe thanks :P there had been indications that that server may have been compromised before, so I was deliberately leaving as many random security stuff on as possible.

  3. That said, auditd should log SElinux denials. So the theory is that failures aren’t silent. Maybe your rsyslog was dropping it.

  4. Jason "moofang"

    Nah, by failing quietly I mean in the sense that I do something, and only realize later that that something didn’t get done, and yet a little later that it was blocked by SELinux. I don’t know what standard practices are like, but you can’t be checking logs after every action eh?

  5. Thank you, I allready figured some SElinux problems with my httpd/mysql/php intranet, but this one was missing! Working fine now!

  6. Thank you, it works!

  7. Thanks, it works for me too!

Leave a Reply

Powered by WordPress & Theme by Anders Norén