summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2004-03-08 08:03:50 +0000
committernetchild <netchild@FreeBSD.org>2004-03-08 08:03:50 +0000
commitd6cef78f243ff4e098c7af3899dd1e4d82d6b854 (patch)
tree414f39d7e237f412bb30b929d7922ec8345b808e
parent2c161d0d168fec0466e6f9205b1d9e053a3a45ff (diff)
downloadFreeBSD-ports-d6cef78f243ff4e098c7af3899dd1e4d82d6b854.zip
FreeBSD-ports-d6cef78f243ff4e098c7af3899dd1e4d82d6b854.tar.gz
- Use daemon(8) for launching avmilter in order to detach it from the
controlling terminal. [1] - Make the avq script check if it's ran by the avmilter user in addition to uid == 0. This enables `avq --remove` to be run via a script and the ExternalProgram option in order to automatically delete the rejected messages. [2] - Install a script avqrm which serves this purpose, i.e. executes `avq --remove` and can be run via ExternalProgram. - Make the avq script not print the contents of the queue when option '--remove' is given, this greatly improves speed and otherwise it's not really suitable to be called on every rejected message. Fix some typos. - Fix pkg-plist by adding antivirupdater. Requested by: ache [1], [2] Submitted by: maintainer
-rw-r--r--security/antivir-milter/Makefile4
-rw-r--r--security/antivir-milter/files/antivirupdater.sh2
-rw-r--r--security/antivir-milter/files/avqrm.sh3
-rw-r--r--security/antivir-milter/files/patch-etc::avmilter.conf12
-rw-r--r--security/antivir-milter/files/patch-init::rc.avmilter8
-rw-r--r--security/antivir-milter/files/patch-script::avq51
-rw-r--r--security/antivir-milter/pkg-plist2
7 files changed, 70 insertions, 12 deletions
diff --git a/security/antivir-milter/Makefile b/security/antivir-milter/Makefile
index c24b993..564a2d2 100644
--- a/security/antivir-milter/Makefile
+++ b/security/antivir-milter/Makefile
@@ -6,6 +6,7 @@
PORTNAME= antivir-milter
PORTVERSION= 1.1.b
+PORTREVISION= 1
CATEGORIES= security mail
#MASTER_SITES= ftp://ftp.antivir.de/freebsd/ \
# http://www.antivir.de/dateien/antivir/release/
@@ -48,6 +49,8 @@ post-patch:
${WRKDIR}/pkg-message
@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/antivirupdater.sh > \
${WRKDIR}/antivirupdater.sh
+ @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${FILESDIR}/avqrm.sh > \
+ ${WRKDIR}/avqrm.sh
do-install:
@${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 ${PREFIX}/AntiVir
@@ -73,6 +76,7 @@ do-install:
@${INSTALL_PROGRAM} ${WRKSRC}/bin/avmilter ${PREFIX}/sbin
@${INSTALL_SCRIPT} ${WRKDIR}/antivirupdater.sh \
${PREFIX}/sbin/antivirupdater
+ @${INSTALL_SCRIPT} ${WRKDIR}/avqrm.sh ${PREFIX}/bin/avqrm
@${INSTALL_SCRIPT} ${WRKSRC}/init/rc.avmilter \
${PREFIX}/etc/rc.d/antivir-milter.sh
@${INSTALL} -d -o smmsp -g smmsp -m 700 /var/spool/avmilter
diff --git a/security/antivir-milter/files/antivirupdater.sh b/security/antivir-milter/files/antivirupdater.sh
index 40d90fd..6f309d9 100644
--- a/security/antivir-milter/files/antivirupdater.sh
+++ b/security/antivir-milter/files/antivirupdater.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-%%PREFIX%%/AntiVir/antivir -C %%PREFIX%%/etc/antivir.conf --home-dir=%%PREFIX%%/AntiVir --update $1
+exec %%PREFIX%%/AntiVir/antivir -C %%PREFIX%%/etc/antivir.conf --home-dir=%%PREFIX%%/AntiVir --update $1
diff --git a/security/antivir-milter/files/avqrm.sh b/security/antivir-milter/files/avqrm.sh
new file mode 100644
index 0000000..41419fe
--- /dev/null
+++ b/security/antivir-milter/files/avqrm.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec %%PREFIX%%/bin/avq --remove=$1
diff --git a/security/antivir-milter/files/patch-etc::avmilter.conf b/security/antivir-milter/files/patch-etc::avmilter.conf
index 341c81f..71a0e52 100644
--- a/security/antivir-milter/files/patch-etc::avmilter.conf
+++ b/security/antivir-milter/files/patch-etc::avmilter.conf
@@ -82,3 +82,15 @@
# ------------------------------------------------------------------------
+@@ -213,6 +214,11 @@
+ # rejected message.
+
+ # ExternalProgram /dir/my_own_script
++
++# Alternatively, uncomment the following line to automatically delete the
++# rejected message in the quarantine directory.
++
++# ExternalProgram %%PREFIX%%/bin/avqrm
+
+
+ # ------------------------------------------------------------------------
diff --git a/security/antivir-milter/files/patch-init::rc.avmilter b/security/antivir-milter/files/patch-init::rc.avmilter
index 80d874e..485e62a 100644
--- a/security/antivir-milter/files/patch-init::rc.avmilter
+++ b/security/antivir-milter/files/patch-init::rc.avmilter
@@ -8,8 +8,8 @@
- /usr/sbin/avmilter -p inet:3333@localhost
+ if [ -x %%PREFIX%%/sbin/avmilter ]; then
+ umask 0077
-+ rm -f /var/spool/avmilter/avmilter.sock
-+ %%PREFIX%%/sbin/avmilter \
++ /bin/rm -f /var/spool/avmilter/avmilter.sock
++ /usr/sbin/daemon -f %%PREFIX%%/sbin/avmilter \
+ -C %%PREFIX%%/etc/avmilter.conf \
+ -p local:/var/spool/avmilter/avmilter.sock &
+ umask 0022
@@ -20,8 +20,8 @@
- echo -n "Shutting down AntiVir Milter."
- killall -TERM /usr/sbin/avmilter
- echo
-+ killall -TERM avmilter
-+ rm -f /var/spool/avmilter/avmilter.sock
++ /usr/bin/killall -TERM avmilter
++ /bin/rm -f /var/spool/avmilter/avmilter.sock
+ echo -n " antivir-milter"
;;
restart)
diff --git a/security/antivir-milter/files/patch-script::avq b/security/antivir-milter/files/patch-script::avq
index a2f97fa..e8bf041 100644
--- a/security/antivir-milter/files/patch-script::avq
+++ b/security/antivir-milter/files/patch-script::avq
@@ -9,17 +9,54 @@
queue="`egrep -i '^[Ss][Pp][Oo][Oo][Ll][Dd][Ii][Rr]' ${configuration} | awk '{print $2;}'`"
queue_set=0
pname="`basename $0`"
-@@ -48,6 +48,13 @@
- data=
+@@ -49,6 +49,15 @@
systeme="`uname`"
date_param="-d"
-+
-+# Make sure the user running this program is root.
+
++# Make sure the user running this program is root or the avmilter user.
+procowner=${procowner:-`/usr/bin/id -u`}
-+if [ "$procowner" != "0" ]; then
-+ echo "${pname}: you must be the super-user (uid 0) to use this utility."
++user="`egrep -i '^user' $configuration | awk '{print $2;}'`"
++uid="`/usr/bin/id -u "$user"`"
++if [ "$procowner" != "0" -a "$procowner" != "$uid" ]; then
++ echo "${pname}: you must be root (uid 0) or the avmilter user to run this utility."
+ exit 2
+fi
-
++
usage() {
echo "${pname} usage:"
+ echo " ${pname} [--queue=DIR] "
+@@ -124,7 +133,7 @@
+ data=`/bin/ls "${queue}"/*/[Dd]f-"${id}"`
+ echo "ctor: ${ctrl} ${data}"
+ if [ ! -f "${data}" ] ; then
+- echo "${pname}: there is no data file id '${id}'"\
++ echo "${pname}: there is no data file id '${id}'"\
+ "in queue '$queue'."
+ exit 3
+ fi
+@@ -136,9 +145,13 @@
+ bnam="`basename ${ctrl}`"
+ case $newstate in
+ R)
+- ( /bin/rm "${ctrl}" && /bin/rm "${data}" ) \
+- && echo "${pname}: message id '${id}' removed." \
+- || echo "${pname}: could not remove message id '${id}'."
++ if ( /bin/rm "${ctrl}" && /bin/rm "${data}" ) > /dev/null 2>&1 ; then
++ echo "${pname}: message id '${id}' removed."
++ exit 0
++ else
++ echo "${pname}: could not remove message id '${id}'."
++ exit 3
++ fi
+ ;;
+ *)
+ Qtrl="`echo $bnam|sed -e 's/^.\(.*\)$/'${newstate}'\1/'`"
+@@ -179,7 +192,7 @@
+ group=`egrep -i '^group' "$configuration"|awk '{print $2;}'`
+ if [ -f "${data}" ] ; then
+ if /bin/ls "${queue}"/*/??-"${id}" > /dev/null 2>&1 ; then
+- echo "${pname}: there is already files with id '${id}'"
++ echo "${pname}: there are already files with id '${id}'"
+ echo "${pblan} in queue '${queue}'."
+ exit 3
+ else
diff --git a/security/antivir-milter/pkg-plist b/security/antivir-milter/pkg-plist
index 8827936..2ac8b81 100644
--- a/security/antivir-milter/pkg-plist
+++ b/security/antivir-milter/pkg-plist
@@ -6,6 +6,7 @@ AntiVir/antivir.vdf-dist_avfbmlt
@exec [ -f %B/antivir.vdf ] || cp -p %B/%f %B/antivir.vdf
@unexec rmdir %D/AntiVir 2> /dev/null || echo "If permanently deleting this package, %D/AntiVir and its contents must be removed manually."
bin/avq
+bin/avqrm
@unexec if cmp -s %D/etc/antivir.conf.sample %D/etc/antivir.conf; then rm -f %D/etc/antivir.conf; else echo "If permanently deleting this package, %D/etc/antivir.conf must be removed manually."; fi
etc/antivir.conf.sample
@exec [ -f %B/antivir.conf ] || cp %B/%f %B/antivir.conf
@@ -13,6 +14,7 @@ etc/antivir.conf.sample
etc/avmilter.conf.sample
@exec [ -f %B/avmilter.conf ] || cp %B/%f %B/avmilter.conf
etc/rc.d/antivir-milter.sh
+sbin/antivirupdater
sbin/avmilter
@exec install -d -o smmsp -g smmsp -m 700 /var/spool/avmilter
@exec install -d -o smmsp -g smmsp -m 700 /var/spool/avmilter/incoming
OpenPOWER on IntegriCloud