appmgr should be running applications as non-root user
|Status:||Closed||Start date:||02 Oct 2014|
|Target version:||PiBox - 0.10.0|
|Severity:||03 - Medium|
There will be applications that run as root and those that run as a privileged user. The appmgr should run the non-privileged apps similar to this stackexchange description
#1 Updated by Hammel over 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 50
This was easy to implement and the clock and videofe apps work fine. But the network config utility will need to run as root in order to update configuration files. So the appmgr will need special handling for this app. But that sort of handling should be generalized so I can run others the same way.
I need to devise a way to define a privileged set of apps.
#2 Updated by Hammel over 2 years ago
- appmgr is packaged with a list of app names that are privileged
- List is 400 and stored in /etc/appmgr.priv
- loadConfig() reads priv list and stores in a link list
- in startNew(), in child
- dup argv(0)
- split into tokens using path character ("/")
- Find last token
- Test if token is in privileged list
- Yes: don't switch to user=nobody.nobody
- No: switch to user=nobody.nobody
- free dup
Initial list includes only bui-network-config
#4 Updated by Hammel over 2 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
Simplified the design to just have the full path in the priv configuration file. That way there is no need to dup and tokenize the command. The command provided to appmgr must match exactly to the privileged configuration in order to run as a privileged user.
This was tested on the target and works. The code is committed and pushed upstream.