Comment 0 for bug 1611603

Revision history for this message
Paul Collins (pjdc) wrote :

I attempted to package a simple WSGI app in an Ubuntu snap with gunicorn, and ran into a problem with gunicorn vs. the Snap security policy.

The policy forbids calling chown at all, whereas the gunicorn.worker.WorkerTemp class relies on the default and historically unproblematic behaviour of silently succeeding when the UID/GID are the same as the calling process's.

I've attached a patch that attempts to short-circuit chown when it would be a no-op, which is the case when gunicorn is run as root in a snap, and this patch lets my app work when confined.

snaps also do not currently allow setuid, etc., and so there's no sense in trying to create a gunicorn-using snap that starts as root and then drops privileges. For more information on the snap security policy, please visit: https://developer.ubuntu.com/en/snappy/guides/security/