Open Mailstorm-ctrl opened 1 month ago
Could you explain exactly what doesn't work if you harden according to CIS L1+?
It would honestly be better for you to just try it out yourself. Installed Rocky Linux 9 and use CIS Level 1 server hardening. Install netbox like you'd do and it's just error after error once you get the web server going.
A lot of it deals with the execution bit pemrission not being set and then making sure the netbox user has permissions to all of the files it needs (this was mentioned in the docs). However, some pages are just broken for no apparent reason (The devices page works but not the VM page or some other random page). The latest error I'm chasing is. But I just can't seem to find what the issue is.
2024/10/31 15:21:00 [crit] 106585#106585: *4 open() "/var/lib/nginx/tmp/proxy/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: ::ffff:10.1.12.1, server: hostname, request: "GET /virtualization/virtual-machines/ HTTP/1.1", upstream: "http://127.0.0.1:8001/virtualization/virtual-machines/", host: "hostnamel", referrer: "https://hostname/dcim/devices/"```
It would honestly be better for you to just try it out yourself. Installed Rocky Linux 9 and use CIS Level 1 server hardening. Install netbox like you'd do and it's just error after error once you get the web server going.
A lot of it deals with the execution bit pemrission not being set and then making sure the netbox user has permissions to all of the files it needs (this was mentioned in the docs). However, some pages are just broken for no apparent reason (The devices page works but not the VM page or some other random page). The latest error I'm chasing is. But I just can't seem to find what the issue is.
2024/10/31 15:21:00 [crit] 106585#106585: *4 open() "/var/lib/nginx/tmp/proxy/2/00/0000000002" failed (13: Permission denied) while reading upstream, client: ::ffff:10.1.12.1, server: hostname, request: "GET /virtualization/virtual-machines/ HTTP/1.1", upstream: "http://127.0.0.1:8001/virtualization/virtual-machines/", host: "hostnamel", referrer: "https://hostname/dcim/devices/"```
I got this fixed. But it is because of the CIS hardening. This is the stuff I remember I had to do to get this all working:
chown -R netbox /opt/netbox
)chmod -R o+rx /var/lib/nginx
)find -type f -name "*.py" -exec chmod u+x \{\} \;
while inside /opt/netbox to make all python files executable.Some additional notes:
To update your fix, this command will copy the group permissions to world:
chmod -R o=g /opt/netbox*
I also add UMask=022
to the systemd .service files to make sure any new files created by the services allow world reads.
Change Type
Addition
Area
Installation/upgrade
Proposed Changes
I'm not sure if I'm supposed to write up the documentation I'm wanting added here or not so I'm just posting this initially.
I'm sure we aren't the only people that run hardened servers according to some benchmark (It's even mentioned in the current docs briefly SELinux). But if you harden servers according to CIS L1+, your instance will not work and it's because of permissions.
I can write the documentation if this would be beneficial. I'm currently still trying to get our new instance fully working as there are some weird issues I discovered that came down to permissions on files.