Add arg for configuring unix socket perms (#1103)

The default unix socket permissions of 600 is too restrictive for many use
cases.

Added a new argument --unix-socket-perms which is passed to waitress to allow
for user configurable socket permissions
main
Vivek 2023-12-20 10:05:38 -08:00 committed by GitHub
parent b5ae07613b
commit 70dc750c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -626,6 +626,11 @@ def run_app() -> None:
default='', default='',
metavar='</path/to/unix.sock>', metavar='</path/to/unix.sock>',
help='Listen for app on unix socket instead of host:port') help='Listen for app on unix socket instead of host:port')
parser.add_argument(
'--unix-socket-perms',
default='600',
metavar='<octal permissions>',
help='Octal permissions to use for the Unix domain socket (default 600)')
parser.add_argument( parser.add_argument(
'--debug', '--debug',
default=False, default=False,
@ -677,7 +682,7 @@ def run_app() -> None:
if args.debug: if args.debug:
app.run(host=args.host, port=args.port, debug=args.debug) app.run(host=args.host, port=args.port, debug=args.debug)
elif args.unix_socket: elif args.unix_socket:
waitress.serve(app, unix_socket=args.unix_socket) waitress.serve(app, unix_socket=args.unix_socket, unix_socket_perms=args.unix_socket_perms)
else: else:
waitress.serve( waitress.serve(
app, app,