Web Application and SELinux

One of my friend would like to set up a personal web for controlling BTQueue backend through web interface using PHPBTque. It is a good idea in case of you don't like ssh and command line. Unfortunately, he got some weird problem like "permission denied (13)". This error message was not ejected by BTQueue for sure. So where it came from is the key to fix this problem. Since the system he is running is Fedora Core 5, I guessed it should be SELinux and it is. SELinux is great in security but it is very difficult and too complicate to configure in general purpose server. Usually, I disabled SELinux in my all FC instances. By the way, other may like SELinux enough to configure SELinux for maximum security.

In order to use PHPBTQue with BTQueue, you need to allow to call fsockopen in httpd context. The key context is httpd_can_network_connect which must be true. You can simply set it using setsebool as follow:

setsebool -P httpd_can_network_connect 1

To make it permanent, add below line in /etc/selinux/targeted/booleans:

httpd_can_network_connect=1

All done. For more information about SELinux and httpd, simply read man httpd_selinux.

Technorati tags: , , ,

Post new comment