#author("2021-11-19T02:22:14+00:00","","") #topicpath ////////////////////////////////////////////////////////////////////////////// * ClamAV [#ybd9545e] - アンチウイルスソフト /////////////////////////////////////////////////////////////////////////////// * 目次 [#u3cbd3b6] #contents(); ////////////////////////////////////////////////////////////////////////////// * 準備 [#if342208] //============================================================================ ** インストール [#of00fd6f] - 幾つか設定の仕方があるが、定期自動実行をしたい為、 daemon をインストールする: # apt-get install clamav-daemon //============================================================================ ** 設定 [#dec237f6] - root 権限で実行させる ++ /etc/clamav/clamd.conf # User clamav User root --- この設定ファイルは、行の途中からコメントを書くことは出来ない(書くとエラーになる)ので注意。 ++ 変更を反映させる為、daemon を再起動する # /etc/init.d/clamav-daemon restart # /etc/init.d/clamav-daemon status - 自動実行させる ++ 自動実行用のスクリプトを用意する --- /root/bin/clamav-run.sh #!/bin/bash PATH=/usr/bin:/bin TITLE="" TO="To: root\n" SENDMAIL=/usr/sbin/sendmail CLAMDSCAN=/usr/bin/clamdscan #SENDMAIL=echo function err_print { local msg="${@}"; printf "\x1b[31mclamav-run.sh: ${msg}\x1b[0m\n"; } # update definition # freshclam > /dev/null # full scan (multi-thread) # ${CLAMDSCAN} --multiscan --verbose --move=/var/log/clamav/virus / # full scan (single-thread) ${CLAMDSCAN} --verbose --move=/var/log/clamav/virus / STATUS=$?; # report case ${STATUS} in 0 ) err_print "virus not found" TITLE="Subject: ClamAV scan OK" ;; 1 ) err_print "virus found (status = ${STATUS})" TITLE="Subject: ClamAV scan NG" ;; * ) err_print "error occured (status = ${STATUS})" TITLE="Subject: ClamAV scan Error" ;; esac echo -e ${TO}${TITLE} | cat - /var/log/clamav/clamav.log | ${SENDMAIL} -t unset err_print ++ cron に登録する # crontab -e ----------------------------------------------------- 0 0 * * * /root/bin/clamav-run.sh ----------------------------------------------------- ////////////////////////////////////////////////////////////////////////////// * 参考リンク [#z345252b] - [[Debian 9.3でchkrootkitとClamAVでウイルス対策 (Linux自作PC 9)>https://ksk-log.com/post/2017/12/2017-12-13-linux-gpu-pc9/]] - [[Debian 9.3 ClamAV高負荷問題の対処3 (Linux自作PC)>https://ksk-log.com/post/2018/01/2018-01-09-high-load4/]]