防病毒脚本 /opt/kaspersky/kav4fs_scan.sh
#!/bin/bash VIRUS_FOUND=1 CLEAN=0 UNDEFINED=2 KAV4FS='/opt/kaspersky/kav4fs/bin/kav4fs-control' if [ ! -x $KAV4FS ] then echo "Binary not executable" exit $UNDEFINED fi SCAN_OUTPUT=`$KAV4FS --scan-file "$1"` if [ "$?" -ne 0 ] then echo "Error due to check file '$1'" exit 3 fi while read line do OUT1=`echo $line|cut -d':' -f 1` OUT2=`echo $line|cut -d':' -f 2|sed 's/ //g'` case "$OUT1" in "Threats found" ) THREATS_C=$OUT2 ;; "Riskware found" ) RISKWARE_C=$OUT2 ;; "Infected" ) INFECTED=$OUT2 ;; "Suspicious" ) SUSPICIOUS=$OUT2 ;; "Scan errors" ) SCAN_ERRORS_C=$OUT2 ;; "Password protected" ) PASSWORD_PROTECTED=$OUT2 ;; "Corrupted" ) CORRUPTED=$OUT2 ;; esac done <<< "$SCAN_OUTPUT" if [ $INFECTED -gt 0 ] then exit $VIRUS_FOUND elif [ $THREATS_C -gt 0 -o $RISKWARE_C -gt 0 -o $SUSPICIOUS -gt 0 -o $SCAN_ERRORS_C -gt 0 -o $CORRUPTED -gt 0 ] then exit $UNDEFINED else exit $CLEAN fi
/opt/seafile/conf/seafile.conf 添加防病毒配置
[virus_scan] scan_command = /opt/kaspersky/kav4fs_scan.sh virus_code = 1 nonvirus_code = 0 scan_interval = 60
每天crontab清除kav4fs的日志/etc/cron.d/kav
30 0 * * * root find /var/log/kaspersky/kav4fs/supervisor_trace.log* -exec rm {} \; 40 0 * * * root /opt/kaspersky/kav4fs/bin/kav4fs-control -S --clean-stat