1df0cfa3bSKurt Lidl--- /dev/null 2015-01-22 23:10:33.000000000 -0500 2df0cfa3bSKurt Lidl+++ dist/pfilter.c 2015-01-22 23:46:03.000000000 -0500 3758bdc24SEd Maste@@ -0,0 +1,32 @@ 4df0cfa3bSKurt Lidl+#include "namespace.h" 5df0cfa3bSKurt Lidl+#include "includes.h" 6df0cfa3bSKurt Lidl+#include "ssh.h" 7df0cfa3bSKurt Lidl+#include "packet.h" 8df0cfa3bSKurt Lidl+#include "log.h" 9df0cfa3bSKurt Lidl+#include "pfilter.h" 10e6a066acSEd Maste+#include <blocklist.h> 11df0cfa3bSKurt Lidl+ 12e6a066acSEd Maste+static struct blocklist *blstate; 13df0cfa3bSKurt Lidl+ 14df0cfa3bSKurt Lidl+void 15df0cfa3bSKurt Lidl+pfilter_init(void) 16df0cfa3bSKurt Lidl+{ 17e6a066acSEd Maste+ blstate = blocklist_open(); 18df0cfa3bSKurt Lidl+} 19df0cfa3bSKurt Lidl+ 20df0cfa3bSKurt Lidl+void 21df0cfa3bSKurt Lidl+pfilter_notify(int a) 22df0cfa3bSKurt Lidl+{ 23df0cfa3bSKurt Lidl+ int fd; 24df0cfa3bSKurt Lidl+ if (blstate == NULL) 25df0cfa3bSKurt Lidl+ pfilter_init(); 26df0cfa3bSKurt Lidl+ if (blstate == NULL) 27df0cfa3bSKurt Lidl+ return; 28df0cfa3bSKurt Lidl+ // XXX: 3? 29df0cfa3bSKurt Lidl+ fd = packet_connection_is_on_socket() ? packet_get_connection_in() : 3; 30e6a066acSEd Maste+ (void)blocklist_r(blstate, a, fd, "ssh"); 31758bdc24SEd Maste+ if (a == 0) { 32e6a066acSEd Maste+ blocklist_close(blstate); 33758bdc24SEd Maste+ blstate = NULL; 34758bdc24SEd Maste+ } 35df0cfa3bSKurt Lidl+} 36df0cfa3bSKurt Lidl--- /dev/null 2015-01-20 21:14:44.000000000 -0500 37df0cfa3bSKurt Lidl+++ dist/pfilter.h 2015-01-20 20:16:20.000000000 -0500 38df0cfa3bSKurt Lidl@@ -0,0 +1,3 @@ 39df0cfa3bSKurt Lidl+ 40df0cfa3bSKurt Lidl+void pfilter_notify(int); 41df0cfa3bSKurt Lidl+void pfilter_init(void); 42df0cfa3bSKurt LidlIndex: bin/sshd/Makefile 43df0cfa3bSKurt Lidl=================================================================== 44df0cfa3bSKurt LidlRCS file: /cvsroot/src/crypto/external/bsd/openssh/bin/sshd/Makefile,v 45df0cfa3bSKurt Lidlretrieving revision 1.10 46df0cfa3bSKurt Lidldiff -u -u -r1.10 Makefile 47df0cfa3bSKurt Lidl--- bin/sshd/Makefile 19 Oct 2014 16:30:58 -0000 1.10 48df0cfa3bSKurt Lidl+++ bin/sshd/Makefile 22 Jan 2015 21:39:21 -0000 49df0cfa3bSKurt Lidl@@ -15,7 +15,7 @@ 50df0cfa3bSKurt Lidl auth2-none.c auth2-passwd.c auth2-pubkey.c \ 51df0cfa3bSKurt Lidl monitor_mm.c monitor.c monitor_wrap.c \ 52df0cfa3bSKurt Lidl kexdhs.c kexgexs.c kexecdhs.c sftp-server.c sftp-common.c \ 53df0cfa3bSKurt Lidl- roaming_common.c roaming_serv.c sandbox-rlimit.c 54df0cfa3bSKurt Lidl+ roaming_common.c roaming_serv.c sandbox-rlimit.c pfilter.c 55df0cfa3bSKurt Lidl 56df0cfa3bSKurt Lidl COPTS.auth-options.c= -Wno-pointer-sign 57df0cfa3bSKurt Lidl COPTS.ldapauth.c= -Wno-format-nonliteral # XXX: should fix 58df0cfa3bSKurt Lidl@@ -68,3 +68,6 @@ 59df0cfa3bSKurt Lidl 60df0cfa3bSKurt Lidl LDADD+= -lwrap 61df0cfa3bSKurt Lidl DPADD+= ${LIBWRAP} 62df0cfa3bSKurt Lidl+ 63e6a066acSEd Maste+LDADD+= -lblocklist 64e6a066acSEd Maste+DPADD+= ${LIBBLOCKLIST} 65758bdc24SEd Mastediff -ru openssh-7.7p1/auth-pam.c dist/auth-pam.c 66758bdc24SEd Maste--- openssh-7.7p1/auth-pam.c 2018-04-02 01:38:28.000000000 -0400 67758bdc24SEd Maste+++ dist/auth-pam.c 2018-05-23 11:56:22.206661484 -0400 68758bdc24SEd Maste@@ -103,6 +103,7 @@ 69df0cfa3bSKurt Lidl #include "ssh-gss.h" 70df0cfa3bSKurt Lidl #endif 71df0cfa3bSKurt Lidl #include "monitor_wrap.h" 72df0cfa3bSKurt Lidl+#include "pfilter.h" 73df0cfa3bSKurt Lidl 74df0cfa3bSKurt Lidl extern ServerOptions options; 75df0cfa3bSKurt Lidl extern Buffer loginmsg; 76758bdc24SEd Maste@@ -526,6 +527,7 @@ 77758bdc24SEd Maste ssh_msg_send(ctxt->pam_csock, PAM_MAXTRIES, &buffer); 78758bdc24SEd Maste else 79758bdc24SEd Maste ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer); 80758bdc24SEd Maste+ pfilter_notify(1); 81758bdc24SEd Maste buffer_free(&buffer); 82758bdc24SEd Maste pthread_exit(NULL); 83758bdc24SEd Maste 84758bdc24SEd Maste@@ -804,6 +806,7 @@ 85df0cfa3bSKurt Lidl free(msg); 86df0cfa3bSKurt Lidl return (0); 87df0cfa3bSKurt Lidl } 88df0cfa3bSKurt Lidl+ pfilter_notify(1); 89df0cfa3bSKurt Lidl error("PAM: %s for %s%.100s from %.100s", msg, 90df0cfa3bSKurt Lidl sshpam_authctxt->valid ? "" : "illegal user ", 91df0cfa3bSKurt Lidl sshpam_authctxt->user, 92758bdc24SEd Mastediff -ru openssh-7.7p1/auth2.c dist/auth2.c 93758bdc24SEd Maste--- openssh-7.7p1/auth2.c 2018-04-02 01:38:28.000000000 -0400 94758bdc24SEd Maste+++ dist/auth2.c 2018-05-23 11:57:31.022197317 -0400 95758bdc24SEd Maste@@ -51,6 +51,7 @@ 96758bdc24SEd Maste #include "dispatch.h" 97758bdc24SEd Maste #include "pathnames.h" 98758bdc24SEd Maste #include "buffer.h" 99758bdc24SEd Maste+#include "pfilter.h" 100df0cfa3bSKurt Lidl 101758bdc24SEd Maste #ifdef GSSAPI 102758bdc24SEd Maste #include "ssh-gss.h" 103758bdc24SEd Maste@@ -242,6 +243,7 @@ 104758bdc24SEd Maste } else { 105758bdc24SEd Maste /* Invalid user, fake password information */ 106758bdc24SEd Maste authctxt->pw = fakepw(); 107df0cfa3bSKurt Lidl+ pfilter_notify(1); 108758bdc24SEd Maste #ifdef SSH_AUDIT_EVENTS 109758bdc24SEd Maste PRIVSEP(audit_event(SSH_INVALID_USER)); 110758bdc24SEd Maste #endif 111758bdc24SEd MasteOnly in dist: pfilter.c 112758bdc24SEd MasteOnly in dist: pfilter.h 113758bdc24SEd Mastediff -ru openssh-7.7p1/sshd.c dist/sshd.c 114758bdc24SEd Maste--- openssh-7.7p1/sshd.c 2018-04-02 01:38:28.000000000 -0400 115758bdc24SEd Maste+++ dist/sshd.c 2018-05-23 11:59:39.573197347 -0400 116758bdc24SEd Maste@@ -122,6 +122,7 @@ 117758bdc24SEd Maste #include "auth-options.h" 118758bdc24SEd Maste #include "version.h" 119758bdc24SEd Maste #include "ssherr.h" 120758bdc24SEd Maste+#include "pfilter.h" 121df0cfa3bSKurt Lidl 122758bdc24SEd Maste /* Re-exec fds */ 123758bdc24SEd Maste #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) 124758bdc24SEd Maste@@ -346,6 +347,7 @@ 125758bdc24SEd Maste static void 126758bdc24SEd Maste grace_alarm_handler(int sig) 127758bdc24SEd Maste { 128df0cfa3bSKurt Lidl+ pfilter_notify(1); 129758bdc24SEd Maste if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0) 130758bdc24SEd Maste kill(pmonitor->m_pid, SIGALRM); 131758bdc24SEd Maste 132758bdc24SEd Maste@@ -1835,6 +1837,8 @@ 133758bdc24SEd Maste if (test_flag) 134758bdc24SEd Maste exit(0); 135758bdc24SEd Maste 136758bdc24SEd Maste+ pfilter_init(); 137758bdc24SEd Maste+ 138758bdc24SEd Maste /* 139758bdc24SEd Maste * Clear out any supplemental groups we may have inherited. This 140758bdc24SEd Maste * prevents inadvertent creation of files with bad modes (in the 141758bdc24SEd Maste@@ -2280,6 +2284,9 @@ 142758bdc24SEd Maste { 143758bdc24SEd Maste struct ssh *ssh = active_state; /* XXX */ 144758bdc24SEd Maste 145758bdc24SEd Maste+ if (i == 255) 146758bdc24SEd Maste+ pfilter_notify(1); 147758bdc24SEd Maste+ 148758bdc24SEd Maste if (the_authctxt) { 149758bdc24SEd Maste do_cleanup(ssh, the_authctxt); 150758bdc24SEd Maste if (use_privsep && privsep_is_preauth && 151