Stdio.Process (stdio v0.1.0)

Supervised system processes

fork(2) new system processes.

privileges

Privileges

No additional privileges required. If the Stdio supervisor process is running as root, supervised processes will by default drop to an unprivileged user.

operations

Operations

See Stdio.config/0 for configuration options.

  • creates a new session

  • sets the process priority [:priority=0]

  • sets resource limits defined in the rlimit option [:rlimit=coredumps disabled]

  • sends the process a SIGKILL if the parent process exits

If the system process is running with root privileges:

  • sets additional groups as specified in the group option [:groups=additional groups removed]

  • drops privileges to the value of uid and gid or a high UID system [:uid/gid=65536-131071]

  • disables the ability of the process to escalate privileges [:setuid=false]

Warning

The generated UID/GID may overlap with existing users.

examples

Examples

iex> Stdio.stream!(
...> "ping -q -c 1 127.0.0.1 | grep -o PING",
...> Stdio.Process,
...> setuid: true
...> ) |> Enum.to_list()
[stdout: "PING\n", exit_status: 0]