Version of qmail mail system anti-virus in Linux

Source: Internet
Author: User
Tags qmail
Article Title: version of qmail mail system anti-virus in Linux. 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.
QMAIL-SCANNER + CLAMAV + MAILDROP for QMAIL
  
Code:
  
1.0 required software:
  
Maildrop-1.5.2.20030423.tar.gz
Perl-Time-HiRes-1.38-3.i386.rpm
Perl-DB_File-1.804-88.4.i386.rpm
Clamav-0.65.tar.gz
Qmail-scanner-1.20.tgz
  
2.0 install maildrop:
  
# Tar zxvf maildrop-1.5.2.20030423.tar.gz
# Cd maildrop-1.5.2.20030423
#./Configure
# Make
# Make install-strip
# Make install-man
  
3.0 install the perl plug-in
  
# Rpm-ivh perl-Time-HiRes-1.38-3.i386.rpm
# Rpm-ivh perl-DB_File-1.804-88.4.i386.rpm
  
Install clamav-0.65.tar.gz in 4.0
  
# Groupadd clamav
# Useradd-g clamav? D/usr/local/share/clamav-s/bin/false clamav
# Tar zxvf clamav-0.65.tar.gz
# Cd clamav-0.65
#./Configure
# Make check
# Make install
  
# Vi/usr/local/etc/clamav. conf
================================ Clamav. conf ================================
# Comment or remove the line below.
# Example
LogFile/var/log/clamd. log
LogFileMaxSize 1 M
LogTime
LogVerbose
PidFile/var/run/clamd. pid
DataDirectory/usr/local/share/clamav
LocalSocket/tmp/clamd
StreamMaxLength 10 M
MaxThreads 10
MaxDirectoryRecursion 15
User clamav
ScanMail
ScanArchive
ScanRAR
ArchiveMaxFileSize 10 M
ArchiveMaxRecursion 5
ArchiveMaxFiles 1000
ClamukoScanOnOpen
ClamukoScanOnClose
ClamukoScanOnExec
ClamukoIncludePath/home/vpopmail
ClamukoMaxFileSize 6 M
ClamukoScanArchive
================================ Clamav. conf ================================
# Touch/var/log/clamd. log
# Chown clamav: clamav/var/log/clamd. log
  
4.1 create a STARTUP script for clamav:
  
# Vi/etc/init. d/clamd
====================================== Clamd ====== ======================================
#! /Bin/bash
#
# Crond Start/Stop the clam antivirus daemon.
#
# Chkconfig: 2345 90 60
# Description: clamdis a standard UNIX program that scans for Viruses.
# Processname: clamd
# Config:/usr/local/etc/clamav. conf
# Pidfile:/var/run/clamd. pid
  
# Source function library.
./Etc/init. d/functions
RETVAL = 0
# See how we were called.
Prog = "clamd"
Progdir = "/usr/local/sbin"
# Source configuration
If [-f/etc/sysconfig/$ prog]; then
./Etc/sysconfig/$ prog
Fi
  
Start (){
Echo-n $ "Starting $ prog :"
Daemon $ progdir/$ prog
RETVAL =$?
Echo
[$ RETVAL-eq 0] & touch/var/run/clamd. pid
Return $ RETVAL
}
  
Stop (){
Echo-n $ "Stopping $ prog :"
Killproc $ prog
RETVAL =$?
Echo
[$ RETVAL-eq 0] & rm-f/var/run/clamd. pid/tmp/clamd
Return $ RETVAL
}
  
Rhstatus (){
Status clamd
}
  
Restart (){
Stop
Start
}
  
Reload (){
Echo-n $ "Reloading clam daemon configuration :"
Killproc clamd-HUP
Retval =$?
Echo
Return $ RETVAL
}
  
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Restart
;;
Reload)
Reload
;;
Status)
Rhstatus
;;
Condrestart)
[-F/var/lock/subsys/clamd] & restart |:
;;
*)
Echo $ "Usage: $0 {start | stop | status | reload | restart | condrestart }"
Exit 1
Esac
Exit 0
====================================== Clamd ====== ======================================
  
# Chmod 755/etc/init. d/clamd
# Chkconfig? Add clamd
# Chkconfig clamd on
  
4.2 update the virus Database
  
#/Usr/local/bin/freshclam
  
4.3 regularly update the virus Database
  
# Crontab? E
00 9 ***/usr/local/bin/freshclam -- quiet
  
5.0 install qmail-scanner-1.20.tgz
  
# Groupadd qscand
# Useradd-g qscand-s/bin/false qscand
# Tar zxvf qmail-scanner-1.20.tgz
# Cd qmail-scanner-1.20
#./Configure
-- Qmail-queue-binary/var/qmail/bin/qmail-queue
-- Admin postmaster
-- Domain nero.3322.org
-- Policy sender, admin
-- Local-domains nero.3322.org
-- Lang en_GB
-- Debug yes
-- Unzip yes
-- Scanners clamscan
-- Install
  
# Chown qscand: qscand/var/qmail/bin/qmail-scanner-queue.pl
# Chmod 4755/var/qmail/bin/qmail-scanner-queue.pl
  
Then run/var/qmail/bin/qmail-scanner-queue.pl-z with a common user
If there is a Can't do setuid, return to the installation file directory with A contrib directory,
  
# Cd contrib
# Make
# Make install
  
Add the following steps:
  
# Chown qscand: qscand/var/qmail/bin/qmail-queue
# Chmod 4755/var/qmail/bin/qmail-queue
# Chmod 0755/var/qmail/bin/qmail-scanner-queue.pl
  
Then, log in with a common user and execute
  
#/Var/qmail/bin/qmail-queue-z
#/Var/qmail/bin/qmail-queue-g
  
5.1 modify Environment Variables
  
Add in your qmail Startup Script
  
QMAILQUEUE =/var/qmail/bin/qmail-scanner-queue.pl
Export QMAILQUEUE
  
Use the following
  
QMAILQUEUE =/var/qmail/bin/qmail-queue
Export QMAILQUEUE
  
Modifying
  
My $ clamscan_options = "-r -- disable-summary -- max-recursion = 10 -- max-space = 1000000 ";
Is:
My $ clamscan_options = "-r -- mbox -- disable-summary -- max-recursion = 10 -- max-space = 1000000 ";
  
5.2 restart qmail Test
  
There are test programs
  
#/Qmail-scanner-1.20/contrib/test_installation.sh-doit
  
5.3 main error monitoring logs:
  
/Var/log/maillog
/Var/log/clamd. log
/Var/spool/qmailscan/quarantine. log
/Var/spool/qmailscan/qmail-queue.log
Related Article

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.