Using f-secure with PMG

Jul 31, 2020
6
7
23
55
Some days ago I have successfully activated f-secure. Just for the case, anybody is interested in the /usr/local/bin/pmg-custom-check, that's what I'm using:
Bash:
#!/bin/sh

if [ "$#" -ne 2 ]; then
  echo "usage: $0 APIVERSION QUEUEFILENAME" 1>&2
  exit 1
fi

apiver="$1"
shift

if [ "$apiver" != "v1" ]; then
  echo "wrong APIVERSION: $apiver" 1>&2
  exit 2
fi

echo "v1"

FSANALYZE="/opt/f-secure/linuxsecurity/bin/fsanalyze"
if [ ! -x "$FSANALYZE" ] ; then
        echo "ERROR: Virus Scanner '$$FSANALYZE' not accessible!" >&2
        exit 3
fi

RESULT=`$FSANALYZE -q --malware=none "$1" | sed -e 's/^.*infection=\([^ ]*\).*/\1/'`

if [ -z "$RESULT" ] ; then
        echo OK
else
        echo "VIRUS: $RESULT (f-secure)"
fi

exit 0