From owner-svn-ports-all@freebsd.org Sun Mar 24 20:35:46 2019 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD5A01542F2C; Sun, 24 Mar 2019 20:35:46 +0000 (UTC) (envelope-from dinoex@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7473A9609F; Sun, 24 Mar 2019 20:35:46 +0000 (UTC) (envelope-from dinoex@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B6F925705; Sun, 24 Mar 2019 20:35:46 +0000 (UTC) (envelope-from dinoex@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2OKZkhX068207; Sun, 24 Mar 2019 20:35:46 GMT (envelope-from dinoex@FreeBSD.org) Received: (from dinoex@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2OKZkid068206; Sun, 24 Mar 2019 20:35:46 GMT (envelope-from dinoex@FreeBSD.org) Message-Id: <201903242035.x2OKZkid068206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dinoex set sender to dinoex@FreeBSD.org using -f From: Dirk Meyer Date: Sun, 24 Mar 2019 20:35:46 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r496779 - head/mail/sendmail/files X-SVN-Group: ports-head X-SVN-Commit-Author: dinoex X-SVN-Commit-Paths: head/mail/sendmail/files X-SVN-Commit-Revision: 496779 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7473A9609F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Mar 2019 20:35:47 -0000 Author: dinoex Date: Sun Mar 24 20:35:45 2019 New Revision: 496779 URL: https://svnweb.freebsd.org/changeset/ports/496779 Log: - additional blacklisting for frequent useless connections PR: 236605 Submitted by: Helge Oldach Modified: head/mail/sendmail/files/patch-srvrsmtp.c Modified: head/mail/sendmail/files/patch-srvrsmtp.c ============================================================================== --- head/mail/sendmail/files/patch-srvrsmtp.c Sun Mar 24 20:34:58 2019 (r496778) +++ head/mail/sendmail/files/patch-srvrsmtp.c Sun Mar 24 20:35:45 2019 (r496779) @@ -1,6 +1,16 @@ --- sendmail/srvrsmtp.c.orig 2015-03-18 11:47:12 UTC +++ sendmail/srvrsmtp.c -@@ -1328,6 +1328,7 @@ smtp(nullserver, d_flags, e) +@@ -831,6 +831,9 @@ smtp(nullserver, d_flags, e) + #if _FFR_BADRCPT_SHUTDOWN + int n_badrcpts_adj; + #endif /* _FFR_BADRCPT_SHUTDOWN */ ++#ifdef USE_BLACKLIST ++ int saved_bl_fd; ++#endif + + SevenBitInput_Saved = SevenBitInput; + smtp.sm_nrcpts = 0; +@@ -1328,6 +1331,7 @@ smtp(nullserver, d_flags, e) (int) tp.tv_sec + (tp.tv_usec >= 500000 ? 1 : 0) ); @@ -8,7 +18,18 @@ } } } -@@ -1721,8 +1722,11 @@ smtp(nullserver, d_flags, e) +@@ -1421,6 +1425,10 @@ smtp(nullserver, d_flags, e) + SmtpPhase = "server cmd read"; + sm_setproctitle(true, e, "server %s cmd read", CurSmtpClient); + ++#ifdef USE_BLACKLIST ++ saved_bl_fd = dup(sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL)); ++#endif ++ + /* handle errors */ + if (sm_io_error(OutChannel) || + (p = sfgets(inp, sizeof(inp), InChannel, +@@ -1721,8 +1729,11 @@ smtp(nullserver, d_flags, e) } else { @@ -20,7 +41,7 @@ if (LogLevel > 9) sm_syslog(LOG_WARNING, e->e_id, "AUTH failure (%s): %s (%d) %s, relay=%.100s", -@@ -1867,6 +1871,9 @@ smtp(nullserver, d_flags, e) +@@ -1867,6 +1878,9 @@ smtp(nullserver, d_flags, e) DELAY_CONN("AUTH"); if (!sasl_ok || n_mechs <= 0) { @@ -30,7 +51,25 @@ message("503 5.3.3 AUTH not available"); break; } -@@ -3523,7 +3530,10 @@ doquit: +@@ -3462,10 +3476,17 @@ doquit: + ** timeouts for the same connection. + */ + ++#ifdef USE_BLACKLIST ++ /* no immediate BLACKLIST_ABUSIVE_BEHAVIOR */ ++ BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, saved_bl_fd, "no command issued"); ++#endif + sm_syslog(LOG_INFO, e->e_id, + "%s did not issue MAIL/EXPN/VRFY/ETRN during connection to %s", + CurSmtpClient, d); + } ++#ifdef USE_BLACKLIST ++ close(saved_bl_fd); ++#endif + if (tTd(93, 100)) + { + /* return to handle next connection */ +@@ -3523,7 +3544,10 @@ doquit: #if MAXBADCOMMANDS > 0 if (++n_badcmds > MAXBADCOMMANDS) { @@ -41,3 +80,13 @@ message("421 4.7.0 %s Too many bad commands; closing connection", MyHostName); +@@ -3575,6 +3599,9 @@ doquit: + #if SASL + } + #endif /* SASL */ ++#ifdef USE_BLACKLIST ++ close(saved_bl_fd); ++#endif + } + SM_EXCEPT(exc, "[!F]*") + {