diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2005-03-13 11:20:42 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2005-03-13 11:20:42 +0000 |
commit | a89d6e8e86dcef470b71a84df7fef7903c7d5c4b (patch) | |
tree | d3380ee672c24da0e329bc8ad90fb890e24a651b /mail/spamass-milter | |
parent | 38bcab2540a1ff5d619afd6a892d404f26c5201a (diff) | |
download | ports-a89d6e8e86dcef470b71a84df7fef7903c7d5c4b.tar.gz ports-a89d6e8e86dcef470b71a84df7fef7903c7d5c4b.zip |
Notes
Diffstat (limited to 'mail/spamass-milter')
-rw-r--r-- | mail/spamass-milter/Makefile | 44 | ||||
-rw-r--r-- | mail/spamass-milter/distinfo | 4 | ||||
-rw-r--r-- | mail/spamass-milter/files/activation.txt | 56 | ||||
-rw-r--r-- | mail/spamass-milter/files/patch-spamass-milter.cpp | 64 | ||||
-rw-r--r-- | mail/spamass-milter/files/spamass-milter.sh | 26 | ||||
-rw-r--r-- | mail/spamass-milter/pkg-descr | 6 | ||||
-rw-r--r-- | mail/spamass-milter/pkg-message | 15 | ||||
-rw-r--r-- | mail/spamass-milter/pkg-plist | 3 |
8 files changed, 81 insertions, 137 deletions
diff --git a/mail/spamass-milter/Makefile b/mail/spamass-milter/Makefile index 125f7296a038..4b903031dec5 100644 --- a/mail/spamass-milter/Makefile +++ b/mail/spamass-milter/Makefile @@ -6,29 +6,28 @@ # PORTNAME= spamass-milter -PORTVERSION= 0.2.0 -PORTREVISION= 5 +PORTVERSION= 0.3.0 CATEGORIES= mail MASTER_SITES= ${MASTER_SITE_SAVANNAH} MASTER_SITE_SUBDIR= spamass-milt MAINTAINER= ports@FreeBSD.org -COMMENT= Sendmail Milter (mail filter) for SpamAssassin +COMMENT= Sendmail Milter (mail filter) plugin for SpamAssassin BUILD_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin RUN_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin +## +# Use the following quirks to choose which sendmail to use (ports or system): # -# You can choose the sendmail to be used by specifying +# WITH_SENDMAIL_BASE=yes +# or +# WITH_SENDMAIL_PORT=yes # -# WITH_SENDMAIL_BASE=yes -# or -# WITH_SENDMAIL_PORT=yes +# If unspecified, check for an up-to-date system version but give an +# installed port preference over it. # -# if no preference was set, check for an up to date base version -# but give an installed port preference over it. - .include <bsd.port.pre.mk> .if exists(${LOCALBASE}/lib/libldap.so) @@ -36,7 +35,7 @@ WITH_LDAP=yes .endif .if !defined(WITHOUT_LDAP) && defined(WITH_LDAP) -USE_OPENLDAP= yes +USE_OPENLDAP=yes .endif .if !defined(WITH_SENDMAIL_BASE) && \ @@ -56,36 +55,45 @@ BUILD_DEPENDS+= ${LOCALBASE}/lib/libmilter.a:${PORTSDIR}/mail/sendmail MILTERBASE?= ${LOCALBASE} .endif +.if !defined(NOPORTDOCS) +PORTDOCS= AUTHORS ChangeLog NEWS README TODO +.endif + MILTERINC= ${MILTERBASE}/include MILTERLIB= ${MILTERBASE}/lib CPPFLAGS+= -I${MILTERINC} LDFLAGS+= -L${MILTERLIB} -GNU_CONFIGURE= yes -CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" - USE_REINPLACE= yes - USE_RC_SUBR= yes +GNU_CONFIGURE= yes +CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} +PKGMESSAGE= ${WRKDIR}/pkg-message + MAN1= spamass-milter.1 post-patch: - @${SED} -e 's|/usr/local|${PREFIX}|g' \ - ${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${FILESDIR}/spamass-milter.sh > ${WRKDIR}/spamass-milter.sh + @${SED} -e's,%%PREFIX%%,${PREFIX},g' \ + ${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt .if !defined(WITHOUT_LDAP) && defined(WITH_LDAP) @${REINPLACE_CMD} -e 's|-lmilter|-lmilter -lldap|g' ${WRKSRC}/configure .endif + @${SED} -e's,%%DOCSDIR%%,${DOCSDIR},g' \ + ${MASTERDIR}/pkg-message > ${PKGMESSAGE} post-install: - @${INSTALL_SCRIPT} ${WRKDIR}/spamass-milter.sh ${PREFIX}/etc/rc.d/spamass-milter.sh + ${INSTALL_SCRIPT} ${WRKDIR}/spamass-milter.sh ${PREFIX}/etc/rc.d/spamass-milter.sh .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR} ${INSTALL_DATA} ${WRKDIR}/activation.txt ${DOCSDIR}/activation.txt +.for f in ${PORTDOCS} + ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR} +.endfor .endif @${CAT} ${PKGMESSAGE} diff --git a/mail/spamass-milter/distinfo b/mail/spamass-milter/distinfo index 87ffdae17f40..c6864a4625f0 100644 --- a/mail/spamass-milter/distinfo +++ b/mail/spamass-milter/distinfo @@ -1,2 +1,2 @@ -MD5 (spamass-milter-0.2.0.tar.gz) = 70da3e4a6039f5e738ce21f69430e230 -SIZE (spamass-milter-0.2.0.tar.gz) = 113894 +MD5 (spamass-milter-0.3.0.tar.gz) = ced600331a0df7609fdbdf0e6d0eb943 +SIZE (spamass-milter-0.3.0.tar.gz) = 140126 diff --git a/mail/spamass-milter/files/activation.txt b/mail/spamass-milter/files/activation.txt index 326cbe21b498..63177b1fd7e5 100644 --- a/mail/spamass-milter/files/activation.txt +++ b/mail/spamass-milter/files/activation.txt @@ -6,35 +6,29 @@ In order to activate spamass-milter, follow these steps: 2. If you didn't activate spamd (the SpamAssassin daemon), do so now: - /usr/local/etc/rc.d/spamd.sh start + %%PREFIX%%/etc/rc.d/sa-spamd.sh start 3. Activate spamass-milter: - /usr/local/etc/rc.d/spamass-milter.sh start + %%PREFIX%%/etc/rc.d/spamass-milter.sh start 4. Backup your sendmail.cf (in /etc/mail). 5. If you didn't create your own customized version of Sendmail .mc - file, create one from the default template (replace YOURNAME with a - suitable name; a good candidate is the output of `hostname -s'): + file, create one from the default template (hostname.mc): cd /etc/mail - cp -p freebsd.mc YOURNAME.mc - echo "SENDMAIL_MC = /etc/mail/YOURNAME.mc" >> /etc/make.conf - - The last line tells the system to use your customized version instead - of the default freebsd.mc when you run mergemaster(8) later on. + make -6. Add the spamass-milter hook to your Sendmail .mc file. The magic +6. Add the spamass-milter hook to your hostname.mc file. The magic line to add is: INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m') + define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl Everything should go on a single line, no line break/continuation is - allowed! - - The best place to add this is right after the dnsbl-related comments. - (Hint: Every comment in an .mc file starts with `dnl'.) + allowed! The best place to add this is right after the dnsbl-related + comments. (Hint: Every comment in an .mc file starts with `dnl'.) 7. Rebuild the sendmail.cf from your .mc file: @@ -42,39 +36,31 @@ In order to activate spamass-milter, follow these steps: make make install - Or you can run mergemaster(8) instead if you want, although it's an - overkill. - 8. Restart Sendmail: - kill -HUP `head -1 /var/run/sendmail.pid` + cd /etc/mail + make stop + make start 9. Test the whole piece: - /usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-nonspam.txt - /usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-spam.txt + echo "Testing spamass-milter..." | mail -s"Spam test" root - Each of these commands might take a long time to finish (up to about - 10-20 seconds), so please be patient. + This might take a long time to finish (up to about 10-20 seconds), + since spamd has just started, so please be patient. - You should receive two messages, one from `Keith Dawson' and the - other from xl6Ety00V@fismat1.fcfm.buap.mx. The one from Keith Dawson - shouldn't be tagged as a spam, bearing this header line: + You (root) should receive a message from root@hostname, bearing this + header line: X-Spam-Status: No, ... - On the other hand, the one from xl6Ety00V@fismat1.fcfm.buap.mx should - be tagged as a spam, bearing these two header lines: - - X-Spam-Status: Yes, ... - X-Spam-Flag: YES - - If things don't work as expected, promptly restore your sendmail.cf - from the backup copy then restart sendmail as shown on step 8; you - may lose incoming mail otherwise! + If things don't work as expected, promptly restore the stock FreeBSD + sendmail.cf (/etc/mail/freebsd.cf) as your default sendmail config, + or restore your own backup (if you keep one), as shown in step 8; + you may lose incoming mail otherwise! Now all messages received by Sendmail are filtered through SpamAssassin, and probable spam messages are tagged with the header `X-Spam-Flag: YES'. Tell your users about this so they can set up -appropriate filters on their mail reader. +appropriate filters in their mail client. diff --git a/mail/spamass-milter/files/patch-spamass-milter.cpp b/mail/spamass-milter/files/patch-spamass-milter.cpp deleted file mode 100644 index 629df05e9f17..000000000000 --- a/mail/spamass-milter/files/patch-spamass-milter.cpp +++ /dev/null @@ -1,64 +0,0 @@ ---- spamass-milter.cpp.orig Thu Jun 26 16:10:44 2003 -+++ spamass-milter.cpp Wed Oct 13 00:52:23 2004 -@@ -102,6 +102,10 @@ - #include <csignal> - #include <string> - #include <iostream> -+using std::string; -+using std::cout; -+using std::cerr; -+using std::endl; - - #ifdef __cplusplus - extern "C" { -@@ -273,6 +277,7 @@ - exit(errno); - break; - case 0: /* Child */ -+ setsid(); - break; - default: /* Parent */ - exit(0); -@@ -351,6 +356,9 @@ - string::size_type eoh = ( eoh1 < eoh2 ? eoh1 : eoh2 ); - string::size_type bob = assassin->d().find_first_not_of("\r\n", eoh); - -+ if (bob == string::npos) -+ bob = assassin->d().size(); -+ - update_or_insert(assassin, ctx, assassin->spam_flag(), &SpamAssassin::set_spam_flag, "X-Spam-Flag"); - update_or_insert(assassin, ctx, assassin->spam_status(), &SpamAssassin::set_spam_status, "X-Spam-Status"); - -@@ -365,7 +373,7 @@ - { - int score, rv; - const char *spam_status = assassin->spam_status().c_str(); -- rv = sscanf(spam_status,"%*s hits=%d", &score); -+ rv = sscanf(spam_status,"%*s score=%d", &score); - if (rv != 1) - debug(D_ALWAYS, "Could not extract score from <%s>", spam_status); - else -@@ -539,6 +547,10 @@ - } - } - -+ /* if the header line ends in \r\n, don't return the \r */ -+ if (header[field_end-1] == '\r') -+ field_end--; -+ - // Maybe remove the whitespace picked up when a header wraps - this - // might actually be a requirement - return header.substr( field_start, field_end - field_start ); -@@ -1341,7 +1353,11 @@ - { - // assuming we have a recipient in the form: <username@somehost.somedomain> - // we return 'username' -- return _rcpt.substr(1,_rcpt.find('@')-1); -+ int at = _rcpt.find('@'); -+ int plus = _rcpt.find('+'); -+ if (plus > 0 && plus < at) -+ at = plus; -+ return _rcpt.substr(1,at-1); - } - - int diff --git a/mail/spamass-milter/files/spamass-milter.sh b/mail/spamass-milter/files/spamass-milter.sh index 93773c03fe8e..a54c36f0aac2 100644 --- a/mail/spamass-milter/files/spamass-milter.sh +++ b/mail/spamass-milter/files/spamass-milter.sh @@ -24,27 +24,33 @@ rcvar=`set_rcvar` command=%%PREFIX%%/sbin/spamass-milter required_dirs=%%PREFIX%%/share/spamassassin -# set defaults - -spamass_milter_enable=${spamass_milter_enable:-"NO"} -spamass_milter_socket=${spamass_milter_socket:-"/var/run/spamass-milter.sock"} -spamass_milter_flags=${spamass_milter_flags:-"-f -p ${spamass_milter_socket}"} - start_postcmd=start_postcmd stop_postcmd=stop_postcmd start_postcmd() { - sleep 1 - kill -HUP `head -1 /var/run/sendmail.pid` + if test -f /var/run/sendmail.pid + then + sleep 1 + kill -HUP `head -1 /var/run/sendmail.pid` + fi } stop_postcmd() { rm -f ${spamass_milter_socket} - sleep 1 - kill -HUP `head -1 /var/run/sendmail.pid` + if test -f /var/run/sendmail.pid + then + sleep 1 + kill -HUP `head -1 /var/run/sendmail.pid` + fi } +# set defaults + +spamass_milter_enable=${spamass_milter_enable:-"NO"} +spamass_milter_socket=${spamass_milter_socket:-"/var/run/spamass-milter.sock"} +spamass_milter_flags=${spamass_milter_flags:-"-f -p ${spamass_milter_socket}"} + load_rc_config ${name} run_rc_command "$1" diff --git a/mail/spamass-milter/pkg-descr b/mail/spamass-milter/pkg-descr index 6b286b4298e8..29774a15f78a 100644 --- a/mail/spamass-milter/pkg-descr +++ b/mail/spamass-milter/pkg-descr @@ -1,5 +1,5 @@ -spamass-milter is a little plugin for the Sendmail Milter (Mail Filter) -library that pipes all incoming mail (including things received by -rmail/UUCP) through the SpamAssassin, a highly customizable SpamFilter. +spamass-milter is a plugin for the Sendmail Milter (Mail Filter) library +that pipes all incoming mail (including things received by rmail/UUCP) +through the SpamAssassin, a highly customizable spam filter. WWW: http://savannah.gnu.org/projects/spamass-milt/ diff --git a/mail/spamass-milter/pkg-message b/mail/spamass-milter/pkg-message index 796b7ccd6616..55bbf0d17bd1 100644 --- a/mail/spamass-milter/pkg-message +++ b/mail/spamass-milter/pkg-message @@ -1,5 +1,14 @@ + ------------------------------------------------------------------------ -spamass-milter has been installed, but you have to activate it manually -to use it. Refer to ${PREFIX}/share/doc/spamass-milter/activation.txt -for details. +spamass-milter has been installed, but it must be activated manually. +Pleae refer to... + + %%DOCSDIR%%/activation.txt + +...for details. + +You may also want to tweak your spamd rc.subr(8) startup flags to +specify a username to switch credentials to when delivering mail, if +applicable. ------------------------------------------------------------------------ + diff --git a/mail/spamass-milter/pkg-plist b/mail/spamass-milter/pkg-plist index 7042bd14ba07..94533411e057 100644 --- a/mail/spamass-milter/pkg-plist +++ b/mail/spamass-milter/pkg-plist @@ -1,4 +1,3 @@ sbin/spamass-milter etc/rc.d/spamass-milter.sh -%%PORTDOCS%%share/doc/spamass-milter/activation.txt -%%PORTDOCS%%@dirrm share/doc/spamass-milter +%%PORTDOCS%%%%DOCSDIR%%/activation.txt |