I've set permissions on the socket to 777 yet Nginx keeps stating that it's being denied permission to access, and yes I've restarted the server.
Nginx is being started as root (not the best way but it's just the way it is and I'm not the one who set it this way) and the socket in question is owned by a user for the app.
If it's important, the socket is for a rails app running on a puma web-server.
The distro I'm using is Redhat.
I've tried following what I found here but when I try to run
grep nginx /var/log/audit/audit.log | audit2allow -m nginx
I get this error:
compilation failed:
mynginx.te:6:ERROR 'syntax error' at token '' on line 6:
/usr/bin/checkmodule: error(s) encountered while parsing configuration
/usr/bin/checkmodule: loading policy configuration from mynginx.te
Thinking it might be the command I'm running I tried:
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
but I still get the same error, after opening the audit log in less and doing a search for anything related to nginx or even denied, I get nothing, there is nothing in the audit.log related to nginx.
I'm trying to do the same thing for another system with a different app (same OS) and again I'm running into the same issue however according other audit log (which finally shows something I get this:
type=USER_CMD msg=audit(1508924031.284:1165419): user pid=30802 uid=502 auid=502 ses=5121 msg='cwd="/home/user/selinux-nginx-rhel/nginx" cmd=73656D6F64756C65202D69206E67696E782E7070 terminal=pts/0 res=success'
if it's showing res=success
why is nginx still being denied?
Also, when I try audit2allow
for this project I get a blank policy.te file like this in this user question of course the underlining cases is probably not the same as I'm running on RHEL.
Also, I'm not sure if SElinux is running but doing getenforce
returns: Disabled
.
I think ultimately it's a user permissions issue as moving the socket location to place any one can access solves the issue.