Skip to content

Playpen File Permissions

More than one OS account writes to every playpen. Super and the other VOR Stream services run as vor_user (vrisk by default), and each person who runs vor writes as themselves. vor create process, for example, writes the process's node code under src/nodes. Each account has to be able to change what the others create:

  • People write into the directories Super creates, such as input/ and output/.
  • Super changes the node code people create. When it upgrades a playpen, it moves aside, as vor_user, each node file that no longer compiles against the new version. It does this whenever the playpen's go.mod requires or replaces a module that the new version's template does not, which includes every playpen upgraded from v26.1.6.

Linux allows this only when the accounts share a group, the files are writable by that group, and they belong to it. Set up these three things on every host where people run vor.

1. A common group

Put vor_user and every person who runs vor in one OS group. The simplest choice is vor_group (vrisk by default), which is already vor_user's primary group:

sudo usermod -aG vrisk <user>

A site that wants a group of its own, for example vplay, sets it as vor_group in hosts.ini before installing (see OS User and Group). In a default deployment, supervisord runs as vor_user, and Super inherits the groups vor_user had when supervisord started. A group added to vor_user later reaches Super only when supervisord itself restarts: restarting Super alone with supervisorctl is not enough. Reboot the host, or, as vor_user, run supervisorctl shutdown, wait until supervisorctl status can no longer connect, and start /opt/vor/bin/supervisord (with your vor_root in place of /opt/vor). Either way every VOR Stream service on the host restarts, so if Vault runs there, unseal it afterwards as Unsealing Vault describes. With supervisord_root_deployment=True, supervisord looks up vor_user's groups each time it starts a service, so supervisorctl restart super is enough.

A person picks up a new group at their next login. id <user> lists the group as soon as it is added, and the person's own id lists it once they have logged in again.

2. umask 002 for everyone who runs vor

Super already runs with umask 002 (the umask inventory variable), so the files it writes are writable by the group. People's shells usually default to 022 (Red Hat Enterprise Linux 9 does), which leaves what they write writable by them alone. Set 002 for every login on the host:

printf '#!/bin/sh\numask 002\n' | sudo tee /etc/profile.d/umask.sh
sudo chmod a+x /etc/profile.d/umask.sh

It applies from each person's next login. umask prints 0002 once it does.

3. setgid on the playpen root

A new file takes its creator's primary group, unless the directory it is created in has the setgid bit. Then it takes the directory's group, and a new directory inherits the bit as well. vor create playpen does not set it, so create playpens under a root directory that has it, owned by vor_user and the common group:

sudo mkdir -p /opt/playpens
sudo chown vrisk:vrisk /opt/playpens
sudo chmod 2775 /opt/playpens

Where they differ from the defaults, replace the first vrisk with your vor_user and the second with your common group. People then create their playpens there, for example vor create playpen /opt/playpens/<name>, and every directory and file below it belongs to the common group.

Checking and fixing an existing playpen

A playpen created before the setup, or written to by someone without umask 002, keeps files that the common group cannot write. To list them, run these two commands, replacing vrisk with your common group and <playpen> with the playpen's path, written without a trailing slash. Each prints nothing for a playpen that is set up correctly:

find <playpen> -path <playpen>/pkg/mod -prune -o -type d \( ! -group vrisk -o ! -perm -2070 \) -print
find <playpen> -path <playpen>/pkg/mod -prune -o -type f \( ! -group vrisk -o ! -perm -g+rw \) -print

pkg/mod is the playpen's Go module cache, which Go keeps read-only on purpose.

To fix the playpen, run these as an administrator. They leave pkg/mod alone, and the links into the installation that the playpen's streamr and vor_stream directories hold, so they change only what the check lists:

sudo find <playpen> -path <playpen>/pkg/mod -prune -o ! -type l -exec chgrp vrisk {} +
sudo find <playpen> -path <playpen>/pkg/mod -prune -o ! -type l -exec chmod g+rwX {} +
sudo find <playpen> -path <playpen>/pkg/mod -prune -o -type d -exec chmod g+s {} +

What happens without it

  • vor commands fail in a new playpen: a person outside the common group gets permission denied from commands that write into it, such as vor generate.
  • People cannot change each other's files: they cannot change or delete files that someone with umask 022 created.
  • Playpen upgrades leave old node code behind: when a playpen upgrades to a new VOR Stream version, Super cannot move aside the node code people created. The upgrade then leaves those files where they are, finishes, and logs one warning per file, with the file's path: Left a generated code file that fails to type-check in place: Super may not move it (a problematic file for a node's own code). The warning is in Super's playpen upgrade log, super/playpen-upgrades_<date>_<time>.log, for the upgrades Super runs when it starts, and in super.log for vor update playpen (see Log Files). For generated code, the process's owner runs vor create process <process>.strm to regenerate it, as the release's upgrade notes ask for every process. A node's own code is what the upgrade would have put back anyway, and vor create process leaves it as it is, so its owner fixes its compile errors by hand.