ModSecurity2 di Slackware 12 (1/2)
Apa itu modsecurity ?
-
ModSecurity is a web application firewall that can work either embedded or as a reverse proxy. It provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
Jawaban singkat :
-
Modsecurity = Firewall Internal Webserver
-
Lebih jauh, Anda dapat melihat http://modsecurity.org :)
Contoh aplikasi praktis :
- Saya menggunakan path transversal buat mencuri 'mangga' di seberang tembok.
http://localhost/../../../../../etc/passwd
Dan dapat jawaban dari browser (Tidak pakai modsecurity):
Not Found
The requested URL /etc/passwd was not found on this server.
Kalau pakai modsecurity :
Method Not Implemented
GET to /etc/passwd not supported.
Sudah punya bayangan ? Kali ini saya mencoba ModSecurity 2.5.0-rc1 di Slackware 12 yang menggunakan Httpd Apache 2.2.4. Harapannya, setelah rilis final, Anda (maupun saya) sudah bisa menggunakan dengan baik.
Untuk mendownload, Anda musti daftar dulu di Breach security Network. (lihat session donwload di http://modsecurity.org)
Menu spesial pada cabang 2.5 adalah pemanfaatan bahasa LUA di rule modsecurity. Jadi jika ingin lengkap, download LUA. Lihat di http://slackbuild.org dan kompile sendiri. Hehehe.
Mari mulai kawan :P
- Download modsecurity-apache_2.5.0-rc1.tar.gz
- Unpack, cari direktory doc dan baca manual dulu ! Hehehe
Edit Makefile.
- Masuk di direktory
apache2dan edit fileMakefile.
top_dir=/usr/lib/httpd
INCLUDES= -I /usr/Include/libxml2 -I /usr/include
Kompile dan Install :
- Lakukan
#make. - Lakukan
#make install
Sudah punya paket LUA ?
- Ke http://slackbuild.org
- Cari LUA, download script + source.
- Lakukan kompilasi, install paket tgz lua.
Edit /etc/httpd/httpd.conf
- Tambahkan LoadFile dibawah ini di atas LoadModule
- Tambahkan LoadModule di bawah ini :
- Tambah direktif di bawah ini :
LoadFile /usr/lib/libxml2.so
LoadFile /usr/lib/liblua.so
LoadModule security2_module lib/httpd/modules/mod_security2.so
< IfModule security2_module>
Include /etc/httpd/modsecurity/*.conf
< /IfModule>
Rule Modsecurity
- Buat direktory (bebas) misal
/etc/httpd/modsecurity - Copykan seluruh rules ke direktory tersebut.
- Edit isi rule
modsecurity_crs_10_config.conf - Tentukan letak file audit.
- Lebih baik letakkan di
/var/log/ - Dua file tersebut musti dibuat manual.
SecAuditLog /var/log/modsec_audit.log
SecDebugLog /var/log/modsec_debug.log
Oke, coba start Apache Anda, semoga tidak ada pesan kesalahan :)
Lihat juga tulisan revisi (30-11-2008) http://slackerbox.com/node/576