mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-28 05:29:48 +00:00
- 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
This commit is contained in:
parent
a8ede732b5
commit
078dd2cc19
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=103274
@ -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
|
||||
|
@ -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
|
||||
|
3
security/antivir-milter/files/avqrm.sh
Normal file
3
security/antivir-milter/files/avqrm.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec %%PREFIX%%/bin/avq --remove=$1
|
@ -81,4 +81,16 @@
|
||||
+# ScanTimeout 300
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
@@ -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
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user