Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plume/twistd runs code as root before dropping privileges #61

Open
cvandeplas opened this issue Dec 26, 2019 · 0 comments
Open

plume/twistd runs code as root before dropping privileges #61

cvandeplas opened this issue Dec 26, 2019 · 0 comments

Comments

@cvandeplas
Copy link
Contributor

Plume is, by default, dropping privileges to the user nobody.
This only happens after the whole code was run once as root, privileges are only dropped afterwards when running transforms.
This can cause problems with permissions with for example logging, file creation, ...

You can easily reproduce this by creating a file or folder within the code (outside of a function):

os.mkdir('/tmp/testing_plume')

Start twistd:

twistd --pidfile=/var/run/plume.pid --rundir=/var/plume --uid=65534 --gid=1001 --no_save --nodaemon web --wsgi=canari.tas.plume.application  --port=tcp:8080

Notice the folder is owned by root and not nobody:

root@ubuntu:/var/plume# ls -al /tmp/
drwxrwxrwt 10 root root 4096 Dec 25 20:59 .
drwxr-xr-x 24 root root 4096 Dec 25 14:25 ..
drwxr-xr-x  2 root root 4096 Dec 25 17:43 testing_plume

I however have no idea yet on how to prevent this from happening.
To work around this, either move all the code to functions, or change permissions os.chmod('/tmp/testing_plume', mode=0o777) which is not the best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant