1. 설치

# EPEL 저장소 활성화
sudo epel-release -y

# clamav 설치
sudo yum install clamav clamav-update clamav-scanner-systemd clamav-server-systemd -y

2. 바이러스DB 최초 업데이트

ClamAV는 설치 직후에는 DB가 비어 있어 동작하지 않으니, freshclam으로 DB를 먼저 업데이트가 필요하다.

sudo freshclam

3. ClamAV 데몬(clamd) 활성화

ProFTPD 연동은 clamscan 단발성 실행보다 데몬 방식(clamd)을 권장함

# 서비스 활성화 및 시작 
# clamd@ 형태로 서비스를 실행함 
sudo systemctl enable --now clamd@scan

# 상태 확인
systemctl status clamd@scan
  • 위 명령어에서 에러 발생시 TCP 소켓 혹은 유닉스 소켓 설정이 필요함
  • 기본적으로 /var/run/clamd.scan/clamd.sock 유닉스 소켓으로 동작.
  • TCP 소켓(예: 3310)으로 열고 싶다면 /etc/clamd.d/scan.conf 수정 필요

      TCPSocket 3310
      TCPAddr 127.0.0.1
    

4. 동작확인

# EICAR 테스트 파일(무해한 테스트 바이러스 시그니처) 다운로드
curl -o eicar.com.txt https://secure.eicar.org/eicar.com.txt

# clamscan 단발성 검사
clamscan eicar.com.txt

# clamd 데몬을 통한 검사
clamdscan eicar.com.txt
  • clamscan 을 통해 검사를 수행하면 오래걸린다 그 이유는 모든 엔진과 DB를 단발성으로 로드하기 떄문이다. 따라서 테스트를 제외하고 프로덕션에서 사용하지 않는걸 권장한다.

아래와 같이 출력되면 정상이다

eicar.com.txt: Win.Test.EICAR_HDB-1 FOUND

----------- SCAN SUMMARY -----------
Infected files: 1
Total errors: 1
Time: 0.011 sec (0 m 0 s)
Start Date: 2025:09:19 16:35:21
End Date:   2025:09:19 16:35:21

Reference