Secure Web menggunakan Squid Clamav Redirector ----------------------------------------------- SquidClamAV Redirector (SCAVR) adalah skrip pembantu squid agar dapat melakukan scanning virus yang didefinisikan berdasarkan filename extension-nya. Salah satu virus masuk ke dalam jaringan lokal adalah melalui browsing internet. Berikut adalah langkah2 yang penulis lakukan untuk menangkal virus yang datang dari web dengan bantuan proxy squid Persyaratan yang dipunyai penulis: 1. Install Distro CentOS 4.2 2. Squid bawaan CentOS : squid-2.5.STABLE6-3.4E.11 3. Clam Antivirus : clamav-0.88.tar.gz 4. Squid Clamav Redirector : SCAVR.tar.gz 5. Apache : httpd-2.2.0.tar.gz 6. PHP : php-4.4.2.tar.gz Instalasi apache ---------------- Sebelumnya kita lakukan instalasi apache yang terbaru saat ditulis tutorial ini Download binary httpd-2.2.0.tar.gz di www.apache.org, kemudian simpan dalam direktori /usr/local/src # cd /usr/local/src # tar zxvf httpd-2.2.0.tar.gz # cd httpd-2.2.0 # ./configure --enable-so # make # make install # /usr/local/apache2/bin/apachectl start Instalasi php ------------- simpan source php ke direktori /usr/local/src # cd /usr/local/src/ # tar zxvf php-5.1.1.tar.gz # cd php php-5.1.1 # ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-gd=shared --enable-gd-native-ttf --without-gdbm --with-gettext --with-ncurses=shared --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-xml --with-expat-dir=/usr --with-dom=shared,/usr --with-dom-xslt=/usr --with-dom-exslt=/usr --with-xmlrpc=shared --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-pear=/usr/share/pear --with-imap=shared --with-imap-ssl --with-kerberos --with-ldap=shared --with-mysql=/usr/local/mysql --with-pgsql=shared --with-snmp=shared,/usr --with-snmp=shared --enable-ucd-snmp-hack --with-unixODBC=shared,/usr --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --enable-mbstring=shared --enable-mbstr-enc-trans --enable-mbregex --with-mime-magic=/usr/share/file/magic.mime --with-apxs2=/usr/local/apache2/bin/apxs Untuk mendapatkan option ./configure diatas dengan cara berikut: Penulis menggunakan Distro CentOS 4.2 dengan paket bawaan (rpm) apache dan php. aktifkan apache bawaan CentOS tsb, kemudian buat file info.php Lalu buka browser dengan link http://ipaddressserver/info.php option ./configure-nya didapatkan dari 'Configure Command' dari info.php Hanya saja ada beberapa opsi yang diganti yaitu opsi --with-apxs2=/usr/sbin/apxs diganti menjadi --with-apxs2=/usr/local/apache2/bin/apxs Mulai instalasi php: # make # make install # cp php.ini-dist /usr/local/lib/php.ini # vi /usr/local/apache2/conf/httpd.conf Pada file httpd.conf tambahkan baris berikut: AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps Untuk mengecek php kita terintegrasi dengan apache dapat dilakukan dengan membuat file info.php di direktori /usr/local/apache2/htdocs. Kemudian buka browser dengan mengakses file info.php tadi. Instalasi Clam Antivirus ------------------------- Buat User dan group clamav: # useradd -s /bin/false clamav Ekstrak clamav: # tar zxvf clamav-0.88.tar.gz # cd clamav-0.88 Sekarang instal clamav: # ./configure # make # make install Edit file /usr/local/etc/clamd.conf dan /usr/local/etc/freshclamd.conf, beri tanda comment (#) pda baris "Example" Example ----> # Example Jalankan daemon antivirus: # clamd Jalankan update virus database # freshclam Pada file /usr/local/etc/freshclamd.conf, ubah baris berikut: # Checks 24 -----> Checks 12 Maksudnya adalah agar database dicheck tiap 2 jam sekali, jika ada database yang terbaru, maka akan di update. Instalasi SquidClamAV Redirector -------------------------------- # tar zxvf SCAVR.tar.gz # cp SquidClamAV_Redirector.py /usr/local/bin # cp SquidClamAV_Redirector.conf /etc/squid # chmod +x /usr/local/bin/SquidClamAV_Redirector.py # chown squid:squid /etc/squid/SquidClamAV_Redirector.conf Edit file /etc/squid/SquidClamAV_Redirector.conf sesuai dengan kemauan Anda. Testing redirector: # /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf http://www.freshmeat.net/ FOO FOO BAR Jika muncul pesan berikut: Traceback (most recent call last): File "/usr/local/bin/SquidClamAV_Redirector.py", line 28, in ? import pyclamav ImportError: No module named pyclamav Anda harus menginstall modul pyclamav: # tar pyclamav-0.3.2.tar.gz # cd pyclamav-0.3.2 # python setup.py build # python setup.py install Jalankan lagi testing redirector: # /usr/local/bin/SquidClamAV_Redirector.py -c /etc/squid/SquidClamAV_Redirector.conf http://www.freshmeat.net/ FOO FOO BAR Jika tidak ada pesan error, maka clamav redirector sudah berjalan dengan baik, tekan ctrl ^D untuk keluar dari command testing diatas. Instalasi SRG (Squid Report Generator) -------------------------------------- # tar zxvf srg-1.1.tar.gz # cd srg-1.1 # make # make install # mkdir /usr/local/apache2/htdocs/proxy # mv srg-1.1/* /usr/local/apache2/htdocs/proxy # vi /bin/proxyanalyze #!/bin/bash date=$(date -d yesterday +%d/%m/%Y-%d/%m/%Y) /usr/local/sbin/srg -H -r -R -S -t $date -f /var/log/squid/access.log -g A -o /usr/local/apache2/htdocs/proxy # crontab -l 10 0 * * * /bin/proxyanalyze 2&>/dev/null Cek SRG dengan cara membuka browser kesayangan Anda: http://ip.address.server.anda/proxy