GNU/Linux >> LINUX-Kenntnisse >  >> Ubuntu

So integrieren Sie ClamAV (über mod_clamav) in ProFTPd zum Virenscannen unter Ubuntu 10.04

Dieses Tutorial erklärt, wie Sie ClamAV in ProFTPd zum Virenscannen auf einem Ubuntu 10.04-System integrieren können. Dies wird durch mod_clamav erreicht. Am Ende prüft ClamAV jedes Mal, wenn eine Datei über ProFTPd hochgeladen wird, die Datei und löscht sie, wenn es sich um Malware handelt.

Ich gebe keine Garantie dafür, dass dies bei Ihnen funktioniert!

1 Vorbemerkung

Sie sollten ein funktionierendes ProFTPd-Setup auf Ihrem Ubuntu 10.04-Server haben.

Da wir alle Schritte dieses Tutorials mit Root-Rechten ausführen werden, können wir entweder allen Befehlen in diesem Tutorial die Zeichenfolge sudo voranstellen oder wir werden sofort root, indem wir

eingeben
sudo su 

2 Installation von ClamAV

ClamAV kann wie folgt installiert werden:

aptitude install clamav clamav-daemon libclamav-dev

Jetzt müssen wir ClamAV neu konfigurieren, damit Clamd TCP-Verbindungen anstelle eines lokalen Unix-Sockets verwendet. Es wird dringend empfohlen, Unix-Socket-Verbindungen zu vermeiden, wenn die Chroot-Funktion von ProFTPd (DefaultRoot ~) verwendet wird. Der Grund dafür ist, dass, wenn mod_clamav sich mit Clamd verbinden muss, der Unix-Socket in der Chroot-Umgebung nicht verfügbar ist.

Ausführen

dpkg-reconfigure clamav-base

... und beantworten Sie diese Fragen wie folgt (übernehmen Sie die Standardwerte für alle anderen Fragen):

Socket-Typ:<-- TCP
TCP-Port, auf dem Clamd lauscht:<-- 3310
IP-Adresse, auf dem Clamd lauscht:<-- 127.0.0.1

Starten Sie dann Clamd und freshclam neu:

/etc/init.d/clamav-daemon restart
/etc/init.d/clamav-freshclam restart

Jetzt ausführen

netstat -tap | grep clamd

... und Sie sollten sehen, dass Clamd über TCP auf localhost lauscht:

[email protected]:~# netstat -tap | grep clamd
tcp        0      0 localhost.localdom:3310 *:*                     LISTEN      7911/clamd
[email protected]:~#

3 Neuerstellung von ProFTPd

Leider ist mod_clamav standardmäßig nicht Teil von ProFTPd, und es gibt kein Ubuntu-Paket für mod_clamav, also müssen wir ProFTPd mit mod_clamav neu erstellen. Ich werde das Ubuntu-Quellpaket von ProFTPd verwenden und neue ProFTPd-.deb-Pakete mit mod_clamav-Unterstützung bauen.

Zuerst installieren wir alle Pakete, die zum Neuaufbau von ProFTPd benötigt werden:

aptitude build-dep proftpd-dfsg

Außerdem benötigen wir die folgenden Pakete:

aptitude install libpam-devdpkg-dev libmysqlclient-dev debhelper libpq-dev libldap2-dev libwrap0-dev libcap2-dev autotools-dev libncurses5-dev dpatch libacl1-dev libattr1-dev unixodbc-dev libsqlite3-dev

Jetzt laden wir das ProFTPd-Quellpaket nach /usr/src:

herunter

cd /usr/src
apt-get source proftpd-dfsg

Als nächstes laden wir mod_clamav nach /usr/src herunter und entpacken es:

wget --no-check-certificate https://secure.thrallingpenguin.com/redmine/attachments/download/1/mod_clamav-0.11rc.tar.gz
tar xzvf mod_clamav-0.11rc.tar.gz

