1*53a984a3SEd Maste--- Make.rules.in.orig 2015-05-27 20:25:54.000000000 -0400 2*53a984a3SEd Maste+++ Make.rules.in 2016-01-25 21:48:47.000000000 -0500 3*53a984a3SEd Maste@@ -110,3 +110,8 @@ 4*53a984a3SEd Maste 5*53a984a3SEd Maste FTPWHO_OBJS=ftpwho.o scoreboard.o misc.o 6*53a984a3SEd Maste BUILD_FTPWHO_OBJS=utils/ftpwho.o utils/scoreboard.o utils/misc.o 7*53a984a3SEd Maste+ 8*53a984a3SEd Maste+CPPFLAGS+=-DHAVE_BLACKLIST 9*53a984a3SEd Maste+LIBS+=-lblacklist 10*53a984a3SEd Maste+OBJS+= pfilter.o 11*53a984a3SEd Maste+BUILD_OBJS+= src/pfilter.o 12*53a984a3SEd Maste--- /dev/null 2016-01-22 17:30:55.000000000 -0500 13*53a984a3SEd Maste+++ include/pfilter.h 2016-01-22 16:18:33.000000000 -0500 14*53a984a3SEd Maste@@ -0,0 +1,3 @@ 15*53a984a3SEd Maste+ 16*53a984a3SEd Maste+void pfilter_notify(int); 17*53a984a3SEd Maste+void pfilter_init(void); 18*53a984a3SEd Maste--- modules/mod_auth.c.orig 2015-05-27 20:25:54.000000000 -0400 19*53a984a3SEd Maste+++ modules/mod_auth.c 2016-01-22 16:21:06.000000000 -0500 20*53a984a3SEd Maste@@ -30,6 +30,7 @@ 21*53a984a3SEd Maste 22*53a984a3SEd Maste #include "conf.h" 23*53a984a3SEd Maste #include "privs.h" 24*53a984a3SEd Maste+#include "pfilter.h" 25*53a984a3SEd Maste 26*53a984a3SEd Maste extern pid_t mpid; 27*53a984a3SEd Maste 28*53a984a3SEd Maste@@ -84,6 +85,8 @@ 29*53a984a3SEd Maste _("Login timeout (%d %s): closing control connection"), TimeoutLogin, 30*53a984a3SEd Maste TimeoutLogin != 1 ? "seconds" : "second"); 31*53a984a3SEd Maste 32*53a984a3SEd Maste+ pfilter_notify(1); 33*53a984a3SEd Maste+ 34*53a984a3SEd Maste /* It's possible that any listeners of this event might terminate the 35*53a984a3SEd Maste * session process themselves (e.g. mod_ban). So write out that the 36*53a984a3SEd Maste * TimeoutLogin has been exceeded to the log here, in addition to the 37*53a984a3SEd Maste@@ -913,6 +916,7 @@ 38*53a984a3SEd Maste pr_memscrub(pass, strlen(pass)); 39*53a984a3SEd Maste } 40*53a984a3SEd Maste 41*53a984a3SEd Maste+ pfilter_notify(1); 42*53a984a3SEd Maste pr_log_auth(PR_LOG_NOTICE, "SECURITY VIOLATION: Root login attempted"); 43*53a984a3SEd Maste return 0; 44*53a984a3SEd Maste } 45*53a984a3SEd Maste@@ -1726,6 +1730,7 @@ 46*53a984a3SEd Maste return 1; 47*53a984a3SEd Maste 48*53a984a3SEd Maste auth_failure: 49*53a984a3SEd Maste+ pfilter_notify(1); 50*53a984a3SEd Maste if (pass) 51*53a984a3SEd Maste pr_memscrub(pass, strlen(pass)); 52*53a984a3SEd Maste session.user = session.group = NULL; 53*53a984a3SEd Maste--- src/main.c.orig 2016-01-22 17:36:43.000000000 -0500 54*53a984a3SEd Maste+++ src/main.c 2016-01-22 17:37:58.000000000 -0500 55*53a984a3SEd Maste@@ -49,6 +49,7 @@ 56*53a984a3SEd Maste #endif 57*53a984a3SEd Maste 58*53a984a3SEd Maste #include "privs.h" 59*53a984a3SEd Maste+#include "pfilter.h" 60*53a984a3SEd Maste 61*53a984a3SEd Maste int (*cmd_auth_chk)(cmd_rec *); 62*53a984a3SEd Maste void (*cmd_handler)(server_rec *, conn_t *); 63*53a984a3SEd Maste@@ -1050,6 +1051,7 @@ 64*53a984a3SEd Maste pid_t pid; 65*53a984a3SEd Maste sigset_t sig_set; 66*53a984a3SEd Maste 67*53a984a3SEd Maste+ pfilter_init(); 68*53a984a3SEd Maste if (!nofork) { 69*53a984a3SEd Maste 70*53a984a3SEd Maste /* A race condition exists on heavily loaded servers where the parent 71*53a984a3SEd Maste@@ -1169,7 +1171,8 @@ 72*53a984a3SEd Maste 73*53a984a3SEd Maste /* Reseed pseudo-randoms */ 74*53a984a3SEd Maste srand((unsigned int) (time(NULL) * getpid())); 75*53a984a3SEd Maste- 76*53a984a3SEd Maste+#else 77*53a984a3SEd Maste+ pfilter_init(); 78*53a984a3SEd Maste #endif /* PR_DEVEL_NO_FORK */ 79*53a984a3SEd Maste 80*53a984a3SEd Maste /* Child is running here */ 81*53a984a3SEd Maste--- /dev/null 2016-01-22 17:30:55.000000000 -0500 82*53a984a3SEd Maste+++ src/pfilter.c 2016-01-22 16:37:55.000000000 -0500 83*53a984a3SEd Maste@@ -0,0 +1,41 @@ 84*53a984a3SEd Maste+#include "pfilter.h" 85*53a984a3SEd Maste+#include "conf.h" 86*53a984a3SEd Maste+#include "privs.h" 87*53a984a3SEd Maste+#ifdef HAVE_BLACKLIST 88*53a984a3SEd Maste+#include <blacklist.h> 89*53a984a3SEd Maste+#endif 90*53a984a3SEd Maste+ 91*53a984a3SEd Maste+static struct blacklist *blstate; 92*53a984a3SEd Maste+ 93*53a984a3SEd Maste+void 94*53a984a3SEd Maste+pfilter_init(void) 95*53a984a3SEd Maste+{ 96*53a984a3SEd Maste+#ifdef HAVE_BLACKLIST 97*53a984a3SEd Maste+ if (blstate == NULL) 98*53a984a3SEd Maste+ blstate = blacklist_open(); 99*53a984a3SEd Maste+#endif 100*53a984a3SEd Maste+} 101*53a984a3SEd Maste+ 102*53a984a3SEd Maste+void 103*53a984a3SEd Maste+pfilter_notify(int a) 104*53a984a3SEd Maste+{ 105*53a984a3SEd Maste+#ifdef HAVE_BLACKLIST 106*53a984a3SEd Maste+ conn_t *c = session.c; 107*53a984a3SEd Maste+ int fd; 108*53a984a3SEd Maste+ 109*53a984a3SEd Maste+ if (c == NULL) 110*53a984a3SEd Maste+ return; 111*53a984a3SEd Maste+ if (c->rfd != -1) 112*53a984a3SEd Maste+ fd = c->rfd; 113*53a984a3SEd Maste+ else if (c->wfd != -1) 114*53a984a3SEd Maste+ fd = c->wfd; 115*53a984a3SEd Maste+ else 116*53a984a3SEd Maste+ return; 117*53a984a3SEd Maste+ 118*53a984a3SEd Maste+ if (blstate == NULL) 119*53a984a3SEd Maste+ pfilter_init(); 120*53a984a3SEd Maste+ if (blstate == NULL) 121*53a984a3SEd Maste+ return; 122*53a984a3SEd Maste+ (void)blacklist_r(blstate, a, fd, "proftpd"); 123*53a984a3SEd Maste+#endif 124*53a984a3SEd Maste+} 125