Project

General

Profile

Actions

Feature #2532

closed

Privileges drop

Added by kukackajiri over 10 years ago. Updated almost 8 years ago.

Status:
Missing Feedback
Priority:
Low
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:

Description

Lighttpd don't need to start under root user, is could start under user with NET_PRIVADDR elevated privileges, and drop those privileges afterwards. This could be great security upgrade.
Attached patch file handles privileges drop.


Files

drop_privileges.patch (746 Bytes) drop_privileges.patch kukackajiri, 2013-11-25 15:09
Actions #1

Updated by kukackajiri over 10 years ago

As I think about it, this should probably be enhancement, not a bug, but I'm unable to update bug base, and I don't want to create duplicate enhancement as I can't delete this bug. If you can, please update this to enhancement. Thanks

Actions #2

Updated by stbuehler over 10 years ago

  • Tracker changed from Bug to Feature

which platform? configure.ac/cmake platform check + option?

Actions #3

Updated by kukackajiri over 10 years ago

Platform Solaris, but it should work on Linux as well.

Platform check would be nice to test if platform supports privileges.

Actions #4

Updated by gstrauss almost 8 years ago

  • Category set to core
  • Priority changed from Normal to Low
Actions #5

Updated by gstrauss almost 8 years ago

  • Status changed from New to Missing Feedback

https://docs.oracle.com/cd/E36784_01/html/E36883/privileges-5.html#REFMAN5privileges-5
https://docs.oracle.com/cd/E36784_01/html/E36874/priv-allocset-3c.html

The patch provided by kukackajiri leaks memory. It is missing a call to priv_freeset().
Additionally, the code should probably priv_fillset() and drop all privileges, known and unknown.

Now then, on Linux, 'man 7 capabilities' have a very different interface to Solaris privileges, and the patch is not applicable.

It would be quite an undertaking to properly provide user-friendly configuration interfaces to various privileging and capabilities systems from different operating systems. To do so only for binding to privileged sockets would be easier, but there does not seem to be a lot of people clamoring, and there are a variety of already existing solutions, including starting as root and dropping privileges, having firewall configured to rewrite packets to unprivileged (high) ports, using a proxy (haproxy, varnish, etc) in front of the web server, using a daemon to provide bound privileged ports (https://github.com/gstrauss/bsock), virtualization (virtual machines and/or containerization), and probably many more options. Of course, there is also operating system specific privileging/capabilities which is the subject of this feature request.

This feature request is not going to be a priority without a compelling argument why this should be built into lighttpd as opposed to provided by any of the external options above. For convenience, lighttpd provides the ability -- if started as root -- to do various privileged actions such as bind to privileged ports and chroot, and then drop root privileges. While that is an option, an even better security design is to have the security privilege layer managed outside of lighttpd instead of adding complexity specifically into lighttpd.

Actions

Also available in: Atom