appmgr should be running applications as non-root user
Added by Hammel over 8 years ago.
Updated over 8 years ago.
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
- 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.
A very simplistic method that is probably not secure:
- 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
- Project changed from PiBox to appmgr
- Category deleted (
04 - Applications)
- 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.
Also available in: Atom