Is there a way to force UID
/permissions
on the unix socket created by Bjoern
WSGI server?
By default it creates socket with the following permissions:
srwxr-xr-x
I need to change that to:
srwxrw-rw-
It's possible to pass to Bjoern a Python socket object, therefore one can change socket permissions as needed. The following did the trick for me:
socket_path = sys.argv[1] or './bjoern.socket'
sock = socket.socket(socket.AF_UNIX)
sock.bind(socket_path)
sock.listen(1024)
os.chmod(socket_path, 0o666)
print('## Bjoern socket path:', sock.getsockname())
try:
bjoern.server_run(sock, wsgi_app)
except KeyboardInterrupt:
os.unlink(sock.getsockname())
sock.close()