shadowsocks: Fix shadowsocks not able to start

Shadowsocks is unable to read its own configuration file because it
doesn't have read permissions to the file.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
[jvalleroy: Add comment about security concerns]
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2020-02-21 11:50:01 +05:30 committed by James Valleroy
parent 61545d1b8d
commit 976668d89b
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -60,7 +60,10 @@ def subcommand_merge_config(arguments):
new_config.update(config)
new_config = json.dumps(new_config, indent=4, sort_keys=True)
old_umask = os.umask(0o027)
# XXX: Config file with password is world-readable. This is the
# same as the default config file, but find a way to avoid this.
# See https://salsa.debian.org/freedombox-team/plinth/-/merge_requests/1724
old_umask = os.umask(0o022)
try:
open(SHADOWSOCKS_CONFIG, 'w').write(new_config)
finally: