diff options
author | Dirk Meyer <dinoex@FreeBSD.org> | 2004-03-26 19:03:18 +0000 |
---|---|---|
committer | Dirk Meyer <dinoex@FreeBSD.org> | 2004-03-26 19:03:18 +0000 |
commit | 07f037cbebc5f4f397ed0c6ff90b916103dafee9 (patch) | |
tree | ed3006f34e7ac2b94251522efc33ad122a6a704a /mail/sendmail | |
parent | - make PKGNAMESUFFIX more flexible (diff) |
- new option SENDMAIL_WITH_CONNECTION_RATE
taken from:
http://j-chkmail.ensmp.fr/sm/
Notes
Notes:
svn path=/head/; revision=105366
Diffstat (limited to 'mail/sendmail')
-rw-r--r-- | mail/sendmail/Makefile | 18 | ||||
-rw-r--r-- | mail/sendmail/distinfo | 4 | ||||
-rw-r--r-- | mail/sendmail/files/CONNECTION_RATE_CONTROL | 167 |
3 files changed, 189 insertions, 0 deletions
diff --git a/mail/sendmail/Makefile b/mail/sendmail/Makefile index 7d6bf1b37ce7..1809f73bfe6b 100644 --- a/mail/sendmail/Makefile +++ b/mail/sendmail/Makefile @@ -13,6 +13,11 @@ MASTER_SITES= ftp://ftp.sendmail.org/pub/sendmail/ \ PKGNAMESUFFIX?= ${TLS_SUFFIX}${SASL_SUFFIX}${LDAP_SUFFIX}${PKGNAMESUFFIX2} DISTNAME= ${PORTNAME}.${PORTVERSION} +.if defined(SENDMAIL_WITH_CONNECTION_RATE) +PATCH_SITES= http://j-chkmail.ensmp.fr/sm/ +PATCHFILES= ratectrl.src-v2.patch ratectrl.cf.patch +.endif + MAINTAINER= dinoex@FreeBSD.org COMMENT= Reliable, highly configurable mail transfer agent with utilities @@ -46,6 +51,7 @@ PKGMESSAGE= ${WRKSRC}/pkg-message # SENDMAIL_WITH_LDAP=yes # SENDMAIL_WITH_SOCKETMAP=yes # SENDMAIL_WITH_PICKY_HELO_CHECK=yes +# SENDMAIL_WITH_CONNECTION_RATE=yes .if defined(SENDMAIL_WITH_SMTPS) .if !defined(SENDMAIL_WITH_TLS) && !defined(WITH_TLS) @@ -179,6 +185,11 @@ do-configure: 'APPENDDEF(`conf_sendmail_ENVDEF'\'', `-DPICKY_HELO_CHECK'\'')' \ >> ${WCONF}/site.config.m4 .endif +.if defined(SENDMAIL_WITH_CONNECTION_RATE) + ${ECHO_CMD} \ + 'APPENDDEF(`conf_sendmail_ENVDEF'\'', `-D_FFR_CONNECTION_RATE_CONTROL'\'') \ + >> ${WCONF}/site.config.m4 +.endif .if defined(SENDMAIL_WITHOUT_SHMEM) ${ECHO_CMD} \ 'APPENDDEF(`confENVDEF'\'', `-DSM_CONF_SHM=0'\'')' \ @@ -209,6 +220,9 @@ pre-install: @${ECHO_CMD} `${BASENAME} ${i}` | \ ${AWK} '{print "%%DOCSDIR%%/" $$1}' >>${PLIST} .endfor +.if defined(SENDMAIL_WITH_CONNECTION_RATE) + @${ECHO_CMD} "share/doc/sendmail/CONNECTION_RATE_CONTROL" >>${PLIST} +.endif @${ECHO_CMD} "@dirrm %%DOCSDIR%%" >>${PLIST} .endif @@ -264,6 +278,10 @@ post-install: @${TAR} -C ${WRKSRC}/libmilter/docs -cf - . | \ ${TAR} -C ${DOCSDIR}/libmilter -xf - .endif +.if defined(SENDMAIL_WITH_CONNECTION_RATE) + ${INSTALL_DATA} ${FILESDIR}/CONNECTION_RATE_CONTROL \ + ${DOCSDIR}/CONNECTION_RATE_CONTROL +.endif .endif .if exists(${DESTDIR}/etc/mail/mailer.conf) @${CAT} ${PKGMESSAGE} diff --git a/mail/sendmail/distinfo b/mail/sendmail/distinfo index 7269f30c8b84..8d7d6cb46765 100644 --- a/mail/sendmail/distinfo +++ b/mail/sendmail/distinfo @@ -1,2 +1,6 @@ MD5 (sendmail.8.12.11.tar.gz) = fafda7f8043f0c34b9aa295618aa598c SIZE (sendmail.8.12.11.tar.gz) = 1899112 +MD5 (ratectrl.src-v2.patch) = 19fdd5cf759ef693f8f721bcc1b85740 +SIZE (ratectrl.src-v2.patch) = 19321 +MD5 (ratectrl.cf.patch) = 5d88ba0fd3416ded5c908983308fa73a +SIZE (ratectrl.cf.patch) = 1722 diff --git a/mail/sendmail/files/CONNECTION_RATE_CONTROL b/mail/sendmail/files/CONNECTION_RATE_CONTROL new file mode 100644 index 000000000000..4b6a87fa276a --- /dev/null +++ b/mail/sendmail/files/CONNECTION_RATE_CONTROL @@ -0,0 +1,167 @@ + + CONNECTION RATE CONTROL FOR SENDMAIL + ------------------------------------ + +This patch adds connection rate control feature to sendmail. + +This means : + +- sendmail counts on a sliding window the number of connections + for each smtp client, and if it exceeds maximum configured + value, connection is refused with a TEMPFAIL result. + +- you may surely want to exclude some hosts/networks from this + control (local networks, trusted networks, ...). You may + indicate the list of trusted servers (by ip address) at + some configuration file. + +This file Table of Contents : + + 1. Remarks + 2. Changes and History + 3. Getting the stuff + 4. Stuff Contents + 5. Installing + +****************************************************************** + +REMARKS : +--------- + +* This feature will be integrated into sendmail in a future version. + +* This feature is experimental. Some details on the way it works + or its interface may change in the future. + +* The contents of this stuff is valid for sendmail 8.12.9 + + All feedback, comments and questions about this stuff are welcome : + Jose-Marcio.Martins@ensmp.fr (the maintainer) + with CC to + sendmail@sendmail.org + +CHANGES AND HISTORY : +--------------------- + +2003/06/11 - Jose Marcio Martins da Cruz - First Release + +2003/07/03 - Jose Marcio Martins da Cruz + Two macros were defined : + - {client_rate} : connection rate of the client + - {server_rate} : connection rate of the server + +GETTING THE STUFF : +------------------- + +You can download all you need at : + + http://j-chkmail.ensmp.fr/sm + +You need the two patches you'll find there. + +STUFF CONTENTS : +---------------- + +This stuff contains two patches : + +- ratectrl.src.patch : this patch shall be used to modify + /PATH_TO_SRC/sendmail-8.12.9/sendmail - sendmail C source + files + +- ratectrl.cf.patch : this patch shall be used to modify + /PATH_TO_SRC/sendmail-8.12.9/cf - m4 configuration kit + for sendmail + +- rate.mc : this is an example of configuration file to be + used with this stuff, if you want to do connection rate + control with rulesets. To use it, you shall define the + variable : + D{RuleRateMaxClient}5 + This contribution comes from Stephane Lentz + Stephane.Lentz@ansf.alcatel.fr + + +INSTALLING : +------------ + +1. Copy the patches : + + cd /PATH_TO/sendmail-8.12.9 + cp /elsewhere/ratectrl.src.patch . + cp /elsewhere/ratectrl.cf.patch . + +2. Eventually save original source code : + + cp -pr sendmail sendmail.org + cp -pr cf cf.org + +3. Apply the patches + + cd sendmail + patch < ../ratectrl.src.patch + cd ../cf + patch < ../ratectrl.cf.patch + +4. Inform sendmail Build system that you want to use this stuff + + Add the following line to the file devtools/Site/site.config.m4 : + +APPENDDEF(`confENVDEF',`-D_FFR_CONNECTION_RATE_CONTROL') + +5. Rebuild sendmail and install + + cd /PATH_TO/sendmail-8.12.9 + ./Build -c + su + ./Build install + +6. Modify your configuration file (sendmail.mc for your site) + +You may add the following lines : + + FEATURE(rate_control) + +This will create the following lines at your sendmail.cf file : + +----- + +O CheckConnectionRate=True + +F{rate_exclude} -o /etc/mail/rate-control-exclude + +# maximum server connection rate (connections / minute) +#O MaxConnectionRate=600 + +# maximum connection rate per client (connections / minute) +#O MaxClientConnectionRate=5 + +# Width of the window +#O ConnectionRateWindowSize=60 + +---- + +Configuration parameters you may define at your mc file + +confRATE_EXCLUDE_FILE The name of the file defining class {rate_exclude}. + Access to the server will be granted to IP hosts + networks matching this class without connection + rate control. + Default Value : /etc/mail/rate-control-exclude + +confMAX_CLIENT_CONNECTION_RATE : Maximum connections per minute allowed + for hosts/networks not matching {rate_exclude} + class. + Default Value : 5 connections / minute. + +confMAX_CONNECTION_RATE : Maximum connections per minute for the server. + Default Value : 600 connections / minute. + +confCONNECTION_RATE_WINDOW_SIZE : Width of the measuring sliding window. + The value used to do rate control is the mean + of the number of connections inside this window. + Default Value : 60 (1 minute) + + + + + |