[ Server ][ CentOS7 ] ClamAV AntiVirus install > linux

본문 바로가기
사이트 내 전체검색

linux

[ Server ][ CentOS7 ] ClamAV AntiVirus install

페이지 정보

작성자 웹지기 댓글 0건 조회 7,672회 작성일 19-09-03 14:46

본문

Notes on ClamAV AntiVirus

CentOS 7 VM notes:
Set /etc/clamd.d/scan.conf “MaxThreads” to 1 (default is 10) to avoid too much CPU usage upon reboot

CentOS 7 issues:
https://www.adminsys.ch/2015/08/21/installing-clamav-epel-centosred-hat-7-nightmare/ 
http://linux-audit.com/install-clamav-on-centos-7-using-freshclam/

If not CentOS7, start with this procedure - or see steps listed below: 
http://www.centosblog.com/how-to-install-clamav-and-configure-daily-scanning-on-centos/

Other links: 
http://www.clamav.net/
http://tboxmy.blogspot.com/2013/06/install-clamav-antivirus-on-centos.html
http://tboxmy.blogspot.com/2013/06/install-yum-repo-for-centos.html
http://www.digitalsanctuary.com/tech-blog/debian/automated-clamav-virus-scanning.html

Steps done as root on local linux box:

Notes:

  • Make sure the “epel” yum repository is installed first
  • Using the “rpmforge” repository resulted in conflicting clam vs clamav users
  • The “clamav-milter” package is only for sendmail scanning on send

yum install clamav clamav-db clamav-devel clamav-milter clamd

chkconfig –list |grep clam (should see results for “clamav-milter” and “clamd”)

chkconfig clamav-milter on

chkconfig clamd on

service clamd start

service clamav-milter start

freshclam (to update)

run a recursive scan: clamscan -r -l scan.txt /path/to/dir

Set up crons (credit Devon Hillard):

/etc/cron.hourly/clamscan_hourly

#!/bin/bash
# email subject
SUBJECT="VIRUS DETECTED ON `hostname`!!!"
# Email To ?
EMAIL="USER@DOMAIN"
# Log location
LOG=/var/log/clamav/scan.log
echo "" >> ${LOG}
echo "***Start /etc/cron.hourly/clamscan_hourly at `date`" >> ${LOG}
check_scan () {
    # Check the last set of results. If there are any "Infected" counts that aren't zero, we have a problem.
    if [ `tail -n 12 ${LOG}  | grep Infected | grep -v 0 | wc -l` != 0 ]
    then
        EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
        echo "To: ${EMAIL}" >>  ${EMAILMESSAGE}
        echo "From: root@`hostname`" >>  ${EMAILMESSAGE}
        echo "Subject: ${SUBJECT}" >>  ${EMAILMESSAGE}
        echo "Importance: High" >> ${EMAILMESSAGE}
        echo "X-Priority: 1" >> ${EMAILMESSAGE}
        echo "`tail -n 50 ${LOG}`" >> ${EMAILMESSAGE}
        #sendmail -t < ${EMAILMESSAGE}
        /usr/bin/mutt -s "${SUBJECT}" $EMAIL < ${EMAILMESSAGE}
    fi
}
find / -not -wholename '/sys/*' -and -not -wholename '/proc/*' -mmin -61 -type f -print0 | xargs -0 -r clamscan --exclude-dir=/proc/ --exclude-dir=/sys/ --quiet --infected --log=${LOG}
check_scan
find / -not -wholename '/sys/*' -and -not -wholename '/proc/*' -cmin -61 -type f -print0 | xargs -0 -r clamscan --exclude-dir=/proc/ --exclude-dir=/sys/ --quiet --infected --log=${LOG}
check_scan
echo "***End /etc/cron.hourly/clamscan_hourly at `date`" >> ${LOG}
echo "" >> ${LOG}

/etc/cron.daily/clamscan_daily

