mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:45:07 -05:00
conf: warn if not having read-only access to keys
After dropping root privileges, log a warning message if chronyd doesn't have read access or has (unnecessary) write access to the files containing symmetric and server NTS keys.
This commit is contained in:
11
util.c
11
util.c
@@ -1271,6 +1271,17 @@ UTI_CheckFilePermissions(const char *path, mode_t perm)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
UTI_CheckReadOnlyAccess(const char *path)
|
||||
{
|
||||
if (access(path, R_OK) != 0 && errno != ENOENT)
|
||||
LOG(LOGS_WARN, "Missing read access to %s : %s", path, strerror(errno));
|
||||
if (access(path, W_OK) == 0)
|
||||
LOG(LOGS_WARN, "Having write access to %s", path);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int
|
||||
join_path(const char *basedir, const char *name, const char *suffix,
|
||||
char *buffer, size_t length, LOG_Severity severity)
|
||||
|
||||
Reference in New Issue
Block a user