From 585a173f2dd9c7ea9339b051c5837c46662c7725 Mon Sep 17 00:00:00 2001
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Wed, 12 Jan 2005 08:15:05 +0000
Subject: [NEW PORT] mail/dspampd

	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.

PR:		ports/76118
Submitted by:	Ion-Mihai "IOnut" Tetcu <itetcu@people.tecnik93.com>
---
 mail/dspampd/Makefile                              | 156 +++++++++++++++++++++
 mail/dspampd/distinfo                              |   2 +
 mail/dspampd/files/dspampd.rc                      |  40 ++++++
 .../dspampd/files/lpatch-dspampd_system_users.diff |  14 ++
 mail/dspampd/files/patch-dspampd.conf              | 134 ++++++++++++++++++
 mail/dspampd/files/patch-dspampd.relaycontrol      |  10 ++
 mail/dspampd/pkg-descr                             |   9 ++
 mail/dspampd/pkg-plist                             |  10 ++
 8 files changed, 375 insertions(+)
 create mode 100644 mail/dspampd/Makefile
 create mode 100644 mail/dspampd/distinfo
 create mode 100644 mail/dspampd/files/dspampd.rc
 create mode 100644 mail/dspampd/files/lpatch-dspampd_system_users.diff
 create mode 100644 mail/dspampd/files/patch-dspampd.conf
 create mode 100644 mail/dspampd/files/patch-dspampd.relaycontrol
 create mode 100644 mail/dspampd/pkg-descr
 create mode 100644 mail/dspampd/pkg-plist

(limited to 'mail/dspampd')