Dann kopieren wir die Dateien mod_clamav-0.11rc/mod_clamav.* in das Verzeichnis proftpd-dfsg-1.3.2c/contrib...

cp mod_clamav-0.11rc/mod_clamav.* proftpd-dfsg-1.3.2c/contrib

... und die ProFTPd-Quellen patchen:

cd proftpd-dfsg-1.3.2c
patch -p1 <../mod_clamav-0.11rc/proftpd.patch

Als nächstes müssen wir debian/rules bearbeiten:

vi debian/rules

Durchsuchen Sie den Abschnitt CONF_ARGS und fügen Sie --with-modules=mod_clamav hinzu:

[...]
CONF_ARGS := --prefix=/usr \
             --with-includes=$(shell pg_config --includedir):$(shell mysql_config --include|sed -e 's/-I//') \
             --mandir=/usr/share/man --sysconfdir=/etc/$(NAME) --localstatedir=/var/run --libexecdir=/usr/lib/$(NAME) \
             --enable-sendfile --enable-facl --enable-dso --enable-autoshadow --enable-ctrls --with-modules=mod_readme \
             --enable-ipv6 --enable-nls --with-modules=mod_clamav
[...]

Jetzt können wir ProFTPd neu erstellen:

dpkg-buildpackage

Jetzt gehen wir ein Verzeichnis nach oben, dort wurden die neuen .deb-Pakete erstellt:

cd .. 

Der Befehl

ls -l 

zeigt Ihnen die verfügbaren Pakete:

[email protected]:/usr/src# ls -l
insgesamt 7500
drwxr-xr-x 24 root root    4096 2010-04-29 14:00 linux-headers-2.6.32-21
drwxr-xr-x  7 root root    4096 2010-04-29 14:00 linux-headers-2.6.32-21-server
drwxr-xr-x  2  501  501    4096 2009-04-20 10 :22 mod_clamav-0.11rc
-rw-r--r--  1 root src     5115 2010-10-04 17:21 mod_clamav-0.11rc.tar.gz
-rw-r--r --  1 root src   930578 2010-10-04 17:38 proftpd-basic_1.3.2c-1_amd64.deb
-rw-r--r--  1 root src   630168 2010-10-04 17:38 proftpd -dev_1.3.2c-1_amd64.deb
drwxr-xr-x 14 root root    4096 2010-10-04 17:37 proftpd-dfsg-1.3.2c
-rw-r--r-- 1 root src     4522 2010-10-04 17:38 proftpd-dfsg_1.3.2c-1_amd64.changes
-rw-r--r--  1 root src    98674 2010-10-04 17:30 proftpd-dfsg_1 .3.2c-1.diff.gz
-rw-r--r--  1 root src     1138 2010-10-04 17:30 proftpd-dfsg_1.3.2c-1.dsc
-rw -r--r--  1 root src  3018899 2009-12-22 07:05 proftpd-dfsg_1.3.2c.orig.tar.gz
-rw-r--r--  1 root src  1408070 2010- 10-04 17 :38 proftpd-doc_1.3.2c-1_all.deb
-rw-r--r--  1 root src   315326 2010-10-04 17:38 proftpd-mod-ldap_1.3.2c-1_amd64.deb
-rw-r--r--  1 root src   305076 2010-10-04 17:38 proftpd-mod-mysql_1.3.2c-1_amd64.deb
-rw-r--r--  1 root src   306848 2010-10-04 17:38 proftpd-mod-odbc_1.3.2c-1_amd64.deb
-rw-r--r--  1 root src   304762 2010-10-04 17:38 proftpd- mod-pgsql_1.3.2c-1_amd64.deb
-rw-r--r--  1 root src   304634 2010-10-04 17:38 proftpd-mod-sqlite_1.3.2c-1_amd64.deb
[E-Mail-geschützt]:/usr/src#

Wir können die neuen ProFTPd .deb-Pakete wie folgt installieren:

