summaryrefslogtreecommitdiff
path: root/debian/patches/auth-log-verbosity.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/auth-log-verbosity.patch')
-rw-r--r--debian/patches/auth-log-verbosity.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/debian/patches/auth-log-verbosity.patch b/debian/patches/auth-log-verbosity.patch
new file mode 100644
index 000000000..fb3855f9a
--- /dev/null
+++ b/debian/patches/auth-log-verbosity.patch
@@ -0,0 +1,118 @@
1From e08f96cf1105a3ee9a23de7102d593443e031e0c Mon Sep 17 00:00:00 2001
2From: Colin Watson <cjwatson@debian.org>
3Date: Sun, 9 Feb 2014 16:10:02 +0000
4Subject: Quieten logs when multiple from= restrictions are used
5
6Bug-Debian: http://bugs.debian.org/630606
7Forwarded: no
8Last-Update: 2013-09-14
9
10Patch-Name: auth-log-verbosity.patch
11---
12 auth-options.c | 35 ++++++++++++++++++++++++++---------
13 auth-options.h | 1 +
14 auth2-pubkey.c | 3 +++
15 3 files changed, 30 insertions(+), 9 deletions(-)
16
17diff --git a/auth-options.c b/auth-options.c
18index 57b49f7f..7eb87b35 100644
19--- a/auth-options.c
20+++ b/auth-options.c
21@@ -59,8 +59,19 @@ int forced_tun_device = -1;
22 /* "principals=" option. */
23 char *authorized_principals = NULL;
24
25+/* Throttle log messages. */
26+int logged_from_hostip = 0;
27+int logged_cert_hostip = 0;
28+
29 extern ServerOptions options;
30
31+void
32+auth_start_parse_options(void)
33+{
34+ logged_from_hostip = 0;
35+ logged_cert_hostip = 0;
36+}
37+
38 void
39 auth_clear_options(void)
40 {
41@@ -316,10 +327,13 @@ auth_parse_options(struct passwd *pw, char *opts, char *file, u_long linenum)
42 /* FALLTHROUGH */
43 case 0:
44 free(patterns);
45- logit("Authentication tried for %.100s with "
46- "correct key but not from a permitted "
47- "host (host=%.200s, ip=%.200s).",
48- pw->pw_name, remote_host, remote_ip);
49+ if (!logged_from_hostip) {
50+ logit("Authentication tried for %.100s with "
51+ "correct key but not from a permitted "
52+ "host (host=%.200s, ip=%.200s).",
53+ pw->pw_name, remote_host, remote_ip);
54+ logged_from_hostip = 1;
55+ }
56 auth_debug_add("Your host '%.200s' is not "
57 "permitted to use this key for login.",
58 remote_host);
59@@ -543,11 +557,14 @@ parse_option_list(struct sshbuf *oblob, struct passwd *pw,
60 break;
61 case 0:
62 /* no match */
63- logit("Authentication tried for %.100s "
64- "with valid certificate but not "
65- "from a permitted host "
66- "(ip=%.200s).", pw->pw_name,
67- remote_ip);
68+ if (!logged_cert_hostip) {
69+ logit("Authentication tried for %.100s "
70+ "with valid certificate but not "
71+ "from a permitted host "
72+ "(ip=%.200s).", pw->pw_name,
73+ remote_ip);
74+ logged_cert_hostip = 1;
75+ }
76 auth_debug_add("Your address '%.200s' "
77 "is not permitted to use this "
78 "certificate for login.",
79diff --git a/auth-options.h b/auth-options.h
80index 52cbb42a..82355276 100644
81--- a/auth-options.h
82+++ b/auth-options.h
83@@ -33,6 +33,7 @@ extern int forced_tun_device;
84 extern int key_is_cert_authority;
85 extern char *authorized_principals;
86
87+void auth_start_parse_options(void);
88 int auth_parse_options(struct passwd *, char *, char *, u_long);
89 void auth_clear_options(void);
90 int auth_cert_options(struct sshkey *, struct passwd *, const char **);
91diff --git a/auth2-pubkey.c b/auth2-pubkey.c
92index 3e5706f4..6dc5076e 100644
93--- a/auth2-pubkey.c
94+++ b/auth2-pubkey.c
95@@ -566,6 +566,7 @@ process_principals(FILE *f, char *file, struct passwd *pw,
96 u_long linenum = 0;
97 u_int i, found_principal = 0;
98
99+ auth_start_parse_options();
100 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) {
101 /* Always consume entire input */
102 if (found_principal)
103@@ -771,6 +772,7 @@ check_authkeys_file(FILE *f, char *file, Key* key, struct passwd *pw)
104 found_key = 0;
105
106 found = NULL;
107+ auth_start_parse_options();
108 while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) {
109 char *cp, *key_options = NULL, *fp = NULL;
110 const char *reason = NULL;
111@@ -921,6 +923,7 @@ user_cert_trusted_ca(struct passwd *pw, Key *key)
112 if (key_cert_check_authority(key, 0, 1,
113 use_authorized_principals ? NULL : pw->pw_name, &reason) != 0)
114 goto fail_reason;
115+ auth_start_parse_options();
116 if (auth_cert_options(key, pw, &reason) != 0)
117 goto fail_reason;
118