Solved What does the attribute "username" in unbound.conf mean?

Hello everyone,
Who can explain the meaning of the attribute "username" in unbound.conf?
I didn't understand the official explanation.

Thank you very much!


Code:
# if given, user privileges are dropped (after binding port),
# and the given username is assumed. Default is user "unbound".
# If you give "" no privileges are dropped.
# username: "@UNBOUND_USERNAME@"

Code:
      username: _name_
      If  given,  after binding  the  port  the  userprivileges are
      dropped. Default is "unbound". Ifyou give username: "" no  user
      change isperformed.

      If  thisuser  is  not capable of binding the port, reloads (by
      signal HUP) will still retain theopened ports.  If  youchange
      the  port number in  the configfile, and that new portnumber
      requires privileges, thena  reload  will fail;a  restart  is
      needed.
 
As always with these things: the manualpage. So, run man unbound.conf on the command line and you'll gain access to unbound.conf(5):

Code:
       username: <name>
              If given, after binding the port the user privileges are
              dropped. Default is "unbound". If you give username: "" no user
              change is performed.

              If this user is not capable of binding the port, reloads (by
              signal HUP) will still retain the opened ports.  If you change
              the port number in the config file, and that new port number
              requires privileges, then a reload will fail; a restart is
              needed.
What part do you fail to understand though? This is all pretty basic stuff, and I can't help but wonder if the handbook didn't cover all this (the basic concepts that is).

Aaanyway.... Services are run using a user account. And by doing so they also gain the permissions (or lack there off!) from that user account. Ports below 1024 (from mind, I could be a bit off) are considered privileged meaning that only the root user can actually open them for listening. This is somewhat of a security concept because it can help sysadmins: block incoming ports higher than 1024 and you're basically avoiding any non-root user from starting a service which actively listens to incoming data (that's the theory at least, I'm avoiding details here).

However, this concept of "privileged ports" also creates a problem: root is all powerful. So if you run a service as root, then the service gets taken over for some reason, and suddenly you're in big trouble because 3rd party attackers now gained root level access to your server. "auch".

This is why many modern services support the concept of "dropping privileges". In other words: they'll use the root account privileges to open the actual port, then immediately switch accounts so that the service continues to run but using a non-privileged user account.

So, now 3 guesses what this setting exactly does :p
 
Thank you.
It sounds a bit like "setuid”, but I don't know where to find a similar detailed description like this.
 
Back
Top