(+84) 236.3827111 ex. 402

Hướng dẫn cài ClamAV trên CentOS 7


ClamAV trang bị tính năng phát hiện malware, ClamAV có khả năng phát hiện được những chương trình malware hoạt động trong môi trường Windows, chúng thường xuyên cố gắng ngụy trang bằng những phần mềm vô hại, những biểu tượng không có thật và giả mạo tiêu đề PE, hỗ trợ thêm khả năng rà soát trong các file 7zip, InstallShield và CPIO, tính năng phân tích hành động đối với những file 64-bit ELF, Mac OS X bằng công nghệ Mach-O.

Bài viết sau đay sẽ hướng dẫn cách cài đặt clamav trên CentOS 7.

- Clamav có sẵn trên EPEL repo, hãy cài đặt EPEL tại https://fedoraproject.org/wiki/EPEL trước sau đó chạy lệnh sau:

# yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

Bước 2: Xóa dòng "Example" từ freshclam.conf và /etc/clamd.d/scan.conf trong locatiof defaul của clamd.conf!

#sed -i -e “s/^Example/#Example/” /etc/freshclam.conf

#sed -i -e “s/^Example/#Example/” /etc/clamd.d/scan.conf

- Chạy freshclam để cập nhật cơ sở dữ liệu

# freshclam

Btw, fresclam được điều hành bởi cron job từ /etc/cron.d/clamav-update

# cat /etc/cron.d/clamav-update
## Adjust this line…
MAILTO=root

## It is ok to execute it as root; freshclam drops privileges and becomes
## user ‘clamupdate’ as soon as possible
0 */3 * * * root /usr/share/clamav/freshclam-sleep

# /usr/share/clamav/freshclam-sleep
CẢNH BáO: cập nhật cơ sở dữ liệu clamav là disabled, hãy xem
‘/etc/sysconfig/freshclam’

# tail /etc/sysconfig/freshclam
## ‘disabled-warn’ … disables the automatic freshclam update and
## gives out a warning
## ‘disabled’ … disables the automatic freshclam silently
# FRESHCLAM_DELAY=

### !!!!! REMOVE ME !!!!!!
### REMOVE ME: By default, the freshclam update is disabled to avoid
### REMOVE ME: network access without prior activation
FRESHCLAM_DELAY=disabled-warn # REMOVE ME

- Chạy clamd thủ công với mục đích thử nghiệm

#/usr/sbin/clamd -c /etc/clamd.d/scan.conf –nofork=yes

Comment ra các dòng sau trong /etc/clamd.d/scan.conf

#LocalSocket /var/run/clamd.scan/clamd.sock

thành
LocalSocket /var/run/clamd.scan/clamd.sock

- Kích hoạt tính năng khởi động

# systemctl enable clamd@scan
ln -s ‘/usr/lib/systemd/system/clamd@scan.service’ ‘/etc/systemd/system/multi-user.target.wants/clamd@scan.service’

- Khởi chạy dịch vụ, kiểm tra tình trạng

# systemctl start clamd@scan
# systemctl status clamd@scan

- Chạy thử scan

# clamdscan -c /etc/clamd.d/scan.conf /etc/hosts
/etc/hosts: OK

———– SCAN SUMMARY ———–
Infected files: 0
Time: 0.002 sec (0 m 0 s)

Chúc các bạn thành công!

Nguyễn Trung Thuận - Khoa CNTT - DTU