이 글은 CentOS 6.6에서 클램 안티바이러스를 설치하는 방법에대해 정리한글입니다.
클램 안티바이러스는 오픈소스로 리눅스 및 윈도우에서 포괄적으로 설치가 가능하며
바이러스의 검사가 가능하나 감염된 파일을 치료해주지는 않습니다. 사용시 이점에 유의해야합니다.
주의 : 이 글을 참고후 설치하여 발생하는 문제점은 작성자 및 스마일서브가 책임을 지지않습니다.
사용 서버 : 가상서버 CentOS 6.6 64 bit
서버 상태 : 초기 셋팅 상태
epel-release 설치
클램 안티바이러스를 설치전 epel-release의 설치를 진행해야합니다.
# yum install epel-release
클램(ClamAV) 안티바이러스 설치
epel-release의 설치가 완료되었다면 클램 안티바이러스를 설치합니다.
# yum install clamav
클램 안티 바이러스 사용
clamscan -r 디렉토리명을 이용해 사용하면 검사가 진행되지만 이런 메세지가 나올수도 있습니다.
안의 내용을 구글 번역등으로 살펴보면 데이터 베이스를 업데이트 하라는 부분을 확인할수있습니다.
이 부분을 해결해 보기위해 업데이트를 진행해보겠습니다.
[root@localhost ~]# clamscan -r /etc
LibClamAV Warning: ************************************************** LibClamAV Warning: *** The virus database is older than 7 days! *** LibClamAV Warning: *** Please update it as soon as possible. *** LibClamAV Warning: ************************************************** LibClamAV Error: Can’t load /var/lib/clamav/main.cvd: Can’t verify database integrity LibClamAV Error: cli_loaddbdir(): error loading database /var/lib/clamav/main.cvd ERROR: Can’t verify database integrity
———– SCAN SUMMARY ———–
Known viruses: 78529 Engine version: 0.99.1 Scanned directories: 0 Scanned files: 0 Infected files: 0 Data scanned: 0.00 MB Data read: 0.00 MB (ratio 0.00:1) Time: 0.306 sec (0 m 0 s)
|
클램 안티바이러스 데이터베이스 업데이트 (실패 부분)
아래의 명령어를 입력하면 업데이트가 진행됩니다. 우선 첫번째로 실패할 부분을 보여드린것은
저뿐만이 아니라 다른 분도 업데이트 진행시 실패할 가능성이 있을것같아 이부분을 먼저 보여드렸습니다.
데이터베이스 업데이트
# freshclam
이 부분은 아래 문제로 인해 일어날 가능성이 있습니다. 제가 잘못본 부분도 있을수
있기때문에 홈페이지에 있는 원문을 아래에 적어두겠습니다.
1. 방화벽에서 53포트가 차단되어있다.
2. /etc/resolv.conf에 등록된 네임서버가 정상적으로 작동하고 있지않다.
원문 ( https://www.clamav.net/documents/troubleshooting-faq )
I get this error when running freshclam: ERROR: Connection with ??? failed . What shall I do?
Either your dns servers are not working or you are blocking port 53/tcp. You should manually check that you can resolve hostnames with: $ host database.clamav.net. If it doesn’t work, check your dns settings in /etc/resolv.conf. If it works, check that you can receive dns answers longer than 512 bytes, e.g. check that your firewall is not blocking packets which originate from port 53/tcp. An easy way to find it out is: $ dig @ns1.clamav.net db.us.big.clamav.net
|
클램 안티바이러스 데이터베이스 업데이트 (성공 부분)
저의 경우 방화벽에서 53번 포트가 차단되어있지않았고 등록된 네임서버도 따로 문제가 있는편은 아니었습니다.
시간적 여유를 두고 2~3번 freshclam을 진행하니 정상적으로 업데이트가 진행된 부분을 확인할수 있었습니다.
데이터베이스 업데이트
# freshclam
바이러스 검사
clamscan -r /디렉토리 명령어를 이용해서 검사가 정상적으로 진행된점을 확인할수있습니다.
간략한 사용 방법은 아래와 같습니다.
디렉토리를 정한 후 그 디렉토리를 검사
# clamscan -r /디렉토리명
디렉토리를 검사후 검사 내용을 로그파일로 생성 (로그 파일 이름은 원하는걸로)
# clamscan -r /디렉토리명 -l datacheck.log
클램 안티바이러스에 대한 자세한 사용법은 아래를 참고해주시기 바랍니다.
# clamscan -h
Clam AntiVirus Scanner 0.99.1 By The ClamAV Team: http://www.clamav.net/about.html#credits (C) 2007-2015 Cisco Systems, Inc.
–help -h Print this help screen –version -V Print version number –verbose -v Be verbose –archive-verbose -a Show filenames inside scanned archives –debug Enable libclamav’s debug messages –quiet Only output error messages –stdout Write to stdout instead of stderr –no-summary Disable summary at end of scanning –infected -i Only print infected files –suppress-ok-results -o Skip printing OK files –bell Sound bell on virus detection –tempdir=DIRECTORY Create temporary files in DIRECTORY –leave-temps[=yes/no(*)] Do not remove temporary files –database=FILE/DIR -d FILE/DIR Load virus database from FILE or load all supported db files from DIR –official-db-only[=yes/no(*)] Only load official signatures –log=FILE -l FILE Save scan report to FILE –recursive[=yes/no(*)] -r Scan subdirectories recursively –allmatch[=yes/no(*)] -z Continue scanning within file after finding a match –cross-fs[=yes(*)/no] Scan files and directories on other filesystems –follow-dir-symlinks[=0/1(*)/2] Follow directory symlinks (0 = never, 1 = direct, 2 = always) –follow-file-symlinks[=0/1(*)/2] Follow file symlinks (0 = never, 1 = direct, 2 = always) –file-list=FILE -f FILE Scan files from FILE –remove[=yes/no(*)] Remove infected files. Be careful! –move=DIRECTORY Move infected files into DIRECTORY –copy=DIRECTORY Copy infected files into DIRECTORY –exclude=REGEX Don’t scan file names matching REGEX –exclude-dir=REGEX Don’t scan directories matching REGEX –include=REGEX Only scan file names matching REGEX –include-dir=REGEX Only scan directories matching REGEX –bytecode[=yes(*)/no] Load bytecode from the database –bytecode-unsigned[=yes/no(*)] Load unsigned bytecode –bytecode-timeout=N Set bytecode timeout (in milliseconds) –statistics[=none(*)/bytecode/pcre] Collect and print execution statistics –detect-pua[=yes/no(*)] Detect Possibly Unwanted Applications –exclude-pua=CAT Skip PUA sigs of category CAT –include-pua=CAT Load PUA sigs of category CAT –detect-structured[=yes/no(*)] Detect structured data (SSN, Credit Card) –structured-ssn-format=X SSN format (0=normal,1=stripped,2=both) –structured-ssn-count=N Min SSN count to generate a detect –structured-cc-count=N Min CC count to generate a detect –scan-mail[=yes(*)/no] Scan mail files –phishing-sigs[=yes(*)/no] Signature-based phishing detection –phishing-scan-urls[=yes(*)/no] URL-based phishing detection –heuristic-scan-precedence[=yes/no(*)] Stop scanning as soon as a heuristic match is found –phishing-ssl[=yes/no(*)] Always block SSL mismatches in URLs (phishing module) –phishing-cloak[=yes/no(*)] Always block cloaked URLs (phishing module) –partition-intersection[=yes/no(*)] Detect partition intersections in raw disk images using heuristics. –algorithmic-detection[=yes(*)/no] Algorithmic detection –scan-pe[=yes(*)/no] Scan PE files –scan-elf[=yes(*)/no] Scan ELF files –scan-ole2[=yes(*)/no] Scan OLE2 containers –scan-pdf[=yes(*)/no] Scan PDF files –scan-swf[=yes(*)/no] Scan SWF files –scan-html[=yes(*)/no] Scan HTML files –scan-xmldocs[=yes(*)/no] Scan xml-based document files –scan-hwp3[=yes(*)/no] Scan HWP3 files –scan-archive[=yes(*)/no] Scan archive files (supported by libclamav) –detect-broken[=yes/no(*)] Try to detect broken executable files –block-encrypted[=yes/no(*)] Block encrypted archives –nocerts Disable authenticode certificate chain verification in PE files –dumpcerts Dump authenticode certificate chain in PE files –max-filesize=#n Files larger than this will be skipped and assumed clean –max-scansize=#n The maximum amount of data to scan for each container file (**) –max-files=#n The maximum number of files to scan for each container file (**) –max-recursion=#n Maximum archive recursion level for container file (**) –max-dir-recursion=#n Maximum directory recursion level –max-embeddedpe=#n Maximum size file to check for embedded PE –max-htmlnormalize=#n Maximum size of HTML file to normalize –max-htmlnotags=#n Maximum size of normalized HTML file to scan –max-scriptnormalize=#n Maximum size of script file to normalize –max-ziptypercg=#n Maximum size zip to type reanalyze –max-partitions=#n Maximum number of partitions in disk image to be scanned –max-iconspe=#n Maximum number of icons in PE file to be scanned –max-rechwp3=#n Maximum recursive calls to HWP3 parsing function –pcre-match-limit=#n Maximum calls to the PCRE match function. –pcre-recmatch-limit=#n Maximum recursive calls to the PCRE match function. –pcre-max-filesize=#n Maximum size file to perform PCRE subsig matching. –enable-stats Enable statistical reporting of malware –disable-pe-stats Disable submission of individual PE sections in stats submissions –stats-timeout=#n Number of seconds to wait for waiting a response back from the stats server –stats-host-id=UUID Set the Host ID used when submitting statistical info. –disable-cache Disable caching and cache checks for hash sums of scanned files.
(*) Default scan settings (**) Certain files (e.g. documents, archives, etc.) may in turn contain other files inside. The above options ensure safe processing of this kind of data.
|