keys+nts: warn if loading world-readable/writable key

Log a warning message if the file specified by the keyfile or
ntsserverkey directive is world-readable or writable, which is likely
an insecure misconfiguration. There is no check of directories
containing the file.
This commit is contained in:
Miroslav Lichvar
2023-01-19 16:09:40 +01:00
parent 88e711ad9a
commit 9cba9c8585
4 changed files with 32 additions and 0 deletions

3
keys.c
View File

@@ -182,6 +182,9 @@ KEY_Reload(void)
if (!key_file)
return;
if (!UTI_CheckFilePermissions(key_file, 0771))
;
in = UTI_OpenFile(NULL, key_file, NULL, 'r', 0);
if (!in) {
LOG(LOGS_WARN, "Could not open keyfile %s", key_file);