ports/76118: [NEW PORT] mail/dspampd
Ion-Mihai IOnut Tetcu
itetcu at people.tecnik93.com
Tue Jan 11 20:30:28 UTC 2005
>Number: 76118
>Category: ports
>Synopsis: [NEW PORT] mail/dspampd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Jan 11 20:30:27 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Ion-Mihai "IOnut" Tetcu
>Release: FreeBSD 5.3-STABLE i386
>Organization:
Tecnik'93
>Environment:
System: FreeBSD 5.3-STABLE #13: Tue Dec 28 12:22:13 EET 2004
>Description:
DspamPD is a GPL'ed transparent smtp proxy which can do content scanning
through DSPAM and/or ClamAV...
DspamPD version v2.00 supports DSPAM version 3.x, both stable and -devel
ports and both clamav ports.
The attached shar will create the port for you.
>How-To-Repeat:
>Fix:
--- dspampd-2.00.r2.shar begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# .
# ./Makefile
# ./distinfo
# ./files
# ./files/l-patch-dspampd.conf
# ./files/lpatch-dspampd_system_users.diff
# ./files/dspampd.rc
# ./files/patch-dspampd.conf
# ./files/patch-dspampd.relaycontrol
# ./pkg-descr
# ./pkg-plist
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo x - ./Makefile
sed 's/^X//' >./Makefile << 'END-of-./Makefile'
X# New ports collection makefile for: mail/dspampd
X# Date created: 21 July 2004
X# Whom: Ion-Mihai "IOnut" Tetcu <itetcu at people.tecnik93.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME= dspampd
XPORTVERSION= 2.00.r2
XCATEGORIES= mail perl5
XMASTER_SITES= http://caspian.dotconf.net/menu/Software/DspamPD/ \
X http://people.tecnik93.com/~itetcu/FreeBSD/ports/dspampd/sources/
XDISTNAME= dspampd-v2.00-rc2-with-patches-kurt-pinboard
X
XMAINTAINER= itetcu at people.tecnik93.com
XCOMMENT= Transparent smtp proxy - scans mail through DSPAM and/or ClamAV
X
XWRKSRC= ${WRKDIR}/dspampd-v2.00-rc2
X
XUSE_PERL5_RUN= YES
XUSE_RC_SUBR= YES
X
XOPTIONS= DSPAM "Use stable dspam as anti-spam module" off
XOPTIONS+= DSPAM_DEVEL "Use devel dspam as antispam module" on
XOPTIONS+= DSPAM_VIRT_USERS "Non-system users in dspam" off
XOPTIONS+= CLAMAV "Use clamav as antivir module" off
XOPTIONS+= CLAMAV_DEVEL "Use clamav as antivir module" on
X#OPTIONS+= TIME_HIRES "" on
X
XNO_BUILD= YES
X#NO_INSTALL= YES
XUSE_REINPLACE= YES
X
XCONF_DIR= ${PREFIX}/etc/dspampd
X
XRC_DIR= ${PREFIX}/etc/rc.d
XRC_SUFX= .sh
X
XPORTDOCS= INSTALL README
X
X_VAR_DIR= /var
XARCHIVE_DIR?= ${_VAR_DIR}/spool/dspampd-archive
XPLIST_SUB+= ARCHIVE_DIR=${ARCHIVE_DIR}
X
XPLIST_FILES+= etc/rc.d/dspampd${RC_SUFX}
X
XSED_FILES= dspampd INSTALL README
XSED_SCRIPT= -e "s,/etc/,${CONF_DIR}/,g" \
X -e "s,/usr/bin/,${LOCALBASE}/bin/,g" \
X -e "s,/var/spool/dspam-archive,${ARCHIVE_DIR},g" \
X -e "s,/usr/bin/perl,${PERL},g"
X
XSED_CONF_SCRIPT= -e "s,%%PREFIX%%,${PREFIX},g"
XSED_CONF_SCRIPT+= -e "s,%%ARCHIVE_DIR%%,${ARCHIVE_DIR},"
XSED_CONF_SCRIPT+= -e "s,%%CONF_DIR%%,${CONF_DIR},g"
X
X.include <bsd.port.pre.mk>
X
X# defaults for package building
X.ifndef(WITH_DEVEL) && !defined(WITH_DSPAM_DEVEL) && \
X !defined(WITH_CLAMAV) && !defined(WITH_CLAMAV_DEVEL)
XWITH_DSPAM_DEVEL= on
XWITH_CLAMAV_DEVEL= on
X.endif
X
X.ifdef(WITH_DSPAM)
XRUN_DEPENDS+= dspam:${PORTSDIR}/mail/dspam
X.endif
X
X# for now dspamc exists only in -devel
X.ifdef(WITH_DSPAM_DEVEL)
XRUN_DEPENDS+= dspamc:${PORTSDIR}/mail/dspam-devel
XSED_CONF_SCRIPT+= -e "s,%%DSPAM%%,dspam,"
X.else
XSED_CONF_SCRIPT+= -e "/%%DSPAM%%/D"
X.endif
X
X.ifndef(WITH_DSPAM_VIRT_USERS)
XEXTRA_PATCHES= ${FILESDIR}/lpatch-dspampd_system_users.diff
X.endif
X
X.ifdef(WITH_CLAMAV)
XRUN_DEPENDS+= ${LOCALBASE}/etc/clamav.conf:${PORTSDIR}/security/clamav
X.endif
X
X.ifdef(WITH_CLAMAV_DEVEL)
XRUN_DEPENDS+= ${LOCALBASE}/etc/clamav.conf:${PORTSDIR}/security/clamav-devel
X.endif
X
X.ifdef(WITH_CLAMAV) || defined(WITH_CLAMAV_DEVEL)
XSED_CONF_SCRIPT+= -e "s,%%CLAMAV%%,clamd,"
X.else
XSED_CONF_SCRIPT+= -e "/%%CLAMAV%%/D"
X.endif
X
Xpre-extract:
X @${ECHO_CMD}
X @${ECHO_CMD} "Define, if you need:"
X @${ECHO_CMD} "ARCHIVE_DIR=${ARCHIVE_DIR} (default ${_VAR_DIR}/spool/dspampd-archive)."
X @${ECHO_CMD}
X
Xpre-configure:
X.if defined(WITH_DSPAM) && defined(WITH_DSPAM_DEVEL)
X @${ECHO_CMD}
X @${ECHO_CMD} "DSPAM and DSPAM_DEVEL are mutually exclusive."
X @${ECHO_CMD} "Do a \"make rmconfig\" and start over."
X @${ECHO_CMD}
X @${FALSE}
X.endif
X.if (defined(WITH_CLAMAV) && defined(WITH_CLAMAV_DEVEL))
X @${ECHO_CMD}
X @${ECHO_CMD} "CLAMAV and CLAMAV_DEVEL are mutually exclusive."
X @${ECHO_CMD} "Do a \"make rmconfig\" and start over."
X @${ECHO_CMD}
X @${FALSE}
X.endif
X
Xpost-patch:
X.for _file in ${SED_FILES}
X @${REINPLACE_CMD} ${SED_SCRIPT} ${WRKSRC}/${_file}
X.endfor
X @${CP} ${FILESDIR}/dspampd.rc ${WRKSRC}/dspampd.rc
X @${REINPLACE_CMD} ${SED_CONF_SCRIPT} ${WRKSRC}/dspampd.rc
X @${REINPLACE_CMD} ${SED_CONF_SCRIPT} ${WRKSRC}/dspampd.conf
X
Xdo-install::
X @${INSTALL_SCRIPT} ${WRKSRC}/dspampd ${PREFIX}/sbin/
X @${MKDIR} ${CONF_DIR}
X.for _conf_file in dspampd.conf dspampd.applyto dspampd.relaycontrol
X @${CP} ${WRKSRC}/${_conf_file} ${WRKSRC}/${_conf_file}.sample
X @${INSTALL_DATA} ${WRKSRC}/${_conf_file}.sample ${CONF_DIR}/
X.endfor
X @${INSTALL_SCRIPT} ${WRKSRC}/dspampd.rc ${RC_DIR}/dspampd${RC_SUFX}
X ${MKDIR} ${ARCHIVE_DIR}
X.if !defined(NOPORTDOCS)
X @${MKDIR} ${DOCSDIR}
X @${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}
X @${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
X.endif
X
Xpost-install:
X @${ECHO_CMD}
X @${ECHO_CMD} "------------------------------------------------------"
X @${ECHO_CMD} "Copy"
X @${ECHO_CMD} "${PREFIX}/etc/dspampd.conf.sample"
X @${ECHO_CMD} "to"
X @${ECHO_CMD} "${PREFIX}/etc/dspampd.conf"
X @${ECHO_CMD} "and edit it to your needs."
X @${ECHO_CMD} "Add dspampd_enable="YES" in /etc/rc.conf to start dspampd on boot"
X @${ECHO_CMD} "-------------------------------------------------------"
X @${ECHO_CMD}
X
X.include <bsd.port.post.mk>
END-of-./Makefile
echo x - ./distinfo
sed 's/^X//' >./distinfo << 'END-of-./distinfo'
XMD5 (dspampd-v2.00-rc2-with-patches-kurt-pinboard.tar.gz) = de35e2e7027e5a51413598945d92e72e
XSIZE (dspampd-v2.00-rc2-with-patches-kurt-pinboard.tar.gz) = 66326
END-of-./distinfo
echo c - ./files
mkdir -p ./files > /dev/null 2>&1
echo x - ./files/l-patch-dspampd.conf
sed 's/^X//' >./files/l-patch-dspampd.conf << 'END-of-./files/l-patch-dspampd.conf'
XIndex: dspampd.conf
X--- dspampd.conf.dist Fri Aug 6 16:58:33 2004
X+++ dspampd.conf Fri Aug 6 16:59:37 2004
X@@ -44,12 +44,12 @@
X ## Directory to store quarantined messages in. (/var/spool/dspam-archive)
X ## This needs to be defined even if you don't archive anything,
X ## it is used for temporary file storage.
X- archive-dir => /var/spool/dspam-archive
X+ archive-dir => /var/spool/dspampd-archive
X
X ## Comma separated list of modules to pass email through.
X ## Modules will be run in the order listed.
X ## Currently available modules: dspam,clamav
X- enabled-modules => dspam,clamav
X+ enabled-modules => clamav,dspam
X
X
X
X@@ -66,7 +66,7 @@
X stdout => 0
X
X ## enable logging to the specified file (can work in conjunction with "syslog" and "stdout")
X- // logFile => /var/log/dspampd
X+ logFile => /var/log/dspampd
X
X
X
X@@ -78,16 +78,17 @@
X listenHost => 127.0.0.1
X
X ## Port to accept smtp connections on. ex. 25 or 10025
X- listenPort => 10025
X+ listenPort => 20024
X
X ## Fixme, this needs way more options ;)
X ## Address to proxy mail to. ex: 127.0.0.1 or mail.isp.net
X relayHost => 127.0.0.1
X
X ## Port to on relayHost to proxy mail to. ex. 25 or 10125
X- relayPort => 10125
X+ relayPort => 20025
X
X ## timeouts for any/all connections (360 seconds)
X+ ## sync this with your MTA timeout
X timeout => 360
X
X
X@@ -95,8 +96,8 @@
X
X [module:dspam]
X
X- ## Full path to dspam binary (/usr/bin/dspam)
X- dspam-command => /usr/bin/dspam
X+ ## Full path to dspam binary (/usr/local/bin/dspam)
X+ dspam-command => /usr/local/bin/dspam
X
X ## DSPAM training mode [toe|tum|teft]
X training-mode => tum
X@@ -117,17 +118,19 @@
X ## Maximum size (in KB) of mail to scan. Use 0 to scan all mail.
X ## Messages larger than this are considered "unscanned" mail in the
X ## next few options.
X- max-size => 0
X+ max-size => 150
X
X ## Deliver specified message types. (ham)
X ## Note: "unscanned" is considered a subset of "ham"
X ## Can be one of: all, ham, spam, unscanned, none
X- deliver => ham
X+ # deliver => ham
X+ deliver => all
X
X ## archive a copy of specified message types. (spam)
X ## Note: "unscanned" is considered a subset of "ham"
X ## Can be one of: all, ham, spam, unscanned, none
X- archive => spam
X+ # archive => spam
X+ archive => none
X
X ## The following options are for advanced users only. By default
X ## if a message is NOT delivered it is bounced.
X@@ -175,7 +178,7 @@
X
X ## Full path to clamav's configuration file
X ## This is used for determining how to connect to the clamd daemon.
X- config-file => /etc/clamav.conf
X+ config-file => /usr/local/etc/clamav.conf
X
X ## Write ClamAV headers into email header.
X ## Example header entries:
X@@ -234,8 +237,3 @@
X // clean-custom-response => 220 Message is clean
X // unscanned-custom-response => 220 Large message was not scanned by clamav
X infected-custom-response => 220 Virus infected message will be quarantined
X-
X-
X-
X-
X-
END-of-./files/l-patch-dspampd.conf
echo x - ./files/lpatch-dspampd_system_users.diff
sed 's/^X//' >./files/lpatch-dspampd_system_users.diff << 'END-of-./files/lpatch-dspampd_system_users.diff'
X--- dspampd.dist Sun Jan 2 00:05:34 2005
X+++ dspampd Sun Jan 2 00:40:10 2005
X@@ -2017,6 +2017,11 @@
X $dspam{'dspam-user'} = ${applytoList}[0];
X ## Remove angled arrows on addresses like: <caspian at dotconf.net>
X $dspam{'dspam-user'} =~ s/^<|>$//go;
X+ ## FreeBSD-local patch if port built with WITHOUT_DSPAM_VIRT_USERS= on
X+ ## This works if you relay mail for system users ONLY
X+ $dspam{'dspam-user'} =~ s/@.*$//go;
X+ ## FreeBSD-local patch WITHOUT_DSPAM_VIRT_USERS= on
X+ ## end
X $dspam{'dspam-user'} =~ tr/A-Z/a-z/; # convert to lower case
X }
X else {
END-of-./files/lpatch-dspampd_system_users.diff
echo x - ./files/dspampd.rc
sed 's/^X//' >./files/dspampd.rc << 'END-of-./files/dspampd.rc'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
X# PROVIDE: dspampd
X# REQUIRE: LOGIN %%CLAMAV%% %%DSPAM%%
X# BEFORE: mail
X# KEYWORD: FreeBSD shutdown
X
X#
X# Add the following lines to /etc/rc.conf[.local] to enable dspampd:
X#
X#dspampd_enable="YES"
X#
X
X. /etc/rc.subr
X
Xname=dspampd
Xrcvar=`set_rcvar`
X
Xcommand=%%PREFIX%%/sbin/dspampd > /dev/null 2>&1
Xpidfile=/var/run/dspampd.pid
Xrequired_dirs=%%ARCHIVE_DIR%%
Xrequired_files=%%CONF_DIR%%/dspampd.conf
X
Xstop_postcmd=stop_postcmd
X
Xstop_postcmd()
X{
X rm -f $pidfile
X}
X
X# set defaults
X
Xdspampd_enable=${dspampd_enable:-"NO"}
Xdspampd_flags=${dspampd_flags:-"--daemon"}
X
Xload_rc_config $name
Xrun_rc_command "$1"
END-of-./files/dspampd.rc
echo x - ./files/patch-dspampd.conf
sed 's/^X//' >./files/patch-dspampd.conf << 'END-of-./files/patch-dspampd.conf'
X--- dspampd.conf.dist Sat Jan 1 16:33:38 2005
X+++ dspampd.conf Sat Jan 1 16:37:41 2005
X@@ -43,7 +43,7 @@
X ## Directory to store quarantined messages in. (/var/spool/dspam-archive)
X ## This needs to be defined even if you don't archive anything,
X ## it is used for temporary file storage.
X- archive-dir => /var/spool/dspam-archive
X+ archive-dir => %%ARCHIVE_DIR%%
X
X ## Comma separated list of modules to pass email through.
X ## Modules will be run in the order listed.
X@@ -52,16 +52,16 @@
X
X ## Path to a file with entries that control what messages can be
X ## relayed through us.
X- ## Default: /etc/dspampd.relaycontrol
X- //relaycontrolfile => /etc/dspampd.relaycontrol
X+ ## Default: /usr/local/etc/dspampd/dspampd.relaycontrol
X+ relaycontrolfile => %%CONF_DIR%%/dspampd.relaycontrol
X
X ## Path to a file with entries that control what recipient domains
X ## and/or recipient addresses the checks are applied to. No entry
X ## at all causes all messages to be checked, otherwise only if at
X ## least one of the recipients is configured, the messae is
X ## checked (with the settings of the first matching recipient).
X- ## Default: /etc/dspampd.applyto
X- //applytocontrolfile => /etc/dspampd.applyto
X+ ## Default: /usr/local/etc/dspampd/dspampd.applyto
X+ applytocontrolfile => %%CONF_DIR%%/dspampd.applyto
X
X
X
X@@ -92,17 +92,19 @@
X listenHost => 127.0.0.1
X
X ## Port to accept smtp connections on. ex. 25 or 10025
X- listenPort => 10025
X+ listenPort => 20024
X
X ## Fixme, this needs way more options ;)
X ## Address to proxy mail to. ex: 127.0.0.1 or mail.isp.net
X relayHost => 127.0.0.1
X
X ## Port to on relayHost to proxy mail to. ex. 25 or 10125
X- relayPort => 10125
X+ relayPort => 20025
X
X ## maximum number of concurrent connections allowed
X- concurrentConnections => 128
X+ # this is just a safe-belt, you should enforce this from your MTA
X+ # and play with it until you get optimum performance for your site
X+ concurrentConnections => 10
X
X ## timeouts for any/all connections (360 seconds)
X timeout => 360
X@@ -113,7 +115,7 @@
X [module:dspam]
X
X ## Full path to dspam binary (/usr/bin/dspam)
X- dspam-command => /usr/bin/dspam
X+ dspam-command => /usr/local/bin/dspam
X
X ## DSPAM training mode [toe|tum|teft]
X training-mode => tum
X@@ -125,7 +127,7 @@
X // dspam-user => spamfilter
X
X ## Additional command line arguments for dspam
X- additional-arguments => --feature=chained,noise
X+ additional-arguments => --feature=ch,no,wh,tb=4
X
X ## Write DSPAM headers into email header
X ## 1 writes DSPAM headers in email, 0 leaves email untouched.
X@@ -134,17 +136,17 @@
X ## Maximum size (in KB) of mail to scan. Use 0 to scan all mail.
X ## Messages larger than this are considered "unscanned" mail in the
X ## next few options.
X- max-size => 0
X+ max-size => 250
X
X ## Deliver specified message types. (ham)
X ## Note: "unscanned" is considered a subset of "ham"
X ## Can be one of: all, ham, spam, unscanned, none
X- deliver => ham
X+ deliver => all
X
X ## archive a copy of specified message types. (spam)
X ## Note: "unscanned" is considered a subset of "ham"
X ## Can be one of: all, ham, spam, unscanned, none
X- archive => spam
X+ archive => none
X
X ## The following options are for advanced users only. By default
X ## if a message is NOT delivered it is bounced.
X@@ -193,7 +195,7 @@
X ## Full path to clamav's configuration file
X ## This is used for determining how to connect to the clamd daemon.
X ## Not yet implemented, use the following parameters instead.
X- config-file => /etc/clamav.conf
X+ config-file => /usr/local/etc/clamav.conf
X
X ## This is the socket type to use for connecting to clamd.
X ## Possible values: TCP UNIX
X@@ -214,7 +216,7 @@
X ## When using a socktype of UNIX, this is the full path of the
X ## socket where clamd should be contacted.
X- ## Default: /tmp/clamd
X- peersocket => /tmp/clamd
X+ ## Default: /var/run/clamav/clamd
X+ peersocket => /var/run/clamav/clamd
X
X ## Write ClamAV headers into email header.
X ## Example header entries:
X@@ -230,11 +232,11 @@
X
X ## deliver specified message types. (clean)
X ## devliver => <all | clean | infected | unscanned | none>
X- deliver => clean
X+ deliver => all
X
X ## archive a copy of specified message types. (infected)
X ## archive => <all | clean | infected | unscanned | none>
X- archive => infected
X+ archive => none
X
X ## The following options are for advanced users only. By default
X ## if a message is NOT delivered it is bounced.
X@@ -272,5 +274,5 @@
X
X // clean-custom-response => 220 Message is clean
X // unscanned-custom-response => 220 Large message was not scanned by clamav
X- infected-custom-response => 220 Virus infected message will be quarantined
X+ // infected-custom-response => 220 Virus infected message will be quarantined
X
END-of-./files/patch-dspampd.conf
echo x - ./files/patch-dspampd.relaycontrol
sed 's/^X//' >./files/patch-dspampd.relaycontrol << 'END-of-./files/patch-dspampd.relaycontrol'
X--- dspampd.relaycontrol.dist Sun Jan 2 02:12:40 2005
X+++ dspampd.relaycontrol Sat Jan 1 17:34:25 2005
X@@ -39,6 +39,7 @@
X ## relayed. Subdomains are included.
X ## The only supported key type at the moment is 'allow'.
X //allow => my.domain
X+ allow => 127.0.0.1
X
X [relay OK to Address]
X
END-of-./files/patch-dspampd.relaycontrol
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << 'END-of-./pkg-descr'
XDspamPD is a transparent smtp proxy which can do content scanning through DSPAM
Xand/or ClamAV...
XDspamPD version 2.00 now supports DSPAM version 3.x!
X
XDspamPD is licensed under the GPL.
X
XFeature List (from author's site):
X
XUseful command line options :)
XThe majority of the configuration is done via a configuration file.
XWell commented code.
XDspamPD has processed millions email messages and has been extremly reliable.
XNothing else I can think of for now ;-)
X
XWWW: http://caspian.dotconf.net/menu/Software/DspamPD/
X
X-IOnut
X<itetcu at people.tecnik93.com>
END-of-./pkg-descr
echo x - ./pkg-plist
sed 's/^X//' >./pkg-plist << 'END-of-./pkg-plist'
Xsbin/dspampd
Xetc/dspampd/dspampd.conf.sample
Xetc/dspampd/dspampd.applyto.sample
Xetc/dspampd/dspampd.relaycontrol.sample
X at dirrm etc/dspampd
X at unexec if cmp -s %D/etc/dspampd/dspampd.conf %D/etc/dspampd/dspampd.conf.sample; then rm -f %D/etc/dspampd/dspampd.conf; fi
X at exec echo "eeeee" ; %B
X at exec [-f %B/dspampd.conf] || cp %B/%f %B/dspampd.conf
X at cwd /
X at dirrm %%ARCHIVE_DIR%%
END-of-./pkg-plist
exit
--- dspampd-2.00.r2.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list