mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 23:40:29 +03:00
Warn about config permissions before loading the defaults
Now, configs that don't contain passwords don't trigger the warning.
This commit is contained in:
parent
2686fa6faa
commit
0bce840571
1 changed files with 5 additions and 5 deletions
|
|
@ -92,6 +92,11 @@ def read_config(opts, config_file='config.py'):
|
||||||
'sun.security.pkcs11.SunPKCS11',
|
'sun.security.pkcs11.SunPKCS11',
|
||||||
'-providerArg', 'opensc-fdroid.cfg']
|
'-providerArg', 'opensc-fdroid.cfg']
|
||||||
|
|
||||||
|
if any(k in config for k in ["keystore", "keystorepass", "keypass"]):
|
||||||
|
st = os.stat(config_file)
|
||||||
|
if st.st_mode & stat.S_IRWXG or st.st_mode & stat.S_IRWXO:
|
||||||
|
logging.warn("unsafe permissions on {0} (should be 0600)!".format(config_file))
|
||||||
|
|
||||||
defconfig = get_default_config()
|
defconfig = get_default_config()
|
||||||
for k, v in defconfig.items():
|
for k, v in defconfig.items():
|
||||||
if k not in config:
|
if k not in config:
|
||||||
|
|
@ -107,11 +112,6 @@ def read_config(opts, config_file='config.py'):
|
||||||
if not test_sdk_exists(config):
|
if not test_sdk_exists(config):
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
if any(k in config for k in ["keystore", "keystorepass", "keypass"]):
|
|
||||||
st = os.stat(config_file)
|
|
||||||
if st.st_mode & stat.S_IRWXG or st.st_mode & stat.S_IRWXO:
|
|
||||||
logging.warn("unsafe permissions on {0} (should be 0600)!".format(config_file))
|
|
||||||
|
|
||||||
for k in ["keystorepass", "keypass"]:
|
for k in ["keystorepass", "keypass"]:
|
||||||
if k in config:
|
if k in config:
|
||||||
write_password_file(k)
|
write_password_file(k)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue