Configure Clamav AntiVirus tools for various Linux application servers

Source: Internet
Author: User
Article Title: Configure Clamav AntiVirus tools for various Linux application servers. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Few viruses can run and multiply in linux. Moreover, because the client computers currently use Windows, virus makers prefer to write viruses in Windows. However, there are still many reasons for using virus scanning programs, such:

"Scan Windows devices on your computer

"Scan Windows computers on the local network

"Scan the files you are about to send to others

"Scan the email you want to send to others

Clamav is a UNIX open-source (GPL) anti-virus software package. The main purpose of this software is to integrate it into the mail server to detect and eliminate viruses in the email attachments. The software contains a flexible and scalable multi-thread background program, a command line scanning program, and an automatic upgrade program, the software runs based on the shared library files that are simultaneously released by the rus software package using the editor along with Clam. You can also use these shared library files in your software. The most important thing is that the virus database is upgraded quickly and timely. Main features:

Command Line Scanner

Efficient and multi-threaded background running

Support the milter interface of sendmail

Virus repository Upgrade Program supporting digital signatures

Supports C language library for virus scanning

Supports by-Access Scanning (Linux FreeBSD Solaris)

The virus database is upgraded multiple times a day (for the total number of viruses that can be killed, see the home page)

Built-in support RAR (2.0), Zip, Gzip, Bzip2, Tar, MS OLE2, MS Cabinet files, ms chm (compressed HTML), ms szdd compression format

Built-in support for mbox, Maildir, and original mail file formats

Built-in support for UPX, FSG, and Petite compression PE executable files

  1. Basic installation of Clamav

1 first check the Zlib library

Clamav requires more than 1.22 zlib libraries. zlib is a function library that supports gzip file formats. It makes access to gz files as easy as opening and closing files, you can easily add gz file support for your program. Run the # rpm-qa | grep zlib command to view details.

2. Create user and user group commands:

# Groupadd clamav

# Useradd-g clamav-s/bin/false-c "Clam Antivirus" clamav

3. Download and install software

# Wget http://www.hacker-soft.net/tools/Assessment/clamav-0.91.2.tar.gz

# Tar-zxvf clamav-0.91.2.tar.gz

# Cd clamav-0.91.2

#./Configure -- sysconfdir =/etc

# Make

# Su-c "make install"

Complete the installation. The Clamav configuration file is shown in table-1.



4. modify the configuration file

Use the editor to modify/etc/clamd. conf

Add # Before Example #

Use the editor to modify/etc/freshclam. conf

Add # Before Example #

Change Checks from "24" to "4"

In this way, the virus code is updated every 4 hours.

Add several addresses under DatabaseMirror database.clamav.net. For more image addresses, see clamav.pdf

DatabaseMirror clamav. inet6.fr

DatabaseMirror clamav.netopia.pt

DatabaseMirror clamav.sonic.net

5. Set clamav to automatically start when the server starts up

Use the editor to modify/etc/rc. d/rc. local

Add the following two lines:

/Usr/local/bin/freshclam

/Usr/local/bin/clamd

6. Test

Clamdscan-file and directory Anti-Virus

# Clamdscan-v/usr/share/doc/clamav *

# Clamdscan-v/home/

Note: ClamAV only scans files that can be read by ClamAV. If you want to scan all files, add the sudo parameter before the command.

Details about other specific parameters:

-N: do not add the clamav version number when scanning emails.

-N when a user sends an email with a virus, the user does not warn him, but immediately discards the email. But the recipient will receive a prompt.

-Q: Quiet Mode, no message is sent (including not prompting too much in the log, and only one Milter: discard statement is used in case of a virus)

-O filters emails sent from the system.

-L filter emails sent to the System

Here are some clamav examples

"Scan the home directories of all users and use clamscan-r/home

"Scan all files on your computer and display scan results for all files, use clamscan-r/

"Scan all files on your computer and display scan results for problematic files, use clamscan-r-bell-I/

Use clamav to delete virus files

During scanning, you can add the '-- delete' parameter. Figure 1 shows the working interface.



Figure 1 use clamav to delete a Virus File

7. Upgrade the clamav virus Database

Update the virus pattern automatically and periodically. One of the most important tasks of the antivirus program is to update the virus pattern. Otherwise, the antivirus software cannot prevent the latest viruses. According to the general recommendation, it is best to update every four hours to six hours,

Run the following command to start freshclam-l/var/log/clamav/freshclam. log:

Use the daemon method (the following settings are updated six times a day)

Freshclam-d-c 6-l/var/log/clamav. freshclam. log 6

8. Run clamav regularly

The at command can be scheduled to execute a task only once at a specific time. You can use the at command in two ways. The first is to directly type at and the time when you want to run the command (you can select a date ). For example:

$ At 17:20

Echo It's 17: 20!

Job 1 at Tue Apr 11 17:20:00 2006

After the at command is entered, it will wait for you to enter the command to run at the specified time. You can enter any number of commands that will be executed as Shellscript. To terminate the input, use the end-of-file command (usually Control-D ). The command you typed will be executed in the Environment copy that calls the at command. This means that your activity PATH, library, and other environment settings will be recorded and used to execute your generated script. The results are usually sent to you by email when the command is complete. When specifying a time, you can use the standard time format (as shown in the preceding example) or other abbreviations. If a time is specified, the next match of the time is used. For example, if the current time is and the specified time is, the command will be executed in 20 minutes. If nine o'clock A.M. is specified, the command will be executed at on the next day.

You can usually use the following special replacement items:

Midnight -- a.m ./

Noon -- 12: 00 p. m.

Now -- execute now

You can also use today and tomorrow. Some environments (BSD and Linux) may also support the option to increase the time of a specified value by adding a value indicating minute, hour, day, week, month, and year. For example, you can run a job at the current time of one week by using the following command:

$ At now + 1 week

If you want to reschedule a job for a period of time after the last execution, you can use this method. For example, you may run a report that lasts for several hours, but you want to run the report again one week later.

This article uses the latter to run the 'at' command to make clamscan and freshclam run regularly, for example

At 6: 30 tomorrow

At> clamscan-I/home/user> mail goodcjh@example.com

At>

Job 3

[1] [2] [3] [4] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.