LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-12-2008, 02:45 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Clamav Integration to Email Server


I have recently installed amavisd-new on an email server (Debian / Postfix) and now I am to the point of installing and configuring the av filter which I selected clamav. I installed this on my machine and read the documentation however I don't see how I am to have amavisd-new and clamav holding hands. I have to uid/gid for both applications:

Code:
email:/# id amavis
uid=103(amavis) gid=107(amavis) groups=107(amavis)
email:/# id clamav
uid=104(clamav) gid=108(clamav) groups=108(clamav)
Both daemons are running however I don't know how to integrate the newly installed Clamav scanner with Postfix / Amavisd-new.

I tried the clamav mailing list & had not had any luck as of yet. Posting here because I always get great help here!

Thanks so much for any assistance.
 
Old 08-12-2008, 04:12 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
http://www200.pair.com/mecham/spam/c...avisd-new.html
 
Old 08-12-2008, 08:11 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by Mr. C. View Post
Mr. C, again you come to my rescue! Thanks for that link. It was easy to follow however the first step is not matching up.

Quote:
One requirement for a successful installation is 'AllowSupplementaryGroups yes' must be included in clamd.conf.
In my systems clamd.conf, I have what looks to be similar but has "true" and the end and is not commented out. Does this mean I am good?

Code:
AllowSupplementaryGroups true
Quote:
Another requirement is the value after CONTSCAN in amavisd.conf must match the LocalSocket parameter in clamd.conf (change amavisd.conf if it does not)
Since I am using Debian and their version of amavisd-new is split into many files. I checked /etc/amavis/conf.d/50-user and I have nothing in my config which specifies "CONTSCAN" in either Clam or Amavis so I don't know what is required here.
 
Old 08-12-2008, 08:18 PM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
In the clamd.conf man page, we see:

Quote:
BOOL Boolean value (yes/no or true/false or 1/0).
So you can use any of the yes/true/1 values.

Look for the lines that look like:

