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>2017-10-04 13:54:48 +0100
commit50e9edb57b6808cbbf63fe3433febb103baac1e8 (patch)
treefc751a3326cc04f9392f2a08f48791e9f8a2cff5 /auth-options.c
parentf500e89e2310f6308a998357d72d767e3b01553c (diff)
Quieten logs when multiple from= restrictions are used
Bug-Debian: http://bugs.debian.org/630606 Forwarded: no Last-Update: 2017-10-04 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 bed00eef0..ccdd0b20a 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -59,11 +59,22 @@ int forced_tun_device = -1;
59/* "principals=" option. */ 59/* "principals=" option. */
60char *authorized_principals = NULL; 60char *authorized_principals = NULL;
61 61
62/* Throttle log messages. */
63int logged_from_hostip = 0;
64int logged_cert_hostip = 0;
65
62extern ServerOptions options; 66extern ServerOptions options;
63 67
64/* XXX refactor to be stateless */ 68/* XXX refactor to be stateless */
65 69
66void 70void
71auth_start_parse_options(void)
72{
73 logged_from_hostip = 0;
74 logged_cert_hostip = 0;
75}
76
77void
67auth_clear_options(void) 78auth_clear_options(void)
68{ 79{
69 struct ssh *ssh = active_state; /* XXX */ 80 struct ssh *ssh = active_state; /* XXX */
@@ -322,10 +333,13 @@ auth_parse_options(struct passwd *pw, char *opts, const char *file,
322 /* FALLTHROUGH */ 333 /* FALLTHROUGH */
323 case 0: 334 case 0:
324 free(patterns); 335 free(patterns);
325 logit("Authentication tried for %.100s with " 336 if (!logged_from_hostip) {
326 "correct key but not from a permitted " 337 logit("Authentication tried for %.100s with "
327 "host (host=%.200s, ip=%.200s).", 338 "correct key but not from a permitted "
328 pw->pw_name, remote_host, remote_ip); 339 "host (host=%.200s, ip=%.200s).",
340 pw->pw_name, remote_host, remote_ip);
341 logged_from_hostip = 1;
342 }
329 auth_debug_add("Your host '%.200s' is not " 343 auth_debug_add("Your host '%.200s' is not "
330 "permitted to use this key for login.", 344 "permitted to use this key for login.",
331 remote_host); 345 remote_host);
@@ -549,11 +563,14 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
549 break; 563 break;
550 case 0: 564 case 0:
551 /* no match */ 565 /* no match */
552 logit("Authentication tried for %.100s " 566 if (!logged_cert_hostip) {
553 "with valid certificate but not " 567 logit("Authentication tried for %.100s "
554 "from a permitted host " 568 "with valid certificate but not "
555 "(ip=%.200s).", pw->pw_name, 569 "from a permitted host "
556 remote_ip); 570 "(ip=%.200s).", pw->pw_name,
571 remote_ip);
572 logged_cert_hostip = 1;
573 }
557 auth_debug_add("Your address '%.200s' " 574 auth_debug_add("Your address '%.200s' "
558 "is not permitted to use this " 575 "is not permitted to use this "
559 "certificate for login.", 576 "certificate for login.",