You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
All FreeBSD ports (especially webservers) that run on ports below >1024, can't bind their ports (e.g. 80 and 443) as non-root superusers. For security, a webserver shouldn't need to run as root, and should run as non privileged user and group, for example www:www
With mac_portacl, an application running with non privileged users like www:www can be allowed to bind ports >1024. portacl-rc can be used to control the needed rules easily via rc.d files.
Core would need to implement the following:
Tunables to enable mac_portacl:
mac_portacl_load="YES" - This would enable the load of mac_portacl. security.mac.portacl.enabled="1" - This enables the mac_portacl policy. security.mac.portacl.suser_exempt="1" - Exempts applications running with root from mac_portacl. security.mac.portacl.autoport_exempt="1" - Exempts applications binding to port 0 from mac_portacl. sysctl security.mac.portacl.port_high="1023" - Sets the highest port, which mac_portacl controls with its policy. net.inet.ip.portrange.reservedlow="0" net.inet.ip.portrange.reservedhigh="0" - These two tunables have to be set for the policy to work. https://docs.freebsd.org/en/books/handbook/mac/#mac-portacl
portacl-rc has to be installed and configured, it exists in the OPNsense ports:
That's all. Now, this change is transparent for all existing superuser applications, but enables the www:www user to run applications that bind to port 80 and 443.
More portacl_users can be easily added, allowing other applications and users to leverage this security subsystem.
Describe alternatives you considered
Leaving all applications running with root:wheel that require privileged ports (like 80,443...)
Update 2: Setting security.mac.portacl.port_high to 0 instead of 1023 will allow any unprivileged user to bind to any port, which makes the user ruleset management redundant. So it gets even easier and there is literally no maintanance needed anymore. mac_portacl is not needed anymore with that. I guess not... would have been too easy.
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
Is your feature request related to a problem? Please describe.
All FreeBSD ports (especially webservers) that run on ports below >1024, can't bind their ports (e.g. 80 and 443) as non-root superusers. For security, a webserver shouldn't need to run as root, and should run as non privileged user and group, for example
www:wwwDescribe the solution you like
With
mac_portacl, an application running withnon privileged userslikewww:wwwcan be allowed to bind ports>1024.portacl-rccan be used to control the needed rules easily via rc.d files.Core would need to implement the following:
mac_portacl:mac_portacl_load="YES"- This wouldenablethe load ofmac_portacl.security.mac.portacl.enabled="1"- This enables themac_portaclpolicy.security.mac.portacl.suser_exempt="1"- Exempts applications running withrootfrommac_portacl.security.mac.portacl.autoport_exempt="1"- Exempts applications binding to port0frommac_portacl.sysctl security.mac.portacl.port_high="1023"- Sets the highest port, whichmac_portaclcontrols with its policy.net.inet.ip.portrange.reservedlow="0"net.inet.ip.portrange.reservedhigh="0"- These two tunables have to be set for the policy to work. https://docs.freebsd.org/en/books/handbook/mac/#mac-portaclportacl-rchas to be installed and configured, it exists in the OPNsense ports:www:wwwuser to run applications that bind to port80and443.Describe alternatives you considered
Leaving all applications running with
root:wheelthat require privileged ports (like 80,443...)Additional context
Related to this:
opnsense/plugins#3946
With this subsystem in place, the only change I would need for caddy (or others would have to change in their plugins) is this in the rc.d.conf:
This whole addition can be leveraged by multiple plugins in present and future for a more secure OPNsense environment.
The text was updated successfully, but these errors were encountered: