112017ca8SKurt Lidl--- /dev/null	2015-01-22 23:10:33.000000000 -0500
212017ca8SKurt Lidl+++ dist/pfilter.c	2015-01-22 23:46:03.000000000 -0500
3*e3a90f49SEd Maste@@ -0,0 +1,32 @@
412017ca8SKurt Lidl+#include "namespace.h"
512017ca8SKurt Lidl+#include "includes.h"
612017ca8SKurt Lidl+#include "ssh.h"
712017ca8SKurt Lidl+#include "packet.h"
812017ca8SKurt Lidl+#include "log.h"
912017ca8SKurt Lidl+#include "pfilter.h"
1012017ca8SKurt Lidl+#include <blacklist.h>
1112017ca8SKurt Lidl+
1212017ca8SKurt Lidl+static struct blacklist *blstate;
1312017ca8SKurt Lidl+
1412017ca8SKurt Lidl+void
1512017ca8SKurt Lidl+pfilter_init(void)
1612017ca8SKurt Lidl+{
1712017ca8SKurt Lidl+	blstate = blacklist_open();
1812017ca8SKurt Lidl+}
1912017ca8SKurt Lidl+
2012017ca8SKurt Lidl+void
2112017ca8SKurt Lidl+pfilter_notify(int a)
2212017ca8SKurt Lidl+{
2312017ca8SKurt Lidl+	int fd;
2412017ca8SKurt Lidl+	if (blstate == NULL)
2512017ca8SKurt Lidl+		pfilter_init();
2612017ca8SKurt Lidl+	if (blstate == NULL)
2712017ca8SKurt Lidl+		return;
2812017ca8SKurt Lidl+	// XXX: 3?
2912017ca8SKurt Lidl+ 	fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3;
3012017ca8SKurt Lidl+	(void)blacklist_r(blstate, a, fd, "ssh");
31*e3a90f49SEd Maste+	if (a == 0) {
32*e3a90f49SEd Maste+		blacklist_close(blstate);
33*e3a90f49SEd Maste+		blstate = NULL;
34*e3a90f49SEd Maste+	}
3512017ca8SKurt Lidl+}
3612017ca8SKurt Lidl--- /dev/null	2015-01-20 21:14:44.000000000 -0500
3712017ca8SKurt Lidl+++ dist/pfilter.h	2015-01-20 20:16:20.000000000 -0500
3812017ca8SKurt Lidl@@ -0,0 +1,3 @@
3912017ca8SKurt Lidl+
4012017ca8SKurt Lidl+void pfilter_notify(int);
4112017ca8SKurt Lidl+void pfilter_init(void);
4212017ca8SKurt LidlIndex: bin/sshd/Makefile
4312017ca8SKurt Lidl===================================================================
4412017ca8SKurt LidlRCS file: /cvsroot/src/crypto/external/bsd/openssh/bin/sshd/Makefile,v
4512017ca8SKurt Lidlretrieving revision 1.10
4612017ca8SKurt Lidldiff -u -u -r1.10 Makefile
4712017ca8SKurt Lidl--- bin/sshd/Makefile	19 Oct 2014 16:30:58 -0000	1.10
4812017ca8SKurt Lidl+++ bin/sshd/Makefile	22 Jan 2015 21:39:21 -0000
4912017ca8SKurt Lidl@@ -15,7 +15,7 @@
5012017ca8SKurt Lidl 	auth2-none.c auth2-passwd.c auth2-pubkey.c \
5112017ca8SKurt Lidl 	monitor_mm.c monitor.c monitor_wrap.c \
5212017ca8SKurt Lidl 	kexdhs.c kexgexs.c kexecdhs.c sftp-server.c sftp-common.c \
5312017ca8SKurt Lidl-	roaming_common.c roaming_serv.c sandbox-rlimit.c
5412017ca8SKurt Lidl+	roaming_common.c roaming_serv.c sandbox-rlimit.c pfilter.c
5512017ca8SKurt Lidl
5612017ca8SKurt Lidl COPTS.auth-options.c=	-Wno-pointer-sign
5712017ca8SKurt Lidl COPTS.ldapauth.c=	-Wno-format-nonliteral	# XXX: should fix
5812017ca8SKurt Lidl@@ -68,3 +68,6 @@
5912017ca8SKurt Lidl
6012017ca8SKurt Lidl LDADD+=	-lwrap
6112017ca8SKurt Lidl DPADD+=	${LIBWRAP}
6212017ca8SKurt Lidl+
6312017ca8SKurt Lidl+LDADD+=	-lblacklist
6412017ca8SKurt Lidl+DPADD+=	${LIBBLACKLIST}
65*e3a90f49SEd Mastediff -ru openssh-7.7p1/auth-pam.c dist/auth-pam.c
66*e3a90f49SEd Maste--- openssh-7.7p1/auth-pam.c	2018-04-02 01:38:28.000000000 -0400
67*e3a90f49SEd Maste+++ dist/auth-pam.c	2018-05-23 11:56:22.206661484 -0400
68*e3a90f49SEd Maste@@ -103,6 +103,7 @@
6912017ca8SKurt Lidl #include "ssh-gss.h"
7012017ca8SKurt Lidl #endif
7112017ca8SKurt Lidl #include "monitor_wrap.h"
7212017ca8SKurt Lidl+#include "pfilter.h"
7312017ca8SKurt Lidl
7412017ca8SKurt Lidl extern ServerOptions options;
7512017ca8SKurt Lidl extern Buffer loginmsg;
76*e3a90f49SEd Maste@@ -526,6 +527,7 @@
77*e3a90f49SEd Maste 		ssh_msg_send(ctxt->pam_csock, PAM_MAXTRIES, &buffer);
78*e3a90f49SEd Maste 	else
79*e3a90f49SEd Maste 		ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer);
80*e3a90f49SEd Maste+	pfilter_notify(1);
81*e3a90f49SEd Maste 	buffer_free(&buffer);
82*e3a90f49SEd Maste 	pthread_exit(NULL);
83*e3a90f49SEd Maste
84*e3a90f49SEd Maste@@ -804,6 +806,7 @@
8512017ca8SKurt Lidl 				free(msg);
8612017ca8SKurt Lidl 				return (0);
8712017ca8SKurt Lidl 			}
8812017ca8SKurt Lidl+			pfilter_notify(1);
8912017ca8SKurt Lidl 			error("PAM: %s for %s%.100s from %.100s", msg,
9012017ca8SKurt Lidl 			    sshpam_authctxt->valid ? "" : "illegal user ",
9112017ca8SKurt Lidl 			    sshpam_authctxt->user,
92*e3a90f49SEd Mastediff -ru openssh-7.7p1/auth2.c dist/auth2.c
93*e3a90f49SEd Maste--- openssh-7.7p1/auth2.c	2018-04-02 01:38:28.000000000 -0400
94*e3a90f49SEd Maste+++ dist/auth2.c	2018-05-23 11:57:31.022197317 -0400
95*e3a90f49SEd Maste@@ -51,6 +51,7 @@
96*e3a90f49SEd Maste #include "dispatch.h"
97*e3a90f49SEd Maste #include "pathnames.h"
98*e3a90f49SEd Maste #include "buffer.h"
99*e3a90f49SEd Maste+#include "pfilter.h"
10012017ca8SKurt Lidl
101*e3a90f49SEd Maste #ifdef GSSAPI
102*e3a90f49SEd Maste #include "ssh-gss.h"
103*e3a90f49SEd Maste@@ -242,6 +243,7 @@
104*e3a90f49SEd Maste 		} else {
105*e3a90f49SEd Maste 			/* Invalid user, fake password information */
106*e3a90f49SEd Maste 			authctxt->pw = fakepw();
10712017ca8SKurt Lidl+			pfilter_notify(1);
108*e3a90f49SEd Maste #ifdef SSH_AUDIT_EVENTS
109*e3a90f49SEd Maste 			PRIVSEP(audit_event(SSH_INVALID_USER));
110*e3a90f49SEd Maste #endif
111*e3a90f49SEd MasteOnly in dist: pfilter.c
112*e3a90f49SEd MasteOnly in dist: pfilter.h
113*e3a90f49SEd Mastediff -ru openssh-7.7p1/sshd.c dist/sshd.c
114*e3a90f49SEd Maste--- openssh-7.7p1/sshd.c	2018-04-02 01:38:28.000000000 -0400
115*e3a90f49SEd Maste+++ dist/sshd.c	2018-05-23 11:59:39.573197347 -0400
116*e3a90f49SEd Maste@@ -122,6 +122,7 @@
117*e3a90f49SEd Maste #include "auth-options.h"
118*e3a90f49SEd Maste #include "version.h"
119*e3a90f49SEd Maste #include "ssherr.h"
120*e3a90f49SEd Maste+#include "pfilter.h"
12112017ca8SKurt Lidl
122*e3a90f49SEd Maste /* Re-exec fds */
123*e3a90f49SEd Maste #define REEXEC_DEVCRYPTO_RESERVED_FD	(STDERR_FILENO + 1)
124*e3a90f49SEd Maste@@ -346,6 +347,7 @@
125*e3a90f49SEd Maste static void
126*e3a90f49SEd Maste grace_alarm_handler(int sig)
127*e3a90f49SEd Maste {
12812017ca8SKurt Lidl+	pfilter_notify(1);
129*e3a90f49SEd Maste 	if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0)
130*e3a90f49SEd Maste 		kill(pmonitor->m_pid, SIGALRM);
131*e3a90f49SEd Maste
132*e3a90f49SEd Maste@@ -1835,6 +1837,8 @@
133*e3a90f49SEd Maste 	if (test_flag)
134*e3a90f49SEd Maste 		exit(0);
135*e3a90f49SEd Maste
136*e3a90f49SEd Maste+	pfilter_init();
137*e3a90f49SEd Maste+
138*e3a90f49SEd Maste 	/*
139*e3a90f49SEd Maste 	 * Clear out any supplemental groups we may have inherited.  This
140*e3a90f49SEd Maste 	 * prevents inadvertent creation of files with bad modes (in the
141*e3a90f49SEd Maste@@ -2280,6 +2284,9 @@
142*e3a90f49SEd Maste {
143*e3a90f49SEd Maste 	struct ssh *ssh = active_state; /* XXX */
144*e3a90f49SEd Maste
145*e3a90f49SEd Maste+	if (i == 255)
146*e3a90f49SEd Maste+		pfilter_notify(1);
147*e3a90f49SEd Maste+
148*e3a90f49SEd Maste 	if (the_authctxt) {
149*e3a90f49SEd Maste 		do_cleanup(ssh, the_authctxt);
150*e3a90f49SEd Maste 		if (use_privsep && privsep_is_preauth &&
151