dpkg -i proftpd*.deb 

4 Konfigurieren von ProFTPd

Jetzt müssen wir ProFTPd so konfigurieren, dass es mod_clamav verwendet, wenn eine Datei hochgeladen wird. Öffnen Sie /etc/proftpd/proftpd.conf...

vi /etc/proftpd/proftpd.conf

... und füge die Strophe hinzu


   ClamAV on
   ClamServer 127.0.0.1
   ClamPort 3310

irgendwo, z. unter dem


AdminControlsEngine aus

Abschnitt:

[...]
<IfModule mod_ctrls_admin.c>
AdminControlsEngine off
</IfModule>

<IfModule mod_clamav.c>
   ClamAV on
   ClamServer 127.0.0.1
   ClamPort 3310
</IfModule>

#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf
[...]

Starten Sie ProFTPd neu:

/etc/init.d/proftpd restart

Überprüfen Sie nun, ob mod_clamav geladen ist, indem Sie Folgendes ausführen:

proftpd -vv

mod_clamav sollte in der Ausgabe aufgeführt sein:

[email protected]:~# proftpd -vv
ProFTPD Version: 1.3.2c (maint)
  Scoreboard Version: 01040002
  Erstellt: Mo Okt 4 17:34:10 MESZ 2010

Geladene Module:
  mod_ifsession/1.0
  mod_dynmasq/0.2.1
  mod_wrap2_file/1.2
  mod_wrap2/2.0.6
  mod_ban/0.5.3
  mod_load/1.0.1
  mod_rewrite/0.7
  mod_wrap.c
  mod_quotatab_radius.c
  mod_quotatab_file.c
  mod_quotatab/1.3.0
  mod_radius /0.9
  mod_tls/2.2.2
  mod_ctrls_admin/0.9.5
  mod_lang/0.9
  mod_ctrls/0.9.4
  mod_cap/1.0
  mod_clamav.c
  mod_auth_pam/1.1
  mod_ident/1.0
  mod_dso/0.4
  mod_facts/0.1
  mod_delay/0.6
  mod_site.c
  mod_log.c
  mod_ls.c
  mod_auth.c
  mod_auth_file/0.8.3
  mod_auth_unix.c
  mod_xfer.c
  mod_core.c
[email protected ]:~#

Das ist es! Wenn jetzt jemand versucht, Malware über ProFTPd auf Ihren Server hochzuladen, werden die "schlechten" Dateien gelöscht. Sie können dies testen, indem Sie den Eicar-Testvirus von http://www.eicar.org/anti_virus_test_file.htm herunterladen; Versuchen Sie, es auf Ihren ProFTPd-Server hochzuladen, und wenn alles gut geht, sollte es gelöscht werden:

  • ProFTPd:http://www.proftpd.org/
  • mod_clamav:http://www.thrallingpenguin.com/resources/mod_clamav.htm
  • ClamAV:http://www.clamav.net/
  • Ubuntu:http://www.ubuntu.com/

Ubuntu
  1. So integrieren Sie ClamAV in PureFTPd zum Virenscannen unter Ubuntu 12.10

  2. So integrieren Sie ClamAV in PureFTPd zum Virenscannen auf Debian Squeeze

  3. So integrieren Sie ClamAV in PureFTPd zum Virenscannen unter CentOS 6.2

  4. So integrieren Sie ClamAV in PureFTPd zum Virenscannen unter CentOS 7

  5. So installieren Sie ProFTPD unter Ubuntu 14.04

So installieren Sie Software über Flatpak auf Ubuntu

So installieren Sie CMake unter Ubuntu 20.04 LTS

So installieren Sie ProFTPD unter Ubuntu 20.04

So installieren Sie ClamTk – ein Frontend für ClamAV (Clam Antivirus) unter Ubuntu 20.04

So installieren Sie ClamAV unter Ubuntu 18.04 LTS

So installieren Sie ClamAV unter Ubuntu 20.04 LTS