summaryrefslogtreecommitdiff
path: root/auth-options.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-09 16:10:02 +0000
committerColin Watson <cjwatson@debian.org>2016-03-21 12:06:15 +0000
commit1dd7836b386be1816bc565aafb9875769430a02d (patch)
treee899be3862f84f6d0d0e69fca7f387ca07ad5de3 /auth-options.c
parentca8dd1a2520b4230dd97d8e4774426b756f16c42 (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.c35
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. */
59char *authorized_principals = NULL; 59char *authorized_principals = NULL;
60 60
61/* Throttle log messages. */
62int logged_from_hostip = 0;
63int logged_cert_hostip = 0;
64
61extern ServerOptions options; 65extern ServerOptions options;
62 66
63void 67void
68auth_start_parse_options(void)
69{
70 logged_from_hostip = 0;
71 logged_cert_hostip = 0;
72}
73
74void
64auth_clear_options(void) 75auth_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.",