mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
shadowsocks: Create a config with stricter permissions
So that the server password is not read by other users on the system. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
0a9c2667bf
commit
9cfcc08434
@ -22,6 +22,7 @@ Helper script for configuring Shadowsocks.
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
@ -79,7 +80,11 @@ def subcommand_merge_config(arguments):
|
|||||||
new_config.update(config)
|
new_config.update(config)
|
||||||
new_config = json.dumps(new_config, indent=4, sort_keys=True)
|
new_config = json.dumps(new_config, indent=4, sort_keys=True)
|
||||||
|
|
||||||
open(SHADOWSOCKS_CONFIG, 'w').write(new_config)
|
old_umask = os.umask(0o027)
|
||||||
|
try:
|
||||||
|
open(SHADOWSOCKS_CONFIG, 'w').write(new_config)
|
||||||
|
finally:
|
||||||
|
os.umask(old_umask)
|
||||||
|
|
||||||
action_utils.service_reload(shadowsocks.managed_services[0])
|
action_utils.service_reload(shadowsocks.managed_services[0])
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user