How to debug un-listed selinx permissions problems for httpd?
After a few yum updates, I finally noticed that my mercurial web interface was not working anymore. Every attempt to push resulted in
abort: HTTP Error 500: Permission denied
Errors. First I ran sealert –b
, but there were no listed denials. I rechecked the ownership and permissions on all the files in the repository, there was no visible problem. I rechecked the httpd conf and the repository confs, same story. I grepped /var/logs/messages
, /var/logs/kernel
, and /var/logs/audit/audit.log
for the string “httpd” and found nothing with any errors or denials. I triedjournalctl –l _SYSTEMD_UNIT=httpd.servcice
and got nothing as well.
I used ls –Z
on both the repository directory (/var/repositories/mercurial
) , and the web document root containing the cgi script (/var/mercurial
).
The Repository /var/repositories/mercurial looks like this:
drwxrwxr-x. 47 unconfined_u:object_r:var_t:s0 hguser repo_users 4.0K Aug 13 16:00 .
drwxrwxr-x. 3 unconfined_u:object_r:var_t:s0 hguser repo_users 4.0K Aug 24 13:24 AStyle
And the document root /var/mercurial looks like this:
drwxrwxr-x. 2 unconfined_u:object_r:var_t:s0 hguser repo_users 4.0K Oct 2 2014 .
-rw-rw-r--. 1 unconfined_u:object_r:var_t:s0 hguser repo_users 12K Dec 19 2012 dummy.html
I don’t know much about security contexts and labels and whatever, but the above looks too plain to be correct. Unfortunately, without some kind of error messages logged somewhere, I do not know where to begin.
Finally, I set selinux to permissive, and of course, that “fixed” the issue. Pushes no longer fail. But it is not acceptable to stay in permissive mode. How can I find what the true problem is, correct that, and return to enforcing mode?
FYI, the mercurial hgweb interface is done in python cgi. I will next try grepping and journalctl for python, and see where that gets me.
Thanks!
Lit looks like sealert is treating ssh logins differently from "console" logins AGAIN. I walked over to the rack, started a graphical login, and "poof!" sealert shows python denials. I had a similar problem in Fedora 18, but I fixed it somehow. Now I must track down that fix, and redo, then I might be able to repair my hgweb server.
Does running restorecon help
I don't want to throw out an 'answer' without positive verification, but I can give some pointers:
ausearch
should work over ssh, ieausearch -m avc -ts recent
.sealert
is more part of the desktop notification applet, as I understand it.httpd can't serve var_t labeled files. The easiest way to resolve this would be to move the files to /var/www/ and restorecon after (mv preserves labels).
the default labels in /var/www/ might not be appropriate for mercurial. For the full list of relevant labels and booleans, install selinux-policy-doc for
man httpd_selinux