Code:
# ### http://www.clamav.net/
  ['ClamAV-clamd',
    \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"],
This is the configuration that specifies how to call clamd. The value in bold should match your clamd.conf socket setting. Check all the debian files. In the default amavisd.conf file, there are numerous entries for various scanners.
 
Old 08-12-2008, 08:19 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Here's the relevant section form mine

Quote:
# Initialize supplementary group access (clamd must be started by root).
# Default: disabled
AllowSupplementaryGroups True
clamd.conf
Quote:
# Path to a local socket file the daemon will listen on.
# Default: disabled
#LocalSocket /tmp/clamd
LocalSocket /var/run/clamav/clamd.socket
amavisd.conf (mine's in 1 bit)
Quote:
# ### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.socket"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
# # NOTE: run clamd under the same user as amavisd, or run it under its own
# # uid such as clamav, add user clamav to the amavis group, and then add
# # AllowSupplementaryGroups to clamd.conf;
# # NOTE: match socket name (LocalSocket) in clamav.conf to the socket name in
# # this entry; when running chrooted one may prefer socket "$MYHOME/clamd".
 
Old 08-12-2008, 08:39 PM   #6
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Thank you both!

With that additional info added to the mix, I added these lines to my amavisd.conf (/etc/amavis/conf.d/50-user)

Code:
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.socket"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
Now it appears that I don't need to make any changes to my clamd.conf file.

However my clamd.conf shows LocalSocket = /var/run/clamav/clamd.ctl

Do I need to make that exact path change in my amavis config file? My amavis config file is what you have listed BillyMayDay.
 
Old 08-12-2008, 08:40 PM   #7
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Make them the same. Clamd creates the socket, amavisd connects to it. If clamd already runs correctly, change the amavis.conf version.
 
Old 08-13-2008, 07:38 AM   #8
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
This part of the guide makes no sense to me:

Quote:
The group that your amavisd-new user belongs to must also have write privileges to the amavisd-new user's home directory and subdirectories. This step should have been done during the installation of amavisd-new, and would consist of doing something similar to chmod -R 750 /var/amavis or chmod -R 750 /var/lib/amavis (adjust path as needed)
Now with a fresh amavis installation on my Debian system the permissions are as follows:

Code:
email:/var/lib# ls -l
total 64
drwxr-xr-x 6 amavis  amavis  4096 2008-08-04 18:18 amavis
I don't understand why they use "chmod -R 750" to the amavis directory if the group amavis needs to be able to write to /var/lib/amavis/. 750 gives group R+X only, no?

As it stands now, I have the following config files for Clamav and Amavisd-New.

amavis config.

Code:
$sa_tag_level_deflt  = -5;  # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 4; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 10000; # triggers spam evasive actions
$sa_dsn_cutoff_level = 10;   # spam level beyond which a DSN is not sent

$forward_method = 'smtp:[127.0.0.1]:10025';
$notify_method = $forward_method;

$virus_admin = 'formorer@formorer.de'; # due to D_DISCARD default

#inform recipients about a blocked mail
$warnbannedrecip = 1;
$warnvirusrecip = 1;

$final_banned_destiny     = D_PASS;

$log_level = 2;            # (defaults to 0), -d

$DO_SYSLOG = 1; # log via syslogd (preferred)

# ### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.ctl"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
# # NOTE: run clamd under the same user as amavisd, or run it under its own
# # uid such as clamav, add user clamav to the amavis group, and then add
# # AllowSupplementaryGroups to clamd.conf;
# # NOTE: match socket name (LocalSocket) in clamav.conf to the socket name in
# # this entry; when running chrooted one may prefer socket "$MYHOME/clamd".


Here is my clamd.conf

Code:
#Automatically Generated by clamav-base postinst
#To reconfigure clamd run #dpkg-reconfigure clamav-base
#Please read /usr/share/doc/clamav-base/README.Debian.gz for details
LocalSocket /var/run/clamav/clamd.ctl
FixStaleSocket true
User clamav
AllowSupplementaryGroups true
ScanMail true
ScanArchive true
ArchiveLimitMemoryUsage false
ArchiveBlockEncrypted false
MaxDirectoryRecursion 15
FollowDirectorySymlinks false
FollowFileSymlinks false
ReadTimeout 180
MaxThreads 12
MaxConnectionQueueLength 15
StreamMaxLength 10M
LogSyslog false
LogFacility LOG_LOCAL6
LogClean false
LogVerbose false
PidFile /var/run/clamav/clamd.pid
DatabaseDirectory /var/lib/clamav
TemporaryDirectory /tmp
SelfCheck 3600
Foreground false
Debug false
ScanPE true
ScanOLE2 true
ScanHTML true
DetectBrokenExecutables false
MailFollowURLs false
ExitOnOOM false
LeaveTemporaryFiles false
AlgorithmicDetection true
ScanELF true
IdleTimeout 30
PhishingSignatures true
PhishingScanURLs true
PhishingRestrictedScan true
PhishingAlwaysBlockSSLMismatch false
PhishingAlwaysBlockCloak false
DetectPUA false
LogFile /var/log/clamav/clamav.log
LogTime true
LogFileUnlock false
LogFileMaxSize 0
Anyone see any problems?
 
Old 08-13-2008, 08:42 AM   #9
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
750 is fine. Here's mine:

Code:
$ ls -ld /var/spool/amavis/ /var/spool/amavis/*
drwxr-x---  8 amavis  amavis  512 Aug 13 05:31 /var/spool/amavis/
-rw-r-----  1 amavis  amavis    0 Aug 13 05:31 /var/spool/amavis/amavisd.lock
-rw-r-----  1 amavis  amavis    3 Aug 13 05:31 /var/spool/amavis/amavisd.pid
srwxr-x---  1 amavis  amavis    0 Aug 13 05:31 /var/spool/amavis/amavisd.sock=
drwxr-x---  2 amavis  amavis  512 Aug 13 05:31 /var/spool/amavis/db/
drwxrwx---  7 amavis  amavis  512 Aug 13 05:48 /var/spool/amavis/quarantine/
drwxr-x---  8 amavis  amavis  512 Aug 13 06:39 /var/spool/amavis/tmp/
drwxr-x---  2 amavis  amavis  512 Sep 30  2007 /var/spool/amavis/var/
Grab amavis-logwatch for stats reporting.

Last edited by Mr. C.; 08-13-2008 at 08:46 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Correo combines Mozilla email functionality with tight OS X integration LXer Syndicated Linux News 0 01-28-2008 07:21 PM
spammassissins and clamav integration MSKumaran Linux - Networking 2 11-14-2006 05:38 AM
LXer: Book review: Setup and Run a Small Office Email Server Using Postfix, Courier, Procmail, Squirrelmail, Clamav and Spamassassin LXer Syndicated Linux News 0 08-24-2006 09:21 AM
using clamav on email server juniox Linux - Security 1 03-24-2006 06:45 AM
Run email script from clamav Pete M Programming 0 07-25-2004 04:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration