diff options
author | leeym <leeym@FreeBSD.org> | 2003-06-03 15:54:47 +0800 |
---|---|---|
committer | leeym <leeym@FreeBSD.org> | 2003-06-03 15:54:47 +0800 |
commit | dd4569c4be5d8e0831c1a7b0c7870e3b54ada3ad (patch) | |
tree | fc585b77d9a846cf03ff1ad8ee544e1b5621df5b /mail | |
parent | 474bd8386a729cad5bb3dac6f67a9f163ccb8350 (diff) | |
download | freebsd-ports-gnome-dd4569c4be5d8e0831c1a7b0c7870e3b54ada3ad.tar.gz freebsd-ports-gnome-dd4569c4be5d8e0831c1a7b0c7870e3b54ada3ad.tar.zst freebsd-ports-gnome-dd4569c4be5d8e0831c1a7b0c7870e3b54ada3ad.zip |
add pop3vscan-0.4
A transparent POP3-Proxy with virus-scanning capabilities
WWW: http://pop3vscan.sourceforge.net/
Dedicate to: Miss Borny @ National Taitung Teachers College
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile | 1 | ||||
-rw-r--r-- | mail/pop3vscan/Makefile | 53 | ||||
-rw-r--r-- | mail/pop3vscan/distinfo | 1 | ||||
-rw-r--r-- | mail/pop3vscan/files/patch-Makefile | 27 | ||||
-rw-r--r-- | mail/pop3vscan/files/patch-pop3vscan.c | 54 | ||||
-rw-r--r-- | mail/pop3vscan/files/patch-pop3vscan.h | 17 | ||||
-rw-r--r-- | mail/pop3vscan/files/pop3vscan.sh | 31 | ||||
-rw-r--r-- | mail/pop3vscan/pkg-descr | 8 | ||||
-rw-r--r-- | mail/pop3vscan/pkg-install | 128 | ||||
-rw-r--r-- | mail/pop3vscan/pkg-message | 19 | ||||
-rw-r--r-- | mail/pop3vscan/pkg-plist | 4 |
11 files changed, 343 insertions, 0 deletions
diff --git a/mail/Makefile b/mail/Makefile index 64cd0fb77611..0cadc4305ede 100644 --- a/mail/Makefile +++ b/mail/Makefile @@ -221,6 +221,7 @@ SUBDIR += pmail SUBDIR += pop3gwd SUBDIR += pop3lite + SUBDIR += pop3vscan SUBDIR += popa3d SUBDIR += popa3d-before-sendmail SUBDIR += popd diff --git a/mail/pop3vscan/Makefile b/mail/pop3vscan/Makefile new file mode 100644 index 000000000000..bacb63668c15 --- /dev/null +++ b/mail/pop3vscan/Makefile @@ -0,0 +1,53 @@ +# New ports collection makefile for: pop3vscan +# Date created: 01 June 2003 +# Whom: Yen-Ming Lee <leeym@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= pop3vscan +PORTVERSION= 0.4 +CATEGORIES= mail +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= ${PORTNAME} + +MAINTAINER= leeym@FreeBSD.org +COMMENT= A transparent POP3-Proxy with virus-scanning capabilities + +LIB_DEPENDS= pcre.0:${PORTSDIR}/devel/pcre + +.if !defined(WITHOUT_UVSCAN) +RUN_DEPENDS= uvscan:${PORTSDIR}/security/vscan +.endif + +USE_REINPLACE= yes +USE_GMAKE= yes + +pre-fetch: +.if !defined(WITHOUT_UVSCAN) + @${ECHO} + @${ECHO} "Type \"make WITHOUT_UVSCAN=yes\" if you DONT use UVSCAN." + @${ECHO} +.endif + +post-extract: + @${RM} ${WRKSRC}/ripmime/ripmime.a + +post-patch: + @${REINPLACE_CMD} -e 's,malloc.h,stdlib.h,g' ${WRKSRC}/*.c + @${REINPLACE_CMD} -e 's,#endif.*,#endif,g' ${WRKSRC}/*.h + @${REINPLACE_CMD} -e 's,make,${GMAKE},g' ${WRKSRC}/ripmime/build_tnef + @${REINPLACE_CMD} -e 's,=4321,=_BYTE_ORDER -include machine/endian.h,g' \ + ${WRKSRC}/ripmime/tnef/Makefile + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/pop3vscan ${PREFIX}/sbin/ + ${INSTALL_DATA} ${WRKSRC}/pop3vscan.conf ${PREFIX}/etc/pop3vscan.conf.sample + ${INSTALL_DATA} ${WRKSRC}/pop3vscan.mail ${PREFIX}/etc/pop3vscan.mail.sample + ${INSTALL_SCRIPT} ${FILESDIR}/pop3vscan.sh ${PREFIX}/etc/rc.d/ + +post-install: + @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + @${SED} -e 's,PREFIX,${PREFIX},g' ${PKGMESSAGE} + +.include <bsd.port.mk> diff --git a/mail/pop3vscan/distinfo b/mail/pop3vscan/distinfo new file mode 100644 index 000000000000..49a176f2c9b8 --- /dev/null +++ b/mail/pop3vscan/distinfo @@ -0,0 +1 @@ +MD5 (pop3vscan-0.4.tar.gz) = 48783c81cf70590637993aa0082fa467 diff --git a/mail/pop3vscan/files/patch-Makefile b/mail/pop3vscan/files/patch-Makefile new file mode 100644 index 000000000000..261ddff58c85 --- /dev/null +++ b/mail/pop3vscan/files/patch-Makefile @@ -0,0 +1,27 @@ +--- Makefile.orig Wed Jun 12 08:19:05 2002 ++++ Makefile Tue Jun 3 03:23:37 2003 +@@ -21,11 +21,10 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + +-PREFIX=/usr + CC=gcc + #CFLAGS=-Wall -ggdb +-CFLAGS=-Wall -O2 +-LDFLAGS=-L. -lmime -lpcre #-static ++CFLAGS=-Wall -O2 -I$(PREFIX)/include -DPREFIX=\"${PREFIX}\" ++LDFLAGS=-L. -lmime -lpcre -L$(PREFIX)/lib #-static + + OBJECTS=getline.o parsefile.o pop3vscan.o \ + scanner_basic.o scanner_avpd.o scanner_trophie.o +@@ -50,8 +49,8 @@ + + dep depend .dep: + @echo "creating depencies" +- rm .tmp.dep -f +- @find -name "*.c" -maxdepth 1 -print0 | xargs -n 1 -0rt $(CC) -M $(CFLAGS) >>.tmp.dep ++ rm -f .tmp.dep ++ @find . -name "*.c" -maxdepth 1 -print0 | xargs -n 1 -0t $(CC) -M $(CFLAGS) >>.tmp.dep + mv .tmp.dep .dep + + install: pop3vscan diff --git a/mail/pop3vscan/files/patch-pop3vscan.c b/mail/pop3vscan/files/patch-pop3vscan.c new file mode 100644 index 000000000000..cdb33b9f7ace --- /dev/null +++ b/mail/pop3vscan/files/patch-pop3vscan.c @@ -0,0 +1,54 @@ +--- pop3vscan.c.orig Wed Jun 12 08:19:05 2002 ++++ pop3vscan.c Tue Jun 3 03:23:38 2003 +@@ -29,9 +29,10 @@ + #include <string.h> + #include <arpa/inet.h> + #include <netinet/in.h> ++#include <sys/types.h> ++#include <netinet/in_systm.h> + #include <netinet/ip.h> + #include <sys/socket.h> +-#include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <unistd.h> +@@ -44,8 +45,8 @@ + #include <syslog.h> + #include <sys/param.h> + #include <ctype.h> +-#include <linux/netfilter_ipv4.h> +-#include <malloc.h> ++//#include <linux/netfilter_ipv4.h> ++#include <stdlib.h> + #include <getopt.h> + #include <netdb.h> + #include <libgen.h> +@@ -66,14 +67,14 @@ + /* default configuration, anything can be changed at runtime {{{1 */ + #define PORT_NUMBER 8110 + #define MAX_CHILDS 10 +-#define RUNAS_USER "mail" ++#define RUNAS_USER "pop3vscan" + #define VIRUS_DIR "/var/spool/pop3vscan" + #define VIRUS_SCANNER NULL + #define VIRUS_SCANNER_VIRUSCODE 1 + #define PID_FILE "/var/run/pop3vscan.pid" + #define SYSLOG_NAME "pop3vscan" +-#define CONFIGFILE "/etc/pop3vscan.conf" +-#define VIRUS_TEMPLATE "/etc/pop3vscan.mail" ++#define CONFIGFILE PREFIX"/etc/pop3vscan.conf" ++#define VIRUS_TEMPLATE PREFIX"/etc/pop3vscan.mail" + #define DEBUG 0 + /* TOS: do not set, or use IPTOS_[LOWDELAY|THROUGHPUT|RELIABILITY|LOWCOST] */ + #define SET_TOS IPTOS_THROUGHPUT +@@ -519,8 +520,8 @@ + inet_ntoa(p->client_addr.sin_addr), ntohs(p->client_addr.sin_port)); + + p->server_addr.sin_family = AF_INET; +- if (getsockopt(p->client_fd, SOL_IP, SO_ORIGINAL_DST, &p->server_addr, &p->socksize)){ +- do_log(LOG_CRIT, "No IP-Conntrack-data (getsockopt failed)"); ++ if (getsockname(p->client_fd, (struct sockaddr*)&p->server_addr, &p->socksize)){ ++ do_log(LOG_CRIT, "No IP-Conntrack-data (getsockname failed)"); + return 1; + } + do_log(LOG_NOTICE, "Real-server adress is %s:%i", diff --git a/mail/pop3vscan/files/patch-pop3vscan.h b/mail/pop3vscan/files/patch-pop3vscan.h new file mode 100644 index 000000000000..2a528645c2ff --- /dev/null +++ b/mail/pop3vscan/files/patch-pop3vscan.h @@ -0,0 +1,17 @@ +--- pop3vscan.h.orig Wed Jun 12 08:19:05 2002 ++++ pop3vscan.h Tue Jun 3 03:23:38 2003 +@@ -28,6 +28,7 @@ + /* includes {{{1 */ + #include <syslog.h> /* do_log */ + #include <arpa/inet.h> /* config */ ++#include <netinet/in.h> + + /* definitions {{{1 */ + #define PROGNAME "POP3VScan" +@@ -129,5 +130,5 @@ + extern void do_log(int level, const char *fmt,...); + + /* }}} */ +-#endif _POP3VSCAN_H ++#endif + /* vim:set fdm=marker: */ diff --git a/mail/pop3vscan/files/pop3vscan.sh b/mail/pop3vscan/files/pop3vscan.sh new file mode 100644 index 000000000000..8bdbb9892de6 --- /dev/null +++ b/mail/pop3vscan/files/pop3vscan.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then + echo "$0: Cannot determine the PREFIX" >&2 + exit 1 +fi + +user=pop3vscan +scanner=${PREFIX}/bin/uvscan +virusregexp="^[[:space:]]*Found( the|:)[[:space:]]*(.*)[[:space:]]*(|virus[^a-z.]*)$/2" +template=${PREFIX}/etc/pop3vscan.mail +viruscode=13 + +case "$1" in + start) + echo -n "Starting POP3VScan" + ${PREFIX}/sbin/pop3vscan --user=${user} --scanner=${scanner} --virusregexp="${virusregexp}" --template=${template} --viruscode=${viruscode} || exit 1 + ;; + stop) + echo -n "Shutting down POP3VScan" + kill `cat /var/run/pop3vscan.pid 2>/dev/null` &>/dev/null || exit 1 + ;; + reload|restart) + $0 stop && sleep 1 && $0 start || exit 1 + ;; + *) + echo "Usage: $0 {start|stop|reload|restart}" + exit 1 +esac + +exit 0 diff --git a/mail/pop3vscan/pkg-descr b/mail/pop3vscan/pkg-descr new file mode 100644 index 000000000000..a9b911d3ad67 --- /dev/null +++ b/mail/pop3vscan/pkg-descr @@ -0,0 +1,8 @@ +POP3VScan is a transparent POP3-Proxy with virus-scanning capabilities. +This means that all your POP3-Clients in the Network can't fetch mails +from the internet without that POP3VScan have scanned it. If a virus has +been found the mail is replaced with a notification and the original +(infeceted) version is stored on the harddisc. Transparent means, that +neither the client nor any of the used POP3-servers has to be configured. + +WWW: http://pop3vscan.sourceforge.net/ diff --git a/mail/pop3vscan/pkg-install b/mail/pop3vscan/pkg-install new file mode 100644 index 000000000000..b478c2a8b668 --- /dev/null +++ b/mail/pop3vscan/pkg-install @@ -0,0 +1,128 @@ +#!/bin/sh + +chmods_done=" " + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +make_account() { + local u g gcos homeopt home + + u=$1 + g=$2 + gcos=$3 + homeopt=${4:+"-d $4"} + + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." + else + echo "You need a group \"${g}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw groupadd ${g} || exit + echo "Done." + else + echo "Please create it, and try again." + if ! grep -q "^${u}:" /etc/passwd; then + echo "While you're at it, please create a user \"${u}\" too," + echo "with a default group of \"${g}\"." + fi + exit 1 + fi + fi + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." + else + echo "You need a user \"${u}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw useradd ${u} -g ${g} -h - ${homeopt} \ + -s /nonexistent -c "${gcos}" || exit + echo "Done." + else + echo "Please create it, and try again." + exit 1 + fi + fi + + if [ x"$homeopt" = x ]; then + eval home=~${u} + if [ ! -d "${home}" ]; then + if yesno \ + "Would you like me to create ${u}'s home directory (${home})" y + then + (umask 77 && \ + mkdir -p ${home}) || exit + chown -R ${u}:${g} ${home} || exit + else + echo "Please create it, and try again." + exit 1 + fi + fi + fi +} + +case $2 in + +POST-INSTALL) + if which -s pw && which -s lockf; then + : + else + cat <<EOF + +This system looks like a pre-2.2 version of FreeBSD. I see that it +is missing the "lockf" and/or "pw" utilities. I need these utilities. +Please get them and install them, and try again. You can get the +sources from: + + ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz + ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz + +EOF + exit 1 + fi + + user=pop3vscan + group=mail + spooldir=/var/spool/pop3vscan + etcdir=${PREFIX:-$PKG_PREFIX}/etc + + echo "" + make_account ${user} ${group} "POP3VScan Daemon" ${spooldir} + + if [ ! -d ${spooldir} ]; then + echo "Creating \"${spooldir}\"." + mkdir -p ${spooldir} + fi + + echo "Fixing ownerships and modes in \"${spooldir}\"." + chown -R ${user}:${group} ${spooldir} + chmod -R go= ${spooldir} + + ;; +esac diff --git a/mail/pop3vscan/pkg-message b/mail/pop3vscan/pkg-message new file mode 100644 index 000000000000..daacf271189e --- /dev/null +++ b/mail/pop3vscan/pkg-message @@ -0,0 +1,19 @@ +********************************************************************** + +By default, POP3VScan is configured to work with McAfee UVSCAN. +Please copy PREFIX/etc/pop3vscan.conf.sample to pop3vscan.conf and modify +PREFIX/etc/pop3vscan.conf and/or PREFIX/etc/rc.d/pop3vscan.sh to +fit your environment. + +Don't forget to copy PREFIX/etc/pop3vscan.mail.sample to pop3vscan.mail +and edit your own template for virus notifications. + +By the way, you need to enable IPFIREWALL and IPFIREWALL_FORWARD options +in kernel, and add the forwarding rule into your IPFW table, + +# ipfw add fwd 192.168.0.254,8110 tcp from 192.168.0.0/24 to any pop3 + +while 192.168.0.254 is the IP of your internal interface, 8110 is the +default port of POP3VScan, and 192.168.0.0/24 is the IP range of your LAN. + +********************************************************************** diff --git a/mail/pop3vscan/pkg-plist b/mail/pop3vscan/pkg-plist new file mode 100644 index 000000000000..1dad50f09c06 --- /dev/null +++ b/mail/pop3vscan/pkg-plist @@ -0,0 +1,4 @@ +etc/pop3vscan.conf.sample +etc/pop3vscan.mail.sample +etc/rc.d/pop3vscan.sh +sbin/pop3vscan |