Inhaltsverzeichnis
Postfix ClamAV
ClamAV ist ein Antivirus Toolkit für Unix das unter der GPL Lizenz steht. Es wurde speziell für das scannen von EMails auf Mailgateways designt.
Das Paket stellt eine Reihe von Hilfsmittel zur Verfügung: einen flexiblen und skalierbaren Multi-Threaded Daemon, einen Kommandozeilen Scanner und ein komplexes Programm zur automatischen Aktualisierung über das Internet bereit. Das Herzstück des Paketes ist ein Antivirus-Einheit in Form einer gemeinsam genutzten Bibliothek.
Postfix ClamAV herunterladen
ClamAV kann unter folgendem Link heruntergeladen werden, dabei sollte ein RPM-Paket bevorzugt werden, deshalb soll hier auch ein Repository als Quelle eines RPM-Paktes gewählt werden und nicht die Quell-Sourcen zum selbst kompilieren!
WICHTIG - Da zur Installation von ClamAV sehr viele Abhängigkeiten zu erfüllen sind, wäre es ratsam das RPMforge-Repository in den
yum
-Paketmanager einzubinden!
WICHTIG - Ein detaillierte Anleitung, wie das RPMforge-Repository in CentOS eingebunden werden kann, kann unter Repository einbinden CentOS 5 nachgelesen werden!
Postfix ClamAV installieren
Um ClamAV zu installieren, können dank der Einbindung des RPMforge-Repository alle Abhängigkeiten aufgelöst werden und ClamAV installiert werden.
Die zur Installation benötigten Befehle lauten:
# yum install clamd clamav clamav-db clamtk Loading "priorities" plugin Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * adobe-linux-i386: linuxdownload.adobe.com * rpmforge: ftp-stud.fht-esslingen.de * tachtler: * base: mirror.silyus.net * updates: mirror.silyus.net * addons: mirror.silyus.net * extras: mirror.silyus.net 339 packages excluded due to repository priority protections Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package clamd.i386 0:0.94.2-1.el5.rf set to be updated ---> Package clamav.i386 0:0.94.2-1.el5.rf set to be updated ---> Package clamav-db.i386 0:0.94.2-1.el5.rf set to be updated ---> Package clamtk.i386 0:3.09-1.el5.rf set to be updated --> Processing Dependency: perl(File::Find::Rule) for package: clamtk --> Processing Dependency: perl(Glib) for package: clamtk --> Processing Dependency: perl(Gtk2::SimpleList) for package: clamtk --> Processing Dependency: perl-Gtk2 for package: clamtk --> Processing Dependency: perl(Locale::gettext) for package: clamtk --> Processing Dependency: perl(Gtk2) for package: clamtk --> Processing Dependency: perl-File-Find-Rule for package: clamtk --> Processing Dependency: perl(Config::Tiny) for package: clamtk --> Running transaction check ---> Package perl-File-Find-Rule.noarch 0:0.30-1.el5.rf set to be updated --> Processing Dependency: perl(Number::Compare) for package: perl-File-Find-Rule --> Processing Dependency: perl(Text::Glob) for package: perl-File-Find-Rule ---> Package perl-Config-Tiny.noarch 0:2.12-1.el5.rf set to be updated ---> Package perl-Glib.i386 0:1.200-1.el5.rf set to be updated ---> Package perl-Gtk2.i386 0:1.183-1.el5.rf set to be updated ---> Package perl-gettext.i386 0:1.05-1.el5.rf set to be updated --> Running transaction check ---> Package perl-Number-Compare.noarch 0:0.01-1.2.el5.rf set to be updated ---> Package perl-Text-Glob.noarch 0:0.08-1.el5.rf set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: clamd i386 0.94.2-1.el5.rf rpmforge 95 k clamtk i386 3.09-1.el5.rf rpmforge 49 k Installing for dependencies: clamav i386 0.94.2-1.el5.rf rpmforge 2.5 M clamav-db i386 0.94.2-1.el5.rf rpmforge 18 M perl-Config-Tiny noarch 2.12-1.el5.rf rpmforge 21 k perl-File-Find-Rule noarch 0.30-1.el5.rf rpmforge 30 k perl-Glib i386 1.200-1.el5.rf rpmforge 635 k perl-Gtk2 i386 1.183-1.el5.rf rpmforge 3.8 M perl-Number-Compare noarch 0.01-1.2.el5.rf rpmforge 7.1 k perl-Text-Glob noarch 0.08-1.el5.rf rpmforge 8.7 k perl-gettext i386 1.05-1.el5.rf rpmforge 39 k Transaction Summary ============================================================================= Install 11 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 26 M Is this ok [y/N]: y Downloading Packages: (1/11): perl-gettext-1.05 100% |=========================| 39 kB 00:00 (2/11): clamav-db-0.94.2- 100% |=========================| 18 MB 00:12 (3/11): perl-Text-Glob-0. 100% |=========================| 8.7 kB 00:00 (4/11): perl-Gtk2-1.183-1 100% |=========================| 3.8 MB 00:02 (5/11): perl-Glib-1.200-1 100% |=========================| 635 kB 00:00 (6/11): perl-Config-Tiny- 100% |=========================| 21 kB 00:00 (7/11): clamav-0.94.2-1.e 100% |=========================| 2.5 MB 00:01 (8/11): perl-Number-Compa 100% |=========================| 7.1 kB 00:00 (9/11): perl-File-Find-Ru 100% |=========================| 30 kB 00:00 (10/11): clamtk-3.09-1.el 100% |=========================| 49 kB 00:00 (11/11): clamd-0.94.2-1.e 100% |=========================| 95 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: clamav-db ####################### [ 1/11] Installing: clamav ####################### [ 2/11] Installing: perl-Glib ####################### [ 3/11] Installing: perl-Gtk2 ####################### [ 4/11] Installing: perl-gettext ####################### [ 5/11] Installing: perl-Text-Glob ####################### [ 6/11] Installing: perl-Config-Tiny ####################### [ 7/11] Installing: perl-Number-Compare ####################### [ 8/11] Installing: perl-File-Find-Rule ####################### [ 9/11] Installing: clamd ####################### [10/11] Installing: clamtk ####################### [11/11] Installed: clamd.i386 0:0.94.2-1.el5.rf clamtk.i386 0:3.09-1.el5.rf Dependency Installed: clamav.i386 0:0.94.2-1.el5.rf clamav-db.i386 0:0.94.2-1.el5.rf perl-Config-Tiny.noarch 0:2.12-1.el5.rf perl-File-Find-Rule.noarch 0:0.30-1.el5.rf perl-Glib.i386 0:1.200-1.el5.rf perl-Gtk2.i386 0:1.183-1.el5.rf perl-Number-Compare.noarch 0:0.01-1.2.el5.rf perl-Text-Glob.noarch 0:0.08-1.el5.rf perl-gettext.i386 0:1.05-1.el5.rf Complete!
Nach erfolgreicher Installation, können die Inhalte der soeben installierten RPM-Pakete mit folgenden Befehlen überprüft werden (clamd.i386):
# rpm -qil clamd | more Name : clamd Relocations: (not relocatable) Version : 0.94.2 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release : 1.el5.rf Build Date: Thu 27 Nov 2008 12:46:22 PM CET Install Date: Fri 02 Jan 2009 08:10:27 PM CET Build Host: lisse.hasselt.wieers.com Group : System Environment/Daemons Source RPM: clamav-0.94.2-1.el5.rf.src.rpm Size : 201458 License: GPL Signature : DSA/SHA1, Thu 27 Nov 2008 02:58:48 PM CET, Key ID a20e52146b8d79e6 Packager : Dag Wieers <dag@wieers.com> URL : http://www.clamav.net/ Summary : The Clam AntiVirus Daemon Description : The Clam AntiVirus Daemon /etc/clamd.conf /etc/logrotate.d/clamav /etc/rc.d/init.d/clamd /usr/bin/clamconf /usr/bin/clamdscan /usr/sbin/clamd /usr/share/doc/clamd-0.94.2 /usr/share/doc/clamd-0.94.2/clamd.conf /usr/share/doc/clamd-0.94.2/clamdwatch /usr/share/doc/clamd-0.94.2/clamdwatch/clamdwatch.tar.gz /usr/share/man/man1/clamconf.1.gz /usr/share/man/man1/clamdscan.1.gz /usr/share/man/man5/clamd.conf.5.gz /usr/share/man/man8/clamd.8.gz /var/clamav /var/log/clamav /var/run/clamav
Nach erfolgreicher Installation, können die Inhalte der soeben installierten RPM-Pakete mit folgenden Befehlen überprüft werden (clamav.i386):
]# rpm -qil clamav | more Name : clamav Relocations: (not relocatable) Version : 0.94.2 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release : 1.el5.rf Build Date: Thu 27 Nov 2008 12:46:22 PM CET Install Date: Fri 02 Jan 2009 08:10:16 PM CET Build Host: lisse.hasselt.wieers.com Group : Applications/System Source RPM: clamav-0.94.2-1.el5.rf.src.rpm Size : 4577241 License: GPL Signature : DSA/SHA1, Thu 27 Nov 2008 02:58:45 PM CET, Key ID a20e52146b8d79e6 Packager : Dag Wieers <dag@wieers.com> URL : http://www.clamav.net/ Summary : Anti-virus software Description : Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main purpose of this software is the integration with mail servers (attachment scanning). The package provides a flexible and scalable multi-threaded daemon, a command line scanner, and a tool for automatic updating via Internet. The programs are based on a shared library distributed with the Clam AntiVirus package, which you can use with your own software. Most importantly, the virus database is kept up to date /etc/freshclam.conf /usr/bin/clamscan /usr/bin/freshclam /usr/bin/sigtool /usr/lib/libclamav.so.5 /usr/lib/libclamav.so.5.0.4 /usr/lib/libclamunrar.so.5 /usr/lib/libclamunrar.so.5.0.4 /usr/lib/libclamunrar_iface.so.5 /usr/lib/libclamunrar_iface.so.5.0.4 /usr/share/doc/clamav-0.94.2 /usr/share/doc/clamav-0.94.2/AUTHORS /usr/share/doc/clamav-0.94.2/BUGS /usr/share/doc/clamav-0.94.2/COPYING /usr/share/doc/clamav-0.94.2/ChangeLog /usr/share/doc/clamav-0.94.2/FAQ /usr/share/doc/clamav-0.94.2/INSTALL /usr/share/doc/clamav-0.94.2/NEWS /usr/share/doc/clamav-0.94.2/README /usr/share/doc/clamav-0.94.2/clamav-mirror-howto.pdf /usr/share/doc/clamav-0.94.2/clamdoc.pdf /usr/share/doc/clamav-0.94.2/freshclam.conf /usr/share/doc/clamav-0.94.2/phishsigs_howto.pdf /usr/share/doc/clamav-0.94.2/signatures.pdf /usr/share/doc/clamav-0.94.2/test /usr/share/doc/clamav-0.94.2/test/.split /usr/share/doc/clamav-0.94.2/test/.split/split.clam-aspack.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-aspack.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-fsg.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-fsg.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-mew.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-mew.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-nsis.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-nsis.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-pespin.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-pespin.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-petite.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-petite.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-upack.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-upack.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-upx.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-upx.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-v2.raraa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-v2.rarab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-v3.raraa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-v3.rarab /usr/share/doc/clamav-0.94.2/test/.split/split.clam-wwpack.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam-wwpack.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.arjaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.arjab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.bz2.zipaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.bz2.zipab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.cabaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.cabab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.chmaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.chmab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.d64.zipaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.d64.zipab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ea05.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ea05.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ea06.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ea06.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.binhexaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.binhexab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.bz2aa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.bz2ab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.htmlaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.htmlab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.mbox.base64aa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.mbox.base64ab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.mbox.uuaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.mbox.uuab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.rtfaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.rtfab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.szddaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exe.szddab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exeaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.exeab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.impl.zipaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.impl.zipab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.mailaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.mailab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ole.docaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.ole.docab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.pdfaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.pdfab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.pptaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.pptab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.sisaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.sisab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.tar.gzaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.tar.gzab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.tnefaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.tnefab /usr/share/doc/clamav-0.94.2/test/.split/split.clam.zipaa /usr/share/doc/clamav-0.94.2/test/.split/split.clam.zipab /usr/share/doc/clamav-0.94.2/test/Makefile /usr/share/doc/clamav-0.94.2/test/Makefile.am /usr/share/doc/clamav-0.94.2/test/Makefile.in /usr/share/doc/clamav-0.94.2/test/README /usr/share/doc/clamav-0.94.2/test/clam-aspack.exe /usr/share/doc/clamav-0.94.2/test/clam-fsg.exe /usr/share/doc/clamav-0.94.2/test/clam-mew.exe /usr/share/doc/clamav-0.94.2/test/clam-nsis.exe /usr/share/doc/clamav-0.94.2/test/clam-pespin.exe /usr/share/doc/clamav-0.94.2/test/clam-petite.exe /usr/share/doc/clamav-0.94.2/test/clam-upack.exe /usr/share/doc/clamav-0.94.2/test/clam-upx.exe /usr/share/doc/clamav-0.94.2/test/clam-v2.rar /usr/share/doc/clamav-0.94.2/test/clam-v3.rar /usr/share/doc/clamav-0.94.2/test/clam-wwpack.exe /usr/share/doc/clamav-0.94.2/test/clam.arj /usr/share/doc/clamav-0.94.2/test/clam.bz2.zip /usr/share/doc/clamav-0.94.2/test/clam.cab /usr/share/doc/clamav-0.94.2/test/clam.chm /usr/share/doc/clamav-0.94.2/test/clam.d64.zip /usr/share/doc/clamav-0.94.2/test/clam.ea05.exe /usr/share/doc/clamav-0.94.2/test/clam.ea06.exe /usr/share/doc/clamav-0.94.2/test/clam.exe /usr/share/doc/clamav-0.94.2/test/clam.exe.binhex /usr/share/doc/clamav-0.94.2/test/clam.exe.bz2 /usr/share/doc/clamav-0.94.2/test/clam.exe.html /usr/share/doc/clamav-0.94.2/test/clam.exe.mbox.base64 /usr/share/doc/clamav-0.94.2/test/clam.exe.mbox.uu /usr/share/doc/clamav-0.94.2/test/clam.exe.rtf /usr/share/doc/clamav-0.94.2/test/clam.exe.szdd /usr/share/doc/clamav-0.94.2/test/clam.impl.zip /usr/share/doc/clamav-0.94.2/test/clam.mail /usr/share/doc/clamav-0.94.2/test/clam.ole.doc /usr/share/doc/clamav-0.94.2/test/clam.pdf /usr/share/doc/clamav-0.94.2/test/clam.ppt /usr/share/doc/clamav-0.94.2/test/clam.sis /usr/share/doc/clamav-0.94.2/test/clam.tar.gz /usr/share/doc/clamav-0.94.2/test/clam.tnef /usr/share/doc/clamav-0.94.2/test/clam.zip /usr/share/man/man1/clamscan.1.gz /usr/share/man/man1/freshclam.1.gz /usr/share/man/man1/sigtool.1.gz /usr/share/man/man5/freshclam.conf.5.gz
Nach erfolgreicher Installation, können die Inhalte der soeben installierten RPM-Pakete mit folgenden Befehlen überprüft werden (clamav-db.i386):
# rpm -qil clamav-db | more Name : clamav-db Relocations: (not relocatable) Version : 0.94.2 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release : 1.el5.rf Build Date: Thu 27 Nov 2008 12:46:22 PM CET Install Date: Fri 02 Jan 2009 08:10:14 PM CET Build Host: lisse.hasselt.wieers.com Group : Applications/Databases Source RPM: clamav-0.94.2-1.el5.rf.src.rpm Size : 19242218 License: GPL Signature : DSA/SHA1, Thu 27 Nov 2008 02:58:46 PM CET, Key ID a20e52146b8d79e6 Packager : Dag Wieers <dag@wieers.com> URL : http://www.clamav.net/ Summary : Virus database for clamav Description : The actual virus database for clamav /etc/cron.daily/freshclam /etc/logrotate.d/freshclam /var/clamav /var/clamav/daily.cvd /var/clamav/main.cvd /var/log/clamav
Nach erfolgreicher Installation, können die Inhalte der soeben installierten RPM-Pakete mit folgenden Befehlen überprüft werden (clamtk.i386):
# rpm -qil clamtk | more Name : clamtk Relocations: (not relocatable) Version : 3.09 Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Release : 1.el5.rf Build Date: Tue 27 May 2008 01:08:35 AM CEST Install Date: Fri 02 Jan 2009 08:10:28 PM CET Build Host: lisse.leuven.wieers.com Group : Applications/File Source RPM: clamtk-3.09-1.el5.rf.src.rpm Size : 110094 License: Perl Signature : DSA/SHA1, Tue 27 May 2008 02:00:39 AM CEST, Key ID a20e52146b8d79e6 Packager : Dag Wieers <dag@wieers.com> URL : http://clamtk.sourceforge.net/ Summary : Easy to use front-end for ClamAV Description : ClamTk is a front-end, point and click gui for ClamAV on Linux systems. It supports easy signature-updates. /usr/bin/clamtk /usr/share/applications/rpmforge-clamtk.desktop /usr/share/doc/clamtk-3.09 /usr/share/doc/clamtk-3.09/CHANGES /usr/share/doc/clamtk-3.09/DISCLAIMER /usr/share/doc/clamtk-3.09/LICENSE /usr/share/doc/clamtk-3.09/README /usr/share/man/man1/clamtk.1.gz /usr/share/pixmaps/clamtk.png /usr/share/pixmaps/clamtk.xpm
Folgender Benutzer wurde ebenfalls angelegt, was mit folgende Befehl überprüft werden kann:
# cat /etc/passwd | grep clam clamav:x:103:105:Clam Anti Virus Checker:/var/clamav:/sbin/nologin
Desweiteren wurden auch folgende Gruppen angelegt, was mit folgendem Befehl überprüft werden kann:
# cat /etc/group | grep clam clamav:x:105:
Um das Starten von ClamAV auch nach einem System-(re)-start auch in Zukunft dauerhaft zu realisieren, kann folgender Befehl genutzt werden. Hier wird ClamAV zu den Start-Scripten der einzelnen Runlevel des Betriebssystem hinzugefügt:
# chkconfig clamd on
Ein Überprüfung, ob ClamAV in den einzelnen Runlevel des Betriebssystems bei einem System-(re)-start mit gestartet wird, kann mit folgendem Befehl abgefragt werden:
# chkconfig --list | grep clamd clamd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Postfix ClamAV konfigurieren
Da ClamAV sich aus mehreren Komponenten zusammensetzt, sind mehrere Konfigurationsschritte notwendig.
/etc/clamd.conf
Da Die Konfigurationsdatei /etc/clamd.conf
mit vielen Kommentar- und Leerzeilen versehen ist, kann mit folgendem Befehl eine Übersicht, ohne Kommentar- und Leerzeilen zur Ansicht gebracht werden Es müssen keine Veränderungen der Konfigurationsdatei vorgenommen werden !:
# egrep -v '(^.*#|^$)' /etc/clamd.conf LogFile /var/log/clamav/clamd.log LogFileMaxSize 0 LogTime yes LogSyslog yes PidFile /var/run/clamav/clamd.pid TemporaryDirectory /var/tmp DatabaseDirectory /var/clamav LocalSocket /var/run/clamav/clamd.sock FixStaleSocket yes TCPSocket 3310 TCPAddr 127.0.0.1 MaxConnectionQueueLength 30 MaxThreads 50 ReadTimeout 300 User clamav AllowSupplementaryGroups yes ScanPE yes ScanELF yes DetectBrokenExecutables yes ScanOLE2 yes ScanMail yes ScanArchive yes ArchiveBlockEncrypted no
Änderungen an /etc/clamd.conf
Änderung des Socket-Speicherorts (passend zum Eintrag in der AMaViS (A MAil Virus Scanner)-Konfigurationsdatei /etc/amavisd.conf
):
- LocalSocket
/var/run/clamav/clamd.sock
Änderungen an /etc/group
WICHTIG - Aufgrund eines Hinweises mit folgender Aussage in der AMaViS (A MAil Virus Scanner)-Konfigurationsdatei
/etc/amavisd.conf
(nur relevanter Auszug):
... # ### http://www.clamav.net/ # ['ClamAV-clamd', # \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"], # 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". ...
ist es erforderlich den neu eingerichteten Benutzer
clamav
in die Gruppe
amavis
durch Editieren der CentOS-Konfigurationsdatei
/etc/groups
aufzunehmen.
Die CentOS-Konfigurationsdatei - /etc/groups
kann mit nachfolgendem Befehl angezeigt werden und sieht vor jeglicher Änderung wie folgt aus:
# cat /etc/group | grep amavis amavis:x:104:
Durch folgenden Befehl, wird der Benutzer clamav
zur Gruppe amavis
hinzugefügt:
# usermod -a -G amavis clamav
Eine anschließende Überprüfung der CentOS-Konfigurationsdatei - /etc/groups
mit folgendem Befehl, sollte die nachfolgende Ausgabe erzeugen:
# cat /etc/group | grep amavis amavis:x:104:clamav
/etc/amavisd.conf
Die Grundkonfiguration von AMaViS erfolgt in der Konfigurationsdatei
/etc/amavisd.conf
Die relevanten Änderungen gegenüber der Standard-Konfiguration zur Einbindung von ClamAV in AMaViS sind mit folgendem Kommentar
# Tachtler
versehen.
Hier die relevanten Änderungen der Konfigurationsdatei, welche unter /etc
zu finden ist und den Namen amavisd.conf
trägt (nur relevante Auszüge für ClamAV):
... @av_scanners = ( # ### http://www.clanfield.info/sophie/ (http://www.vanja.com/tools/sophie/) # ['Sophie', # \&ask_daemon, ["{}/\n", '/var/run/sophie'], # qr/(?x)^ 0+ ( : | [\000\r\n]* $)/, qr/(?x)^ 1 ( : | [\000\r\n]* $)/, # qr/(?x)^ [-+]? \d+ : (.*?) [\000\r\n]* $/ ], # ### http://www.csupomona.edu/~henson/www/projects/SAVI-Perl/ # ['Sophos SAVI', \&sophos_savi ], # Tachtler # default: # ### http://www.clamav.net/ # default: # ['ClamAV-clamd', # default: # \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"], # default: # qr/\bOK$/, qr/\bFOUND$/, # default: # qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ], ### http://www.clamav.net/ ['ClamAV-clamd', \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd"], 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". ...
Postfix ClamAV starten
Falls ein Update auf CentOS 5.3 gemacht wurde und hier eine Version
0.95.0
von ClamAV installiert wird, ist es erforderlich einen zusätzlichen Link im Verzeichnis /usr/lib/
für ClamAV zu setzen, da sonst folgende Fehlermeldung beim starten von ClamAV erscheint:
LibClamAV Warning: Cannot dlopen: file not found - unrar support unavailable
Es muss eine Link mit der Bezeichnung /usr/lib/libclamunrar_iface.so
auf z.B. den bereits vorhandenen Link /usr/lib/libclamunrar_iface.so.6
gesetzt werden (wie in nachstehendem nur relevantem Auszug gezeigt), oder auf die Datei /usr/lib/libclamunrar_iface.so.6.0.2
:
# ll -la /usr/lib/libclam* ... lrwxrwxrwx 1 root root 32 Apr 2 00:23 /usr/lib/libclamunrar_iface.so -> /usr/lib/libclamunrar_iface.so.6 ...
Mit folgendem Befehl kann dieser Link gesetzt werden:
# ln -s /usr/lib/libclamunrar_iface.so.6 /usr/lib/libclamunrar_iface.so
Jetzt ist der richtige Zeitpunkt gekommen, um ClamAV zu starten, was mit folgendem Befehl erfolgen kann:
# service clamd start Starting Clam AntiVirus Daemon: [ OK ]
Folgende Ausgabe kann nach dem Start von ClamAV in der LOG-Datei /var/log/clamav/clamd.log
in etwa beobachtet werden:
Fri Jan 2 21:58:06 2009 -> +++ Started at Fri Jan 2 21:58:06 2009 Fri Jan 2 21:58:06 2009 -> clamd daemon 0.94.2 (OS: linux-gnu, ARCH: i386, CPU: i386) Fri Jan 2 21:58:06 2009 -> Running as user clamav (UID 103, GID 105) Fri Jan 2 21:58:06 2009 -> Log file size limit disabled. Fri Jan 2 21:58:06 2009 -> Reading databases from /var/clamav Fri Jan 2 21:58:06 2009 -> Not loading PUA signatures. Fri Jan 2 21:58:14 2009 -> Loaded 484408 signatures. Fri Jan 2 21:58:14 2009 -> TCP: Bound to address 127.0.0.1 on port 3310 Fri Jan 2 21:58:14 2009 -> TCP: Setting connection queue length to 30 Fri Jan 2 21:58:14 2009 -> LOCAL: Unix socket file /var/run/clamav/clamd Fri Jan 2 21:58:14 2009 -> LOCAL: Setting connection queue length to 30 Fri Jan 2 21:58:14 2009 -> Limits: Global size limit set to 104857600 bytes. Fri Jan 2 21:58:14 2009 -> Limits: File size limit set to 26214400 bytes. Fri Jan 2 21:58:14 2009 -> Limits: Recursion level limit set to 16. Fri Jan 2 21:58:14 2009 -> Limits: Files limit set to 10000. Fri Jan 2 21:58:14 2009 -> Archive support enabled. Fri Jan 2 21:58:14 2009 -> Algorithmic detection enabled. Fri Jan 2 21:58:14 2009 -> Portable Executable support enabled. Fri Jan 2 21:58:14 2009 -> ELF support enabled. Fri Jan 2 21:58:14 2009 -> Detection of broken executables enabled. Fri Jan 2 21:58:14 2009 -> Mail files support enabled. Fri Jan 2 21:58:14 2009 -> OLE2 support enabled. Fri Jan 2 21:58:14 2009 -> PDF support enabled. Fri Jan 2 21:58:14 2009 -> HTML support enabled. Fri Jan 2 21:58:14 2009 -> Self checking every 1800 seconds.
Folgender Befehl kann zur Überprüfung verwendet werden, ob ClamAV auf localhost
bzw. 127.0.0.1
und Port 3310
lauscht:
# netstat -tulpen | grep clamd tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 103 149344 25230/clamd
bzw.
# lsof -i :3310 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME clamd 25230 clamav 5u IPv4 149344 TCP localhost.localdomain:dyna-access (LISTEN)
Postfix ClamAV freshclam
Um ClamAV immer mit den aktuellen Vireninformationen zu versorgen, wird bei der Installation von ClamAV insbesondere beim Paket clamav.i386
auch das Programm freshclam
mit installiert.
freshclam
sorgt dafür, dass ClamAV - standardmäßig unter CentOS einmal pro Tag ein update der Virendefinitionsdateien erhält.
Falls dies ein zu großer Zyklus sein sollte, gibt es Möglichkeiten dies zu ändern und den Update-Zyklus zu verkürzen.
freshclam konfigurieren
Folgende Anpassungen gegenüber der Standard-Konfiguration sind Hilfreich, um freshclam
besser nutzen zu können und damit gleichzeitig den Schutz zu erhöhen. Die relevanten Änderungen sind mit folgendem Kommentar
# Tachtler
versehen.
Hier die komplette Konfigurationsdatei, welche sich unter /etc
mit dem Namen freshclam.conf
befindet:
## ## Example config file for freshclam ## Please read the freshclam.conf(5) manual before editing this file. ## # Comment or remove the line below. #Example # Path to the database directory. # WARNING: It must match clamd.conf's directive! # Default: hardcoded (depends on installation options) DatabaseDirectory /var/clamav # Path to the log file (make sure it has proper permissions) # Default: disabled UpdateLogFile /var/log/clamav/freshclam.log # Maximum size of the log file. # Value of 0 disables the limit. # You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) # and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). # in bytes just don't use modifiers. # Default: 1M #LogFileMaxSize 2M # Log time with each message. # Default: no # Tachtler # default: #LogTime yes LogTime yes # Enable verbose logging. # Default: no #LogVerbose yes # Use system logger (can work together with UpdateLogFile). # Default: no # Tachtler # default: LogSyslog yes #LogSyslog yes # Specify the type of syslog messages - please refer to 'man syslog' # for facility names. # Default: LOG_LOCAL6 #LogFacility LOG_MAIL # This option allows you to save the process identifier of the daemon # Default: disabled # Tachtler # default: #PidFile /var/run/freshclam.pid PidFile /var/run/freshclam.pid # By default when started freshclam drops privileges and switches to the # "clamav" user. This directive allows you to change the database owner. # Default: clamav (may depend on installation options) DatabaseOwner clamav # Initialize supplementary group access (freshclam must be started by root). # Default: no #AllowSupplementaryGroups yes # Use DNS to verify virus database version. Freshclam uses DNS TXT records # to verify database and software versions. With this directive you can change # the database verification domain. # WARNING: Do not touch it unless you're configuring freshclam to use your # own database verification domain. # Default: current.cvd.clamav.net #DNSDatabaseInfo current.cvd.clamav.net # Uncomment the following line and replace XY with your country # code. See http://www.iana.org/cctld/cctld-whois.htm for the full list. #DatabaseMirror db.XY.clamav.net # database.clamav.net is a round-robin record which points to our most # reliable mirrors. It's used as a fall back in case db.XY.clamav.net is # not working. DO NOT TOUCH the following line unless you know what you # are doing. DatabaseMirror db.de.clamav.net DatabaseMirror db.local.clamav.net # How many attempts to make before giving up. # Default: 3 (per mirror) #MaxAttempts 5 # With this option you can control scripted updates. It's highly recommended # to keep it enabled. # Default: yes #ScriptedUpdates yes # By default freshclam will keep the local databases (.cld) uncompressed to # make their handling faster. With this option you can enable the compression; # the change will take effect with the next database update. # Default: no #CompressLocalDatabase no # Number of database checks per day. # Default: 12 (every two hours) # Tachtler # default: #Checks 24 # Checks 48 - DISABLED - BUG in Version 0.95.0 for CentOS 5.3 # Enabled -c 48 in /etc/init.d/freshclam-init # Checks 48 - ENABLED - BUG from Version 0.95.0 in Version 0.95.1 for CentOS 5.3 - SOLVED Checks 48 # Proxy settings # Default: disabled #HTTPProxyServer myproxy.com #HTTPProxyPort 1234 #HTTPProxyUsername myusername #HTTPProxyPassword mypass # If your servers are behind a firewall/proxy which applies User-Agent # filtering you can use this option to force the use of a different # User-Agent header. # Default: clamav/version_number #HTTPUserAgent SomeUserAgentIdString # Use aaa.bbb.ccc.ddd as client address for downloading databases. Useful for # multi-homed systems. # Default: Use OS'es default outgoing IP address. #LocalIPAddress aaa.bbb.ccc.ddd # Send the RELOAD command to clamd. # Default: no NotifyClamd /etc/clamd.conf # Run command after successful database update. # Default: disabled #OnUpdateExecute command # Run command when database update process fails. # Default: disabled #OnErrorExecute command # Run command when freshclam reports outdated version. # In the command string %v will be replaced by the new version number. # Default: disabled #OnOutdatedExecute command # Don't fork into background. # Default: no #Foreground yes # Enable debug messages in libclamav. # Default: no #Debug yes # Timeout in seconds when connecting to database server. # Default: 30 #ConnectTimeout 60 # Timeout in seconds when reading from database server. # Default: 30 #ReceiveTimeout 60 # When enabled freshclam will submit statistics to the ClamAV Project about # the latest virus detections in your environment. The ClamAV maintainers # will then use this data to determine what types of malware are the most # detected in the field and in what geographic area they are. # This feature requires LogTime and LogFile to be enabled in clamd.conf. # Default: no #SubmitDetectionStats /path/to/clamd.conf # Country of origin of malware/detection statistics (for statistical # purposes only). The statistics collector at ClamAV.net will look up # your IP address to determine the geographical origin of the malware # reported by your installation. If this installation is mainly used to # scan data which comes from a different location, please enable this # option and enter a two-letter code (see http://www.iana.org/domains/root/db/) # of the country of origin. # Default: disabled #DetectionStatsCountry country-code
/etc/cron.hourly
Eine, die einfachere Möglichkeit, besteht darin das Update-Script, welches sich mit dem Namen freshclan
aktuell und standardmäßig unter
- /etc/cron.daily/freshclam
befindet, nach
- /etc/cron.hourly/freshclam
zu kopieren.
Das Verschieben des Scripts kann mit folgendem Befehl durchgeführt werden:
# mv /etc/cron.daily/freshclam /etc/cron.hourly/
Eine kleine Anpassung für CentOS 5.3 ist ebenfalls notwendig! (Hier das komplette Script)
#!/bin/sh ### A simple update script for the clamav virus database. ### This could as well be replaced by a SysV script. ### fix log file if needed LOG_FILE="/var/log/clamav/freshclam.log" if [ ! -f "$LOG_FILE" ]; then touch "$LOG_FILE" chmod 644 "$LOG_FILE" chown clamav.clamav "$LOG_FILE" fi /usr/bin/freshclam \ --quiet \ --datadir="/var/clamav" \ --log="$LOG_FILE" \ --verbose \ --daemon-notify="/etc/clamd.conf"
Im Vergleich zur Version CentOS 5.2 muss bei CentOS 5.3 die Zeile
... --log-verbose \ ...
in
... --verbose \ ...
abgeändert werden!
freshclam Daemon
Eine weitere, etwas aufwendigere Möglichkeit, ist der Einsatz von freshclam
als Daemon, welcher im Hintergrund läuft. Wobei die Möglichkeit des Einsatzes eines Daemons und das updaten per cron
-Job sich gegenseitig nicht ausschließen!
Leider ist in der Standard-Installation von freshclam
- kein - Init-V-Script
bei CentOS bzw. im RPMforge-Repository enthalten.
Deswegen kann folgendes Script genutzt werden, um den Start von freshclam
auch nach einem System-(re)-start auch in Zukunft dauerhaft zu realisieren.
#!/bin/sh # # freshclam Init Script to start/stop the freshclam. # # chkconfig: - 62 38 # description: freshclam is an update daemon for Clam AV database. # # processname: freshclam # config: /etc/freshclam.conf # pidfile: /var/run/clamav/freshclam.pid # Source function library . /etc/init.d/functions # Get network config . /etc/sysconfig/network test -f /etc/freshclam.conf || exit 0 RETVAL=0 DATA_DIR="/var/clamav" CLAMD_CONF_FILE="/etc/clamd.conf" LOG_FILE="/var/log/clamav/freshclam.log" if [ ! -f "$LOG_FILE" ]; then touch "$LOG_FILE" chmod 644 "$LOG_FILE" chown clamav.clamav "$LOG_FILE" fi start() { echo -n $"Starting freshclam: " # Start me up! # --log="$LOG_FILE" \ # --log-verbose \ daemon /usr/bin/freshclam -d -p /var/run/clamav/freshclam.pid \ -c 48 \ --quiet \ --datadir="$DATA_DIR" \ --daemon-notify="$CLAMD_CONF_FILE" RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/freshclam return $RETVAL } stop() { echo -n $"Stopping freshclam: " killproc freshclam RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/run/clamav/freshclam.pid /var/lock/subsys/freshclam return $RETVAL } restart() { stop start } reload() { echo -n $"Reloading DB: " killproc freshclam -ALRM RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status freshclam ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/freshclam ] && restart || : ;; reload) reload ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" exit 1 esac exit $?
Das Script mit dem Namen
freshclam-init
muss nach
/etc/init.d
kopiert werden!
Die Dateirechte können mit folgendem Befehl richtig gesetzte werden:
# chmod 755 /etc/init.d/freshclam-init
Die Besitzrechte können mit folgendem Befehl richtig gesetzt werden:
# chown root.root /etc/init.d/freshclam-init
Anschließend kann folgender Befehl genutzte werden um freshclam
zu den Start-Scripten der einzelnen Runlevel des Betriebssystem hinzugefügt:
# chkconfig freshclam-init on
Ein Überprüfung, ob freshclam
in den einzelnen Runlevel des Betriebssystems bei einem System-(re)-start mit gestartet wird, kann mit folgendem Befehl abgefragt werden:
# chkconfig --list | grep freshclam-init freshclam-init 0:off 1:off 2:on 3:on 4:on 5:on 6:off
freshclam
im Daemon-Modus kann mit folgendem Befehl gestartet werden:
# service freshclam-init start Starting freshclam: [ OK ]
Nach dem Start, sollten folgende Meldungen in der LOG-Datei /var/log/clamav/freshclam.log
entahlten sein:
Sat Jan 3 22:49:48 2009 -> -------------------------------------- Sat Jan 3 22:49:48 2009 -> freshclam daemon 0.94.2 (OS: linux-gnu, ARCH: i386, CPU: i386) Sat Jan 3 22:49:48 2009 -> ClamAV update process started at Sat Jan 3 22:49:48 2009 Sat Jan 3 22:49:48 2009 -> main.cvd is up to date (version: 49, sigs: 437972, f-level: 35, builder: sven) Sat Jan 3 22:49:48 2009 -> daily.cld is up to date (version: 8833, sigs: 46845, f-level: 38, builder: mcichosz) Sat Jan 3 22:49:48 2009 -> --------------------------------------