1*53a984a3SEd Maste--- /dev/null	2015-01-22 23:10:33.000000000 -0500
2*53a984a3SEd Maste+++ dist/pfilter.c	2015-01-22 23:46:03.000000000 -0500
3*53a984a3SEd Maste@@ -0,0 +1,32 @@
4*53a984a3SEd Maste+#include "namespace.h"
5*53a984a3SEd Maste+#include "includes.h"
6*53a984a3SEd Maste+#include "ssh.h"
7*53a984a3SEd Maste+#include "packet.h"
8*53a984a3SEd Maste+#include "log.h"
9*53a984a3SEd Maste+#include "pfilter.h"
10*53a984a3SEd Maste+#include <blacklist.h>
11*53a984a3SEd Maste+
12*53a984a3SEd Maste+static struct blacklist *blstate;
13*53a984a3SEd Maste+
14*53a984a3SEd Maste+void
15*53a984a3SEd Maste+pfilter_init(void)
16*53a984a3SEd Maste+{
17*53a984a3SEd Maste+	blstate = blacklist_open();
18*53a984a3SEd Maste+}
19*53a984a3SEd Maste+
20*53a984a3SEd Maste+void
21*53a984a3SEd Maste+pfilter_notify(int a)
22*53a984a3SEd Maste+{
23*53a984a3SEd Maste+	int fd;
24*53a984a3SEd Maste+	if (blstate == NULL)
25*53a984a3SEd Maste+		pfilter_init();
26*53a984a3SEd Maste+	if (blstate == NULL)
27*53a984a3SEd Maste+		return;
28*53a984a3SEd Maste+	// XXX: 3?
29*53a984a3SEd Maste+ 	fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3;
30*53a984a3SEd Maste+	(void)blacklist_r(blstate, a, fd, "ssh");
31*53a984a3SEd Maste+	if (a == 0) {
32*53a984a3SEd Maste+		blacklist_close(blstate);
33*53a984a3SEd Maste+		blstate = NULL;
34*53a984a3SEd Maste+	}
35*53a984a3SEd Maste+}
36*53a984a3SEd Maste--- /dev/null	2015-01-20 21:14:44.000000000 -0500
37*53a984a3SEd Maste+++ dist/pfilter.h	2015-01-20 20:16:20.000000000 -0500
38*53a984a3SEd Maste@@ -0,0 +1,3 @@
39*53a984a3SEd Maste+
40*53a984a3SEd Maste+void pfilter_notify(int);
41*53a984a3SEd Maste+void pfilter_init(void);
42*53a984a3SEd MasteIndex: bin/sshd/Makefile
43*53a984a3SEd Maste===================================================================
44*53a984a3SEd MasteRCS file: /cvsroot/src/crypto/external/bsd/openssh/bin/sshd/Makefile,v
45*53a984a3SEd Masteretrieving revision 1.10
46*53a984a3SEd Mastediff -u -u -r1.10 Makefile
47*53a984a3SEd Maste--- bin/sshd/Makefile	19 Oct 2014 16:30:58 -0000	1.10
48*53a984a3SEd Maste+++ bin/sshd/Makefile	22 Jan 2015 21:39:21 -0000
49*53a984a3SEd Maste@@ -15,7 +15,7 @@
50*53a984a3SEd Maste 	auth2-none.c auth2-passwd.c auth2-pubkey.c \
51*53a984a3SEd Maste 	monitor_mm.c monitor.c monitor_wrap.c \
52*53a984a3SEd Maste 	kexdhs.c kexgexs.c kexecdhs.c sftp-server.c sftp-common.c \
53*53a984a3SEd Maste-	roaming_common.c roaming_serv.c sandbox-rlimit.c
54*53a984a3SEd Maste+	roaming_common.c roaming_serv.c sandbox-rlimit.c pfilter.c
55*53a984a3SEd Maste
56*53a984a3SEd Maste COPTS.auth-options.c=	-Wno-pointer-sign
57*53a984a3SEd Maste COPTS.ldapauth.c=	-Wno-format-nonliteral	# XXX: should fix
58*53a984a3SEd Maste@@ -68,3 +68,6 @@
59*53a984a3SEd Maste
60*53a984a3SEd Maste LDADD+=	-lwrap
61*53a984a3SEd Maste DPADD+=	${LIBWRAP}
62*53a984a3SEd Maste+
63*53a984a3SEd Maste+LDADD+=	-lblacklist
64*53a984a3SEd Maste+DPADD+=	${LIBBLACKLIST}
65*53a984a3SEd Mastediff -ru openssh-7.7p1/auth-pam.c dist/auth-pam.c
66*53a984a3SEd Maste--- openssh-7.7p1/auth-pam.c	2018-04-02 01:38:28.000000000 -0400
67*53a984a3SEd Maste+++ dist/auth-pam.c	2018-05-23 11:56:22.206661484 -0400
68*53a984a3SEd Maste@@ -103,6 +103,7 @@
69*53a984a3SEd Maste #include "ssh-gss.h"
70*53a984a3SEd Maste #endif
71*53a984a3SEd Maste #include "monitor_wrap.h"
72*53a984a3SEd Maste+#include "pfilter.h"
73*53a984a3SEd Maste
74*53a984a3SEd Maste extern ServerOptions options;
75*53a984a3SEd Maste extern Buffer loginmsg;
76*53a984a3SEd Maste@@ -526,6 +527,7 @@
77*53a984a3SEd Maste 		ssh_msg_send(ctxt->pam_csock, PAM_MAXTRIES, &buffer);
78*53a984a3SEd Maste 	else
79*53a984a3SEd Maste 		ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer);
80*53a984a3SEd Maste+	pfilter_notify(1);
81*53a984a3SEd Maste 	buffer_free(&buffer);
82*53a984a3SEd Maste 	pthread_exit(NULL);
83*53a984a3SEd Maste
84*53a984a3SEd Maste@@ -804,6 +806,7 @@
85*53a984a3SEd Maste 				free(msg);
86*53a984a3SEd Maste 				return (0);
87*53a984a3SEd Maste 			}
88*53a984a3SEd Maste+			pfilter_notify(1);
89*53a984a3SEd Maste 			error("PAM: %s for %s%.100s from %.100s", msg,
90*53a984a3SEd Maste 			    sshpam_authctxt->valid ? "" : "illegal user ",
91*53a984a3SEd Maste 			    sshpam_authctxt->user,
92*53a984a3SEd Mastediff -ru openssh-7.7p1/auth2.c dist/auth2.c
93*53a984a3SEd Maste--- openssh-7.7p1/auth2.c	2018-04-02 01:38:28.000000000 -0400
94*53a984a3SEd Maste+++ dist/auth2.c	2018-05-23 11:57:31.022197317 -0400
95*53a984a3SEd Maste@@ -51,6 +51,7 @@
96*53a984a3SEd Maste #include "dispatch.h"
97*53a984a3SEd Maste #include "pathnames.h"
98*53a984a3SEd Maste #include "buffer.h"
99*53a984a3SEd Maste+#include "pfilter.h"
100*53a984a3SEd Maste
101*53a984a3SEd Maste #ifdef GSSAPI
102*53a984a3SEd Maste #include "ssh-gss.h"
103*53a984a3SEd Maste@@ -242,6 +243,7 @@
104*53a984a3SEd Maste 		} else {
105*53a984a3SEd Maste 			/* Invalid user, fake password information */
106*53a984a3SEd Maste 			authctxt->pw = fakepw();
107*53a984a3SEd Maste+			pfilter_notify(1);
108*53a984a3SEd Maste #ifdef SSH_AUDIT_EVENTS
109*53a984a3SEd Maste 			PRIVSEP(audit_event(SSH_INVALID_USER));
110*53a984a3SEd Maste #endif
111*53a984a3SEd MasteOnly in dist: pfilter.c
112*53a984a3SEd MasteOnly in dist: pfilter.h
113*53a984a3SEd Mastediff -ru openssh-7.7p1/sshd.c dist/sshd.c
114*53a984a3SEd Maste--- openssh-7.7p1/sshd.c	2018-04-02 01:38:28.000000000 -0400
115*53a984a3SEd Maste+++ dist/sshd.c	2018-05-23 11:59:39.573197347 -0400
116*53a984a3SEd Maste@@ -122,6 +122,7 @@
117*53a984a3SEd Maste #include "auth-options.h"
118*53a984a3SEd Maste #include "version.h"
119*53a984a3SEd Maste #include "ssherr.h"
120*53a984a3SEd Maste+#include "pfilter.h"
121*53a984a3SEd Maste
122*53a984a3SEd Maste /* Re-exec fds */
123*53a984a3SEd Maste #define REEXEC_DEVCRYPTO_RESERVED_FD	(STDERR_FILENO + 1)
124*53a984a3SEd Maste@@ -346,6 +347,7 @@
125*53a984a3SEd Maste static void
126*53a984a3SEd Maste grace_alarm_handler(int sig)
127*53a984a3SEd Maste {
128*53a984a3SEd Maste+	pfilter_notify(1);
129*53a984a3SEd Maste 	if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0)
130*53a984a3SEd Maste 		kill(pmonitor->m_pid, SIGALRM);
131*53a984a3SEd Maste
132*53a984a3SEd Maste@@ -1835,6 +1837,8 @@
133*53a984a3SEd Maste 	if (test_flag)
134*53a984a3SEd Maste 		exit(0);
135*53a984a3SEd Maste
136*53a984a3SEd Maste+	pfilter_init();
137*53a984a3SEd Maste+
138*53a984a3SEd Maste 	/*
139*53a984a3SEd Maste 	 * Clear out any supplemental groups we may have inherited.  This
140*53a984a3SEd Maste 	 * prevents inadvertent creation of files with bad modes (in the
141*53a984a3SEd Maste@@ -2280,6 +2284,9 @@
142*53a984a3SEd Maste {
143*53a984a3SEd Maste 	struct ssh *ssh = active_state; /* XXX */
144*53a984a3SEd Maste
145*53a984a3SEd Maste+	if (i == 255)
146*53a984a3SEd Maste+		pfilter_notify(1);
147*53a984a3SEd Maste+
148*53a984a3SEd Maste 	if (the_authctxt) {
149*53a984a3SEd Maste 		do_cleanup(ssh, the_authctxt);
150*53a984a3SEd Maste 		if (use_privsep && privsep_is_preauth &&
151