mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 22:05:06 -05:00
cmdparse: don't allow NTP key ID of 0
Key number 0 is used as inactive key, prevent the user from inadvertently not using authentication.
This commit is contained in:
@@ -1746,7 +1746,8 @@ pairs. The format of the file is shown below
|
|||||||
|
|
||||||
Each line consists of an ID, a name of authentication hash function (optional)
|
Each line consists of an ID, a name of authentication hash function (optional)
|
||||||
and a password. The ID can be any unsigned integer in the range 0 through
|
and a password. The ID can be any unsigned integer in the range 0 through
|
||||||
2**32-1. The hash function is MD5 by default, depending on how was
|
2**32-1, but ID of 0 can be used only for the command key and not for the NTP
|
||||||
|
authentication. The hash function is MD5 by default, depending on how was
|
||||||
@code{chronyd} compiled other allowed hash functions may be SHA1, SHA256,
|
@code{chronyd} compiled other allowed hash functions may be SHA1, SHA256,
|
||||||
SHA384, SHA512, RMD128, RMD160, RMD256, RMD320, TIGER and WHIRLPOOL. The
|
SHA384, SHA512, RMD128, RMD160, RMD256, RMD320, TIGER and WHIRLPOOL. The
|
||||||
password can be encoded as a string of characters not containing a space with
|
password can be encoded as a string of characters not containing a space with
|
||||||
@@ -2829,7 +2830,8 @@ keys file, defined by the keyfile command.
|
|||||||
|
|
||||||
If the key option is present, @code{chronyd} will attempt to use
|
If the key option is present, @code{chronyd} will attempt to use
|
||||||
authenticated packets when communicating with this server. The key
|
authenticated packets when communicating with this server. The key
|
||||||
number used will be the single argument to the key option. The server
|
number used will be the single argument to the key option (an
|
||||||
|
unsigned integer in the range 1 through 2**32-1). The server
|
||||||
must have the same password for this key number configured, otherwise no
|
must have the same password for this key number configured, otherwise no
|
||||||
relationship between the computers will be possible.
|
relationship between the computers will be possible.
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
|
|||||||
line += n;
|
line += n;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(cmd, "key")) {
|
} else if (!strcasecmp(cmd, "key")) {
|
||||||
if (sscanf(line, "%lu%n", &src->params.authkey, &n) != 1) {
|
if (sscanf(line, "%lu%n", &src->params.authkey, &n) != 1 ||
|
||||||
|
src->params.authkey == INACTIVE_AUTHKEY) {
|
||||||
result = CPS_BadKey;
|
result = CPS_BadKey;
|
||||||
ok = 0;
|
ok = 0;
|
||||||
done = 1;
|
done = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user