Telegram- 👇 😉
-
. WIKIMERIONET
Merion Mertics , ,

CRM

7

ClamAV . , Linux , Cisco, open-source. , , , , . , , . .

   ClamAV Linux

ClamAV

ClamAV CentOS / RHEL 7, EPEL:

# yum install epel-release

ClamAV :

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

ClamAV

ClamAV , :

# sed -i '/^Example/d' /etc/clamd.d/scan.conf

, TCP root :

# vim /etc/clamd.d/scan.conf

, LocalSocket, , . :

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

:

User root
LocalSocket /var/run/clamd.<SERVICE>/clamd.sock

ClamAV , Freshclam. :

# cp /etc/freshclam.conf /etc/freshclam.conf.bak

Freshclam /etc/freshclam.conf. , , , freshclam. , , . .

# sed -i '/^Example/d' /etc/freshclam.conf

Freshclam, , :

# freshclam
ClamAV update process started at Tue Nov 6 15:51:59 2018
WARNING: Can't query current.cvd.clamav.net
WARNING: Invalid DNS reply. Falling back to HTTP mode.
Reading CVD header (main.cvd): OK (IMS)
main.cvd is up to date (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Reading CVD header (daily.cvd): OK
Downloading daily-25006.cdiff [100%]
Downloading daily-25092.cdiff [100%]
Downloading daily-25093.cdiff [100%]
Downloading daily-25094.cdiff [100%]
Downloading daily-25095.cdiff [100%]
daily.cld updated (version: 25095, sigs: 2143057, f-level: 63, builder: neo)
Reading CVD header (bytecode.cvd): OK
bytecode.cvd is up to date (version: 327, sigs: 91, f-level: 63, builder: neo)
Database updated (6709397 signatures) from database.clamav.net (IP: 104.16.186.138)

- , . , , . - freshclam . , main.cvd, daily.cvd bytecode.cvd , , , .

freshclam , , , . -d freshclam ( ).

, freshclam systemd:

# vim /usr/lib/systemd/system/clam-freshclam.service

:

[Unit]
Description = freshclam scanner
After = network.target
[Service]
Type = forking
ExecStart = /usr/bin/freshclam -d -c 4
Restart = on-failure
PrivateTmp = true
RestartSec = 20sec
[Install]
WantedBy=multi-user.target

[Unit] , . [Service] , ExecStart freshclam -d, Type systemd, , systemd . [Install] , , systemctl enable.

systemd, :

# systemctl daemon-reload

freshclam:

# systemctl start clam-freshclam.service
# systemctl status clam-freshclam.service
clam-freshclam.service - freshclam scanner
oaded: loaded (/usr/lib/systemd/system/clam-freshclam.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2018-11-06 15:56:53 IST; 3s ago
Process: 7926 ExecStart=/usr/bin/freshclam -d -c 4 (code=exited, status=0/SUCCESS)
Main PID: 7927 (freshclam)
CGroup: /system.slice/clam-freshclam.service
L-7927 /usr/bin/freshclam -d -c 4
Nov 06 15:56:53 node2.example.com systemd[1]: Starting freshclam scanner...
Nov 06 15:56:53 node2.example.com systemd[1]: Started freshclam scanner.
Nov 06 15:56:53 node2.example.com freshclam[7927]: freshclam daemon 0.100.2 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Nov 06 15:56:53 node2.example.com freshclam[7927]: ClamAV update process started at Tue Nov 6 15:56:53 2018

, :

# systemctl enable clam-freshclam.service
Created symlink from /etc/systemd/system/multi-user.target.wants/clam-freshclam.service to /usr/lib/systemd/system/clam-freshclam.service.

ClamAV ClamAV. , . - . :

# mv /usr/lib/systemd/system/clamd@.service /usr/lib/systemd/system/clamd.service

, , :

# vim /usr/lib/systemd/system/clamd@scan.service

, @, :

.include /lib/systemd/system/clamd.service

Clamd:

# vim /usr/lib/systemd/system/clamd.service

:

[Install]
WantedBy=multi-user.target

% i Description ExecStart. , :

Description = clamd scanner daemon
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/scan.conf
TimeoutSec=5min
Restart = on-failure
RestartSec=10sec

clamv

# systemctl start clamd.service
# systemctl status clamd.service
clamd.service - clamd scanner daemon
Loaded: loaded (/usr/lib/systemd/system/clamd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2018-11-06 19:48:17 IST; 16s ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Process: 1460 ExecStart=/usr/sbin/clamd -c /etc/clamd.d/scan.conf (code=exited, status=0/SUCCESS)
Main PID: 1461 (clamd)
CGroup: /system.slice/clamd.service
L-1461 /usr/sbin/clamd -c /etc/clamd.d/scan.conf
Nov 06 19:48:15 node2.example.com clamd[1461]: ELF support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: Mail files support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: OLE2 support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: PDF support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: SWF support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: HTML support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: XMLDOCS support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: HWP3 support enabled.
Nov 06 19:48:15 node2.example.com clamd[1461]: Self checking every 600 seconds.
Nov 06 19:48:17 node2.example.com systemd[1]: Started clamd scanner daemon.

, clamd.

# systemctl enable clamd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/clamd.service to /usr/lib/systemd/system/clamd.service.

:

# clamscan --infected --remove --recursive ./
----------- SCAN SUMMARY -----------
Known viruses: 6702413
Engine version: 0.100.2
Scanned directories: 7
Scanned files: 9
Infected files: 0
Data scanned: 0.01 MB
Data read: 0.00 MB (ratio 2.00:1)
Time: 25.439 sec (0 m 25 s)

ClamAV RHEL / CentOS 7 Linux .