ntp+cmdmon: log allow/deny commands
Log added NTP and command access restrictions, using INFO severity if from a chronyc command, DEBUG otherwise (i.e. from the config).
This commit is contained in:
parent
d0fd04c0a2
commit
e789b0817f
2 changed files with 7 additions and 0 deletions
3
cmdmon.c
3
cmdmon.c
|
@ -1799,6 +1799,9 @@ CAM_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
|
||||||
if (status == ADF_BADSUBNET) {
|
if (status == ADF_BADSUBNET) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (status == ADF_SUCCESS) {
|
} else if (status == ADF_SUCCESS) {
|
||||||
|
LOG(LOG_GetContextSeverity(LOGC_Command), "%s%s %s access from %s",
|
||||||
|
allow ? "Allowed" : "Denied", all ? " all" : "", "command",
|
||||||
|
UTI_IPSubnetToString(ip_addr, subnet_bits));
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2856,6 +2856,10 @@ NCR_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
|
||||||
if (status != ADF_SUCCESS)
|
if (status != ADF_SUCCESS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
LOG(LOG_GetContextSeverity(LOGC_Command), "%s%s %s access from %s",
|
||||||
|
allow ? "Allowed" : "Denied", all ? " all" : "", "NTP",
|
||||||
|
UTI_IPSubnetToString(ip_addr, subnet_bits));
|
||||||
|
|
||||||
/* Keep server sockets open only when an address allowed */
|
/* Keep server sockets open only when an address allowed */
|
||||||
if (allow) {
|
if (allow) {
|
||||||
NTP_Remote_Address remote_addr;
|
NTP_Remote_Address remote_addr;
|
||||||
|
|
Loading…
Reference in a new issue