diff --git a/mail/dspampd/Makefile b/mail/dspampd/Makefile
new file mode 100644
index 000000000000..00fe967e8d2f
--- /dev/null
+++ b/mail/dspampd/Makefile
@@ -0,0 +1,156 @@
+# New ports collection makefile for:	mail/dspampd
+# Date created:				21 July 2004
+# Whom:			Ion-Mihai "IOnut" Tetcu <itetcu@people.tecnik93.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME=	dspampd
+PORTVERSION=	2.00.r2
+CATEGORIES=	mail perl5
+MASTER_SITES=	http://caspian.dotconf.net/menu/Software/DspamPD/ \
+		http://people.tecnik93.com/~itetcu/FreeBSD/ports/dspampd/sources/
+DISTNAME=	dspampd-v2.00-rc2-with-patches-kurt-pinboard
+
+MAINTAINER=	itetcu@people.tecnik93.com
+COMMENT=	Transparent smtp proxy - scans mail through DSPAM and/or ClamAV
+
+WRKSRC=		${WRKDIR}/dspampd-v2.00-rc2
+
+USE_PERL5_RUN=	YES
+USE_RC_SUBR=	YES
+
+OPTIONS=	DSPAM "Use stable dspam as anti-spam module" off
+OPTIONS+=	DSPAM_DEVEL "Use devel dspam as antispam module" on
+OPTIONS+=	DSPAM_VIRT_USERS "Non-system users in dspam" off
+OPTIONS+=	CLAMAV	"Use clamav as antivir module" off
+OPTIONS+=	CLAMAV_DEVEL  "Use clamav as antivir module" on
+#OPTIONS+=	TIME_HIRES "" on
+
+NO_BUILD=	YES
+#NO_INSTALL=	YES
+USE_REINPLACE=	YES
+
+CONF_DIR=	${PREFIX}/etc/dspampd
+
+RC_DIR=		${PREFIX}/etc/rc.d
+RC_SUFX=	.sh
+
+PORTDOCS=	INSTALL README
+
+_VAR_DIR=	/var
+ARCHIVE_DIR?=	${_VAR_DIR}/spool/dspampd-archive
+PLIST_SUB+=	ARCHIVE_DIR=${ARCHIVE_DIR}
+
+PLIST_FILES+=	etc/rc.d/dspampd${RC_SUFX}
+
+SED_FILES=	dspampd INSTALL README
+SED_SCRIPT=	-e "s,/etc/,${CONF_DIR}/,g" \
+		-e "s,/usr/bin/,${LOCALBASE}/bin/,g" \
+		-e "s,/var/spool/dspam-archive,${ARCHIVE_DIR},g" \
+		-e "s,/usr/bin/perl,${PERL},g"
+
+SED_CONF_SCRIPT=	-e "s,%%PREFIX%%,${PREFIX},g"
+SED_CONF_SCRIPT+=	-e "s,%%ARCHIVE_DIR%%,${ARCHIVE_DIR},"
+SED_CONF_SCRIPT+=	-e "s,%%CONF_DIR%%,${CONF_DIR},g"
+
+.include <bsd.port.pre.mk>
+
+# defaults for package building
+.ifndef(WITH_DEVEL) && !defined(WITH_DSPAM_DEVEL) && \
+	!defined(WITH_CLAMAV) && !defined(WITH_CLAMAV_DEVEL)
+WITH_DSPAM_DEVEL=	on
+WITH_CLAMAV_DEVEL=	on
+.endif
+
+.ifdef(WITH_DSPAM)
+RUN_DEPENDS+=	dspam:${PORTSDIR}/mail/dspam
+.endif
+
+# for now dspamc exists only in -devel
+.ifdef(WITH_DSPAM_DEVEL)
+RUN_DEPENDS+=	dspamc:${PORTSDIR}/mail/dspam-devel
+SED_CONF_SCRIPT+=	-e "s,%%DSPAM%%,dspam,"
+.else
+SED_CONF_SCRIPT+=	-e "/%%DSPAM%%/D"
+.endif
+
+.ifndef(WITH_DSPAM_VIRT_USERS)
+EXTRA_PATCHES=	${FILESDIR}/lpatch-dspampd_system_users.diff
+.endif
+
+.ifdef(WITH_CLAMAV)
+RUN_DEPENDS+=	${LOCALBASE}/etc/clamav.conf:${PORTSDIR}/security/clamav
+.endif
+
+.ifdef(WITH_CLAMAV_DEVEL)
+RUN_DEPENDS+=	${LOCALBASE}/etc/clamav.conf:${PORTSDIR}/security/clamav-devel
+.endif
+
+.ifdef(WITH_CLAMAV) || defined(WITH_CLAMAV_DEVEL)
+SED_CONF_SCRIPT+=	-e "s,%%CLAMAV%%,clamd,"
+.else
+SED_CONF_SCRIPT+=	-e "/%%CLAMAV%%/D"
+.endif
+
+pre-extract:
+	@${ECHO_CMD}
+	@${ECHO_CMD} "Define, if you need:"
+	@${ECHO_CMD} "ARCHIVE_DIR=${ARCHIVE_DIR} (default ${_VAR_DIR}/spool/dspampd-archive)."
+	@${ECHO_CMD}
+
+pre-configure:
+.if defined(WITH_DSPAM) && defined(WITH_DSPAM_DEVEL)
+	@${ECHO_CMD}
+	@${ECHO_CMD} "DSPAM and DSPAM_DEVEL are mutually exclusive."
+	@${ECHO_CMD} "Do a \"make rmconfig\" and start over."
+	@${ECHO_CMD}
+	@${FALSE}
+.endif
+.if (defined(WITH_CLAMAV) && defined(WITH_CLAMAV_DEVEL))
+	@${ECHO_CMD}
+	@${ECHO_CMD} "CLAMAV and CLAMAV_DEVEL are mutually exclusive."
+	@${ECHO_CMD} "Do a \"make rmconfig\" and start over."
+	@${ECHO_CMD}
+	@${FALSE}
+.endif
+
+post-patch:
+.for _file in ${SED_FILES}
+	@${REINPLACE_CMD} ${SED_SCRIPT} ${WRKSRC}/${_file}
+.endfor
+	@${CP} ${FILESDIR}/dspampd.rc ${WRKSRC}/dspampd.rc
+	@${REINPLACE_CMD} ${SED_CONF_SCRIPT} ${WRKSRC}/dspampd.rc
+	@${REINPLACE_CMD} ${SED_CONF_SCRIPT} ${WRKSRC}/dspampd.conf
+
+do-install::
+	@${INSTALL_SCRIPT}  ${WRKSRC}/dspampd ${PREFIX}/sbin/
+	@${MKDIR} ${CONF_DIR}
+.for _conf_file in dspampd.conf dspampd.applyto dspampd.relaycontrol
+	@${CP} ${WRKSRC}/${_conf_file} ${WRKSRC}/${_conf_file}.sample
+	@${INSTALL_DATA} ${WRKSRC}/${_conf_file}.sample ${CONF_DIR}/
+.endfor
+	@${INSTALL_SCRIPT} ${WRKSRC}/dspampd.rc ${RC_DIR}/dspampd${RC_SUFX}
+	${MKDIR} ${ARCHIVE_DIR}
+.if !defined(NOPORTDOCS)
+	@${MKDIR} ${DOCSDIR}
+	@${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}
+	@${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
+.endif
+
+do-build:
+	${DO_NADA}
+
+post-install:
+	@${ECHO_CMD}
+	@${ECHO_CMD} "------------------------------------------------------"
+	@${ECHO_CMD} "Copy"
+	@${ECHO_CMD} "${PREFIX}/etc/dspampd.conf.sample"
+	@${ECHO_CMD} "to"
+	@${ECHO_CMD} "${PREFIX}/etc/dspampd.conf"
+	@${ECHO_CMD} "and edit it to your needs."
+	@${ECHO_CMD} "Add dspampd_enable="YES" in /etc/rc.conf to start dspampd on boot"
+	@${ECHO_CMD} "-------------------------------------------------------"
+	@${ECHO_CMD}
+
+.include <bsd.port.post.mk>
diff --git a/mail/dspampd/distinfo b/mail/dspampd/distinfo
new file mode 100644
index 000000000000..c4ef16867476
--- /dev/null
+++ b/mail/dspampd/distinfo
@@ -0,0 +1,2 @@
+MD5 (dspampd-v2.00-rc2-with-patches-kurt-pinboard.tar.gz) = de35e2e7027e5a51413598945d92e72e
+SIZE (dspampd-v2.00-rc2-with-patches-kurt-pinboard.tar.gz) = 66326
diff --git a/mail/dspampd/files/dspampd.rc b/mail/dspampd/files/dspampd.rc
new file mode 100644
index 000000000000..a8306e362941
--- /dev/null
+++ b/mail/dspampd/files/dspampd.rc
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: dspampd
+# REQUIRE: LOGIN %%CLAMAV%% %%DSPAM%%
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf[.local] to enable dspampd:
+#
+#dspampd_enable="YES"
+#
+
+. /etc/rc.subr
+
+name=dspampd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/dspampd > /dev/null 2>&1
+pidfile=/var/run/dspampd.pid
+required_dirs=%%ARCHIVE_DIR%%
+required_files=%%CONF_DIR%%/dspampd.conf
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+  rm -f $pidfile
+}
+
+# set defaults
+
+dspampd_enable=${dspampd_enable:-"NO"}
+dspampd_flags=${dspampd_flags:-"--daemon"}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/dspampd/files/lpatch-dspampd_system_users.diff b/mail/dspampd/files/lpatch-dspampd_system_users.diff
new file mode 100644
index 000000000000..297c3b227e8c
--- /dev/null
+++ b/mail/dspampd/files/lpatch-dspampd_system_users.diff
@@ -0,0 +1,14 @@
+--- dspampd.dist	Sun Jan  2 00:05:34 2005
++++ dspampd	Sun Jan  2 00:40:10 2005
+@@ -2017,6 +2017,11 @@
+             $dspam{'dspam-user'} = ${applytoList}[0];
+             ## Remove angled arrows on addresses like: <caspian@dotconf.net>
+             $dspam{'dspam-user'} =~ s/^<|>$//go;
++			## FreeBSD-local patch if port built with WITHOUT_DSPAM_VIRT_USERS= on
++			## This works if you relay mail for system users ONLY
++			$dspam{'dspam-user'} =~ s/@.*$//go;			
++			## FreeBSD-local patch WITHOUT_DSPAM_VIRT_USERS= on
++			## end 
+             $dspam{'dspam-user'} =~ tr/A-Z/a-z/;    # convert to lower case
+         }
+         else {
diff --git a/mail/dspampd/files/patch-dspampd.conf b/mail/dspampd/files/patch-dspampd.conf
new file mode 100644
index 000000000000..d3801f817e25
--- /dev/null
+++ b/mail/dspampd/files/patch-dspampd.conf
@@ -0,0 +1,134 @@
+--- dspampd.conf.dist	Sat Jan  1 16:33:38 2005
++++ dspampd.conf	Sat Jan  1 16:37:41 2005
+@@ -43,7 +43,7 @@
+     ## Directory to store quarantined messages in. (/var/spool/dspam-archive)
+     ## This needs to be defined even if you don't archive anything, 
+     ## it is used for temporary file storage.
+-    archive-dir              => /var/spool/dspam-archive
++    archive-dir              => %%ARCHIVE_DIR%%
+     
+     ## Comma separated list of modules to pass email through.
+     ## Modules will be run in the order listed.
+@@ -52,16 +52,16 @@
+ 
+     ## Path to a file with entries that control what messages can be
+     ## relayed through us.
+-    ## Default: /etc/dspampd.relaycontrol
+-    //relaycontrolfile	     => /etc/dspampd.relaycontrol
++    ## Default: /usr/local/etc/dspampd/dspampd.relaycontrol
++    relaycontrolfile	     => %%CONF_DIR%%/dspampd.relaycontrol
+ 
+     ## Path to a file with entries that control what recipient domains
+     ## and/or recipient addresses the checks are applied to. No entry
+     ## at all causes all messages to be checked, otherwise only if at
+     ## least one of the recipients is configured, the messae is
+     ## checked (with the settings of the first matching recipient).
+-    ## Default: /etc/dspampd.applyto
+-    //applytocontrolfile     => /etc/dspampd.applyto
++    ## Default: /usr/local/etc/dspampd/dspampd.applyto
++    applytocontrolfile     => %%CONF_DIR%%/dspampd.applyto
+ 
+ 
+ 
+@@ -92,17 +92,19 @@
+     listenHost               => 127.0.0.1
+     
+     ## Port to accept smtp connections on.  ex. 25 or 10025
+-    listenPort               => 10025
++    listenPort               => 20024
+     
+     ## Fixme, this needs way more options ;)
+     ## Address to proxy mail to. ex: 127.0.0.1 or mail.isp.net
+     relayHost                => 127.0.0.1
+     
+     ## Port to on relayHost to proxy mail to. ex. 25 or 10125
+-    relayPort                => 10125
++    relayPort                => 20025
+     
+     ## maximum number of concurrent connections allowed
+-    concurrentConnections    => 128
++    # this is just a safe-belt, you should enforce this from your MTA
++    # and play with it until you get optimum performance for your site
++    concurrentConnections    => 10
+ 
+     ## timeouts for any/all connections (360 seconds)
+     timeout                  => 360
+@@ -113,7 +115,7 @@
+ [module:dspam]
+     
+     ## Full path to dspam binary (/usr/bin/dspam)
+-    dspam-command            => /usr/bin/dspam
++    dspam-command            => /usr/local/bin/dspam
+     
+     ## DSPAM training mode [toe|tum|teft]
+     training-mode            => tum
+@@ -125,7 +127,7 @@
+     // dspam-user               => spamfilter
+     
+     ## Additional command line arguments for dspam
+-    additional-arguments     => --feature=chained,noise
++    additional-arguments     => --feature=ch,no,wh,tb=4
+     
+     ## Write DSPAM headers into email header
+     ## 1 writes DSPAM headers in email, 0 leaves email untouched.
+@@ -134,17 +136,17 @@
+     ## Maximum size (in KB) of mail to scan.  Use 0 to scan all mail.
+     ## Messages larger than this are considered "unscanned" mail in the
+     ## next few options.
+-    max-size                 => 0
++    max-size                 => 250
+     
+     ## Deliver specified message types. (ham)
+     ## Note: "unscanned" is considered a subset of "ham"
+     ## Can be one of: all, ham, spam, unscanned, none
+-    deliver                  => ham
++    deliver                  => all
+     
+     ## archive a copy of specified message types. (spam)
+     ## Note: "unscanned" is considered a subset of "ham"
+     ## Can be one of: all, ham, spam, unscanned, none
+-    archive                  => spam
++    archive                  => none
+     
+     ## The following options are for advanced users only.  By default
+     ## if a message is NOT delivered it is bounced. 
+@@ -193,7 +195,7 @@
+     ## Full path to clamav's configuration file
+     ## This is used for determining how to connect to the clamd daemon.
+     ## Not yet implemented, use the following parameters instead.
+-    config-file              => /etc/clamav.conf
++    config-file              => /usr/local/etc/clamav.conf
+     
+     ## This is the socket type to use for connecting to clamd.
+     ## Possible values: TCP UNIX
+@@ -214,7 +216,7 @@
+     ## When using a socktype of UNIX, this is the full path of the
+     ## socket where clamd should be contacted.
+-    ## Default: /tmp/clamd
+-    peersocket               => /tmp/clamd
++    ## Default: /var/run/clamav/clamd
++    peersocket               => /var/run/clamav/clamd
+ 
+     ## Write ClamAV headers into email header.
+     ## Example header entries:
+@@ -230,11 +232,11 @@
+     
+     ## deliver specified message types. (clean)
+     ## devliver => <all | clean | infected | unscanned | none>
+-    deliver                  => clean
++    deliver                  => all
+     
+     ## archive a copy of specified message types. (infected)
+     ## archive => <all | clean | infected | unscanned | none>
+-    archive                  => infected
++    archive                  => none
+     
+     ## The following options are for advanced users only.  By default
+     ## if a message is NOT delivered it is bounced. 
+@@ -272,5 +274,5 @@
+     
+     // clean-custom-response => 220 Message is clean
+     // unscanned-custom-response => 220 Large message was not scanned by clamav
+-    infected-custom-response => 220 Virus infected message will be quarantined
++    // infected-custom-response => 220 Virus infected message will be quarantined
+     
diff --git a/mail/dspampd/files/patch-dspampd.relaycontrol b/mail/dspampd/files/patch-dspampd.relaycontrol
new file mode 100644
index 000000000000..73bf94c99079
--- /dev/null
+++ b/mail/dspampd/files/patch-dspampd.relaycontrol
@@ -0,0 +1,10 @@
+--- dspampd.relaycontrol.dist	Sun Jan  2 02:12:40 2005
++++ dspampd.relaycontrol	Sat Jan  1 17:34:25 2005
+@@ -39,6 +39,7 @@
+     ## relayed. Subdomains are included.
+     ## The only supported key type at the moment is 'allow'.
+     //allow => my.domain
++	allow => 127.0.0.1
+ 
+ [relay OK to Address]
+     
diff --git a/mail/dspampd/pkg-descr b/mail/dspampd/pkg-descr
new file mode 100644
index 000000000000..d96cf284c8e0
--- /dev/null
+++ b/mail/dspampd/pkg-descr
@@ -0,0 +1,9 @@
+DspamPD is a GPL'ed transparent smtp proxy written in perl 
+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.
+
+WWW: http://caspian.dotconf.net/menu/Software/DspamPD/
+
+-IOnut
+<itetcu@people.tecnik93.com>
diff --git a/mail/dspampd/pkg-plist b/mail/dspampd/pkg-plist
new file mode 100644
index 000000000000..da200ac11963
--- /dev/null
+++ b/mail/dspampd/pkg-plist
@@ -0,0 +1,10 @@
+sbin/dspampd
+etc/dspampd/dspampd.conf.sample
+etc/dspampd/dspampd.applyto.sample
+etc/dspampd/dspampd.relaycontrol.sample
+@dirrm etc/dspampd
+@unexec if cmp -s %D/etc/dspampd/dspampd.conf %D/etc/dspampd/dspampd.conf.sample; then rm -f %D/etc/dspampd/dspampd.conf; fi
+@exec echo "eeeee" ; %B
+@exec [-f %B/dspampd.conf] || cp %B/%f %B/dspampd.conf
+@cwd /
+@dirrm %%ARCHIVE_DIR%%
-- 
cgit v1.2.3