diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:10:02 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-03-10 13:00:40 +0000 |
commit | 33f7235ca187f62f44734c6caca95e54c3cf7232 (patch) | |
tree | f05189c752bcf72887bc159cc37eae1bac25a6eb /auth-options.c | |
parent | 9c255ad5c677682eb99e1d45dbd5328cef732036 (diff) |
Quieten logs when multiple from= restrictions are used
Bug-Debian: http://bugs.debian.org/630606
Forwarded: no
Last-Update: 2013-09-14
Patch-Name: auth-log-verbosity.patch
Diffstat (limited to 'auth-options.c')
-rw-r--r-- | auth-options.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/auth-options.c b/auth-options.c index edbaf80bb..bda39df4e 100644 --- a/auth-options.c +++ b/auth-options.c | |||
@@ -58,9 +58,20 @@ int forced_tun_device = -1; | |||
58 | /* "principals=" option. */ | 58 | /* "principals=" option. */ |
59 | char *authorized_principals = NULL; | 59 | char *authorized_principals = NULL; |
60 | 60 | ||
61 | /* Throttle log messages. */ | ||
62 | int logged_from_hostip = 0; | ||
63 | int logged_cert_hostip = 0; | ||
64 | |||
61 | extern ServerOptions options; | 65 | extern ServerOptions options; |
62 | 66 | ||
63 | void | 67 | void |
68 | auth_start_parse_options(void) | ||
69 | { | ||
70 | logged_from_hostip = 0; | ||
71 | logged_cert_hostip = 0; | ||
72 | } | ||
73 | |||
74 | void | ||
64 | auth_clear_options(void) | 75 | auth_clear_options(void) |
65 | { | 76 | { |
66 | no_agent_forwarding_flag = 0; | 77 | no_agent_forwarding_flag = 0; |
@@ -314,10 +325,13 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum) | |||
314 | /* FALLTHROUGH */ | 325 | /* FALLTHROUGH */ |
315 | case 0: | 326 | case 0: |
316 | free(patterns); | 327 | free(patterns); |
317 | logit("Authentication tried for %.100s with " | 328 | if (!logged_from_hostip) { |
318 | "correct key but not from a permitted " | 329 | logit("Authentication tried for %.100s with " |
319 | "host (host=%.200s, ip=%.200s).", | 330 | "correct key but not from a permitted " |
320 | pw->pw_name, remote_host, remote_ip); | 331 | "host (host=%.200s, ip=%.200s).", |
332 | pw->pw_name, remote_host, remote_ip); | ||
333 | logged_from_hostip = 1; | ||
334 | } | ||
321 | auth_debug_add("Your host '%.200s' is not " | 335 | auth_debug_add("Your host '%.200s' is not " |
322 | "permitted to use this key for login.", | 336 | "permitted to use this key for login.", |
323 | remote_host); | 337 | remote_host); |
@@ -540,11 +554,14 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw, | |||
540 | break; | 554 | break; |
541 | case 0: | 555 | case 0: |
542 | /* no match */ | 556 | /* no match */ |
543 | logit("Authentication tried for %.100s " | 557 | if (!logged_cert_hostip) { |
544 | "with valid certificate but not " | 558 | logit("Authentication tried for %.100s " |
545 | "from a permitted host " | 559 | "with valid certificate but not " |
546 | "(ip=%.200s).", pw->pw_name, | 560 | "from a permitted host " |
547 | remote_ip); | 561 | "(ip=%.200s).", pw->pw_name, |
562 | remote_ip); | ||
563 | logged_cert_hostip = 1; | ||
564 | } | ||
548 | auth_debug_add("Your address '%.200s' " | 565 | auth_debug_add("Your address '%.200s' " |
549 | "is not permitted to use this " | 566 | "is not permitted to use this " |
550 | "certificate for login.", | 567 | "certificate for login.", |