mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:45:07 -05:00
keys: warn about short key only if used by source
After restricting authentication of servers and peers to the specified key, a short key in the key file is a security problem from the client's point of view only if it's specified for a source.
This commit is contained in:
18
keys.c
18
keys.c
@@ -198,9 +198,6 @@ KEY_Reload(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key.len < MIN_SECURE_KEY_LENGTH)
|
||||
LOG(LOGS_WARN, LOGF_Keys, "Key %"PRIu32" is too short", key_id);
|
||||
|
||||
key.id = key_id;
|
||||
key.val = MallocArray(char, key.len);
|
||||
memcpy(key.val, keyval, key.len);
|
||||
@@ -295,6 +292,21 @@ KEY_GetAuthDelay(uint32_t key_id)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
KEY_CheckKeyLength(uint32_t key_id)
|
||||
{
|
||||
Key *key;
|
||||
|
||||
key = get_key_by_id(key_id);
|
||||
|
||||
if (!key)
|
||||
return 0;
|
||||
|
||||
return key->len >= MIN_SECURE_KEY_LENGTH;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
KEY_GenerateAuth(uint32_t key_id, const unsigned char *data, int data_len,
|
||||
unsigned char *auth, int auth_len)
|
||||
|
||||
Reference in New Issue
Block a user