Search code examples
apachesocketsdaemoncentos7selinux

Daemon service app unable to bind port when run through php exec


I have a daemon that listen to port 1234. Given that 1234 is not used by any service or app when I run this daemon through php with httpd, it fails to bind. Turning SElinux to permissive allows this daemon to bind as expected. I don't really have deep knowledge with SElinux, what policy do I need to enable? There's something with SElinux that blocks the binding.


Solution

  • It is always a good idea to have a look at the logged SELinux denials to get an idea of the issue. Try looking in your /var/log/audit (or if the audit framework is not in place /var/log/messages) for messages with the tagged with "avc" and "denied".

    If you have a denial in your log file with your daemons name, post it here and it'll probably be more likely to get some constructive help.