#!/bin/bash
# email subject
SUBJECT="VIRUS DETECTED ON `hostname`!!!"
# Email To ?
EMAIL="USER@DOMAIN"
# Log location
LOG=/var/log/clamav/scan.log
echo "" >> ${LOG}
echo "***Start /etc/cron.daily/clamscan_daily at `date`" >> ${LOG}
check_scan () {
    # Check the last set of results. If there are any "Infected" counts that aren't zero, we have a problem.
    if [ `tail -n 12 ${LOG}  | grep Infected | grep -v 0 | wc -l` != 0 ]
    then
        EMAILMESSAGE=`mktemp /tmp/virus-alert.XXXXX`
        echo "To: ${EMAIL}" >>  ${EMAILMESSAGE}
        echo "From: root@`hostname`" >>  ${EMAILMESSAGE}
        echo "Subject: ${SUBJECT}" >>  ${EMAILMESSAGE}
        echo "Importance: High" >> ${EMAILMESSAGE}
        echo "X-Priority: 1" >> ${EMAILMESSAGE}
        echo "`tail -n 50 ${LOG}`" >> ${EMAILMESSAGE}
        #sendmail -t < ${EMAILMESSAGE}
        /usr/bin/mutt -s "${SUBJECT}" $EMAIL < ${EMAILMESSAGE}
    fi
}
clamscan -r / --exclude-dir=/sys/ --quiet --infected --log=${LOG}
check_scan
echo "***End /etc/cron.daily/clamscan_daily at `date`" >> ${LOG}
echo "" >> ${LOG}

Make sure that the new cron files are set to executable (chmod +x)

Remember that email from crons will require setup (see GMail on Linux with SSMTP)

Test that clamd runs upon a reboot (it should)

Clamav may report errors in the scan logs if SELinux is set to enforcing; some files cannot be checked even as root.

Check /var/log/clamav for log files updating; freshclam failed on one box because log files had bad permissions. User “clam” and user “clamav” seemed to conflict, and another box only had user clam, not both. This can happen when the clamd RPM and the clamav RPM come from different sources. The following recommendations are what are used in my VM distributions of ZendTo. There are 2 usernames involved: “clam” and “clamav”.

The following is all based on the line

User clam

appearing in the file /etc/clamd.conf

More info: http://zend.to/clamavpermissions.php

Fix: Disable rpmforge in /etc/yum.repos.d/ directory

Other scripts: https://www.annasseh.info/knowledgebase/30/Install-ClamAV--on-CentOS-6---64-bit-plus-Configure-Daily-Scanning.html

추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

