-
Notifications
You must be signed in to change notification settings - Fork 6
Virus databae upate
Clamav database regular update is very important for the security prepose of the system. So there is a cron job to update it daily. How it works is described in this page.
freshcalam
Then output will be
root@email:/# freshclam
Wed Jun 19 08:49:45 2019 -> ClamAV update process started at Wed Jun 19 08:49:45 2019
Wed Jun 19 08:49:45 2019 -> ^Your ClamAV installation is OUTDATED!
Wed Jun 19 08:49:45 2019 -> ^Local version: 0.100.3 Recommended version: 0.101.2
Wed Jun 19 08:49:45 2019 -> DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav
Wed Jun 19 08:52:14 2019 -> Downloading main.cvd [100%]
Wed Jun 19 08:56:03 2019 -> main.cvd updated (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Wed Jun 19 08:56:24 2019 -> *Can't query main.58.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 08:57:19 2019 -> Downloading daily.cvd [100%]
Wed Jun 19 09:02:00 2019 -> daily.cvd updated (version: 25484, sigs: 1596295, f-level: 63, builder: raynman)
Wed Jun 19 09:02:20 2019 -> *Can't query daily.25484.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 09:02:21 2019 -> Downloading bytecode.cvd [100%]
Wed Jun 19 09:02:31 2019 -> bytecode.cvd updated (version: 328, sigs: 94, f-level: 63, builder: neo)
Wed Jun 19 09:02:51 2019 -> *Can't query bytecode.328.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 09:03:40 2019 -> Database updated (6162638 signatures) from db.local.clamav.net (IP: 104.16.218.84)
Wed Jun 19 09:03:40 2019 -> ^Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory
root@email:/#
Once the process completed you may check the log file in following location.
cd /var/log/clamav
more freshclam
It will be like this.
root@email:/var/log/clamav# more freshclam.log
Wed Jun 19 08:49:45 2019 -> --------------------------------------
Wed Jun 19 08:49:45 2019 -> ClamAV update process started at Wed Jun 19 08:49:45 2019
Wed Jun 19 08:49:45 2019 -> WARNING: Your ClamAV installation is OUTDATED!
Wed Jun 19 08:49:45 2019 -> WARNING: Local version: 0.100.3 Recommended version: 0.101.2
Wed Jun 19 08:49:45 2019 -> DON'T PANIC! Read https://www.clamav.net/documents/upgrading-clamav
Wed Jun 19 08:52:14 2019 -> Downloading main.cvd [100%]
Wed Jun 19 08:56:03 2019 -> main.cvd updated (version: 58, sigs: 4566249, f-level: 60, builder: sigmgr)
Can't query main.58.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 08:57:19 2019 -> Downloading daily.cvd [100%]
Wed Jun 19 09:02:00 2019 -> daily.cvd updated (version: 25484, sigs: 1596295, f-level: 63, builder: raynman)
Can't query daily.25484.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 09:02:21 2019 -> Downloading bytecode.cvd [100%]
Wed Jun 19 09:02:31 2019 -> bytecode.cvd updated (version: 328, sigs: 94, f-level: 63, builder: neo)
Can't query bytecode.328.93.1.0.6810DA54.ping.clamav.net
Wed Jun 19 09:03:40 2019 -> Database updated (6162638 signatures) from db.local.clamav.net (IP: 104.16.218.84)
Wed Jun 19 09:03:40 2019 -> WARNING: Clamd was NOT notified: Can't connect to clamd through /var/run/clamav/clamd.ctl: No such file or directory
root@email:/var/log/clamav#
Now you need to modify the crontab for the root user.
crontab -e
This opens the root crontab file in the nano text editor. Add the following line
57 08 * * * freshclam
crontab -l | { cat; echo "57 08 * * * freshclam"; } | crontab -
crontab -l | { cat; echo "* * * * * sh /etc/clamav/timer.sh"; } | crontab -
service cron start
First you should have create the copper.log file for nano /var/log/copper.log
#!/bin/bash
HOME=/var/log
OUTPUT="${HOME}/copper.log"
ERROR="${HOME}/copper.err"
date >> /var/log/timer.log
freshclam >> $OUTPUT 2>&1
exit 0
exit command in linux is used to exit the shell where it is currently running. It takes one more parameter as [N] and exits the shell with a return of status N. If n is not provided, then it simply returns the status of last command that is executed. After pressing enter, the terminal window will close and return a status of n. Return status is important because sometimes they can be mapped to tell error, warnings and notifications. For example generally, return status – “0” means the program has executed successfully. “1” means the program has minnor errors.
vim /etc/clamav/freshclam.conf
Checks 24
##Notify clamd to reload it self
NotifyClamd /etc/clamav/clamd.conf
Cron Task : Create Cron task Cron job pattern cron tab practice
Developed by : Lanka Software Foundation