Skip to content

Consider reversing the order of daemon_become_user and prog_err_file. #7

@shamefulCake1

Description

@shamefulCake1

I would like to have daemon running as root supervise a non-privileged process (running as nobody).

I am running "daemon" like this:

daemon --name=myprogram \
       --respawn --attempts=1 --delay=10 \
       --user=nobody \
       --stderr=/var/log/daemon/myprogram.process.log \
       --errlog=/var/log/daemon/myprogram.daemon-supervisor.log \
       --command='/home/user/bin/myprogram'

This plan has the following security niceties:

  1. nobody by default has no shell, and I don't have to give one to it.
  2. nobody by default cannot write into either /var/log/daemon/myprogram.process.log or /var/log/daemon/myprogram.daemon-supervisor.log, it is "really unpivileged".
  3. daemon when run as root cannot be killed or otherwise damaged by someone who intrudes into the system and hijacks access to nobody via, say, a vulnerability in myprogram.

Since daemon run as root can do [2], and by default has a shell, it can open writing to the desired file before dropping privileges.
However, since version "0.3 (20000902)", daemon is dropping root privileges very early, so doesn't allow the setup of [1], [2], [3].

Would it be possible to add an option to drop privileges later?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions