[DAEMON-70] appcd-core: Drop priviledges and set uid/gid if root
|Appc Daemon 1.0.0
In Node, you can only change the user id if Node is launched as root. If the user launching the daemon is root, it would be essential that root privileges be dropped as soon as possible during the daemon initialization. To check if the daemon is being run as root, check if
process.getuid() === 0. If the uid is zero, then get the uid/gid from in the config and call
process.setgid(). If there is no uid/gid in the config or the uid/gid is invalid, then the daemon should fatal error and exit.
Note that this only applies to macOS and Linux.