Total 103건 6 페이지
  • 28 [ Server ][ Linux ] CentOS7 Hostname 변경 / 설정하기
  • 호스트 네임이 무엇으로 되어있는지 확인해보자. # hostname # localhost.localhostname # hostname &lt;변경하고 싶은 호스트명&gt; # hostname 이렇게 하면 현재 상태의 호스트명이 일회성으로 변경이 된다. 이를 영구적으로 변경하고 싶으면 다음의 명령을 사용한다. # hostnamectl set-hostname &lt;변경하고 싶은 호스트명&gt; ...
  • 웹지기 08-12 4744 0 0 댓글 0
  • 27 [ Server ][ Linux ] CentOS7 IP 확인 설정 변경하기
  • CentOS7 Minimal 로 설치시 별 다른 패키지가 설치 되어있지 않아 설치하기 전에는 다음의 명령을 사용한다. # ip address [root@cms_db ~]# ip address 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 in...
  • 웹지기 08-12 8243 0 0 댓글 0
  • 열람중 [ Server ][ CentOS7 ] ClamAV AntiVirus install
  • Notes on ClamAV AntiVirus CentOS 7 VM notes:Set /etc/clamd.d/scan.conf “MaxThreads” to 1 (default is 10) to avoid too much CPU usage upon reboot CentOS 7 issues:https://www.adminsys.ch/2015/08/21/installing-clamav-epel-centosred-hat-7-nightmare/http://linux-audit.com/install-cl...
  • 웹지기 09-03 7673 0 0 댓글 0
  • 25 [ Server ][ CentOS7] ModSecurity: Warning. Operator GE match…
  • [Tue Sep 24 13:17:58.056498 2019] [:error] [pid 3620:tid 140457073518336] [client 127.0.0.1:36381] [client 127.0.0.1] ModSecurity: Warning. Operator GE matched 5 at TX:inbound_anomaly_score. [file "/etc/httpd/modsecurity.d/activated_rules/modsecurity_crs_60_correlation.conf&...
  • 웹지기 09-24 4303 0 0 댓글 0
  • 22 [ server ][ linux ] CentOS7 특정 포트 확인 및 강제 종료
  • 특정 포트를 사용중인지 확인하기 위한 방법 어디에 사용되는 포트인지 알고 싶은 포트를 8882 의 위치에 적는다. kill에서 -9는 강제종료 맨뒤 숫자는 pid 번호 # lsof -i TCP:8882 # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME # php 109808 root 4u IPv4 201975 0t0 TCP *:8882 (LISTEN) # php 109808 root 7u IPv...
  • 웹지기 10-11 5304 0 0 댓글 0
  • 21 [ server ][ linux ] Centos7 ssl - 호스트에 필요한 TLS 설명 및 버젼 확인
  • Transport Layer Security 인터넷에서의 정보를 암호화해서 송수신하는 프로토콜, 넷스케이프 커뮤니케이션스가 개발한 SSL(Secure Sockets Layer)에 기반한 기술로, 국제 인터넷 표준화 기구에서 표준으로 인정하는 프로토콜이다. 표준에 명시된 정식 명칭은 TLS지만 아직도 SSL 이라는 용어가 많이 사용되고 있다. CentOS7 에서 다음으로 현재 사용하는 버젼을 확인 tls 1.2 # openssl s_client -connect www.googl...
  • 웹지기 10-18 6930 0 0 댓글 0
  • 20 [ Server ][ Linux ] CentOS7 Let's Encrypt 무료 SSL인증서 설치 / 관리(…
  • ※ 서버의 관리자 권한으로 접속해야 다음의 명령들이 실행이 가능해 진다. certbot 설치 1) 자동설치) https://certbot.eff.org 사이트 접속해서 본인 서버의 운영체제를 체크하고 진행하게 도와준다. 2)수동설치 - 아파치존 AAI기준) = AAI에서는 기본 설치명령을 통해 python-certbot-apache가 자동으로 설치되므로 추가 설치는 필요치 않다. = AAI에서 adduser.sh를 통해서 자동으로 ssl을 설치할 수 있지만, 1개의 계정에 1개...
  • 웹지기 10-31 6982 1 0 댓글 2
  • 18 [ Server ][ Linux ] CentOS7 su 접속 그룹으로 제한하기
  • CentOS7 의 경우 우분투처럼 관리자의 권한이 있는 계정만 su로 로그인이 되지 않고, 모든 계정이 로그이 되게 설정되어있다. 이를 특정계정만 로그인이되게 그룹을 설정해서 접속을 제한하는 방법이다. root 또는 su로 이동해서 명령을 실행한다. # vim /etc/pam.d/su 해당 파일을 열면 다음과 같은 결과를 얻을 것이다. 아래 결과에서 pam_wheel.so use_uid 부분의 주석을 제거해준다. # #%PAM-1.0 # auth ...
  • 웹지기 11-05 6592 0 0 댓글 0
  • 17 [ Server ][ Linux ] CentOS7 ZipArchive 설치(php-pecl-zip)
  • 패키지 설치 및 실행 확인 # yum search zip |grep -i php # # * remi-php72: ftp.riken.jp # php-mcnetic-zipstreamer.noarch : Stream zip files without i/o overhead # php-pclzip.noarch : Compression and extraction functions for Zip formatted # php-pecl-zip.x86_64 : A ZI...
  • 웹지기 11-04 7620 1 0 댓글 1
  • 15 [ Server ][ Linux ] CentOS7 htmlspecialchars 사용설정
  • htmlspecialchars 함수를 사용하기 위해서는 다음의 ini설정을 변경해 주어야 한다. php.ini filter.default, filter.default_flags 설정 AAI 멀티 버젼 같은 경우 각각의 PHP버젼별로 php.ini파일이 다르므로 검색을 해서 위치를 찾는다 # find / -name php.ini # /etc/opt/remi/php70/php.ini # /etc/opt/remi/php71/php.ini # /etc/opt/rem...
  • 웹지기 12-03 5193 0 0 댓글 0
  • 14 [ Server ][ Linux ] CentOS7 Let's Encrypt 무료 SSL 인증서 와일드카드로 …
  • 입력시 일반 도메인(domain.com)과 와일드카드(*.domain.com) 도메인 두번 적는다 # certbot certonly --manual --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory -d domain.com -d *.domain.com 이메일을 입력하라는 문구가 나오면 인증서 알림을 받을 이메일을 입력한다. # Saving debug log t...
  • 웹지기 12-12 5502 1 0 댓글 1
게시물 검색

회원로그인

접속자집계

오늘
8,333
어제
23,621
최대
33,828
전체
8,530,495

그누보드5
Copyright © funyphp.com. All rights reserved.