materi system lpse
TRANSCRIPT
LPSE LPSE NasionalNasionalLPSE System LPSE System Configuration & Configuration & RequirementRequirement
RequirementRequirement
Apache versi 2.x libapache2-mod-jk libapache2-mod-security2
Tomcat versi 6
Java SDK versi 1.6.0
Postgresql 8.2
Apache InstalationApache Instalation
1. Instalasi Apache bisa dilakukan dari sorce code yang bisa didownload dari www.apache.org/dist/httpd.
2. Atau bisa juga dari pre-package dengan ekstensi .deb atau .rpm
Bisa juga dengan package manager.
Requirements untuk untuk compile apache
ANSI-C compiler
Perl 5 intrepeter
Dynamic Shared Object (DSO)
*Ashok appu,Administering and Securing the Apache Server,Premier Press
File configurationFile configuration
Instalasi melalui source code biasanya akan membuat directory /etc/httpd. Pada debian akan terinstal pada /etc/apache2/.
Hal yang penting diperhatikan adalah httpd.conf atau kalau di debian berada di apache2.conf.
Di debian konfigurasi oleh user bisa ditempatkan di /etc/apache2/sites-available/default.
Apache 2.xApache 2.x Library apache yang biasa digunakan:Library apache yang biasa digunakan:
apache2 2.2.6-2 Next generation, scalable, extendable web server
apache2-mpm-prefork 2.2.9-2 Apache HTTP Server - traditional non-threaded
apache2-utils 2.2.6-2 utility programs for webservers
apache2.2-common 2.2.9-2 Apache HTTP Server common files
libapache2-mod-evasive 1.10.1-1 evasive module to minimize HTTP DoS or brute
libapache2-mod-jk 1.2.25-2 Apache 2 connector for the Tomcat Java servlet
libapache2-mod-security2 Tighten web applications security for Apache
Apache ConfigurationApache Configuration
Module apache autoindex dihilangkan karena user dimungkinkan untuk browsing setiap Alias.
Untuk debian ada di derektori /etc/apache2/mods-enabled/
Biasanya module deflate akan terinstal secara default yang nantinya akan dipakai agar beberapa file yang ditransfer ke browser bisa di zip.
Mod_evasiveMod_evasive Konfigurasi untuk mod evasive berguna
untuk mengurangi dampak serangan DOS atau brute force attack.
<IfModule mod_evasive20.c>
DOSHashTableSize 6194
DOSPageCount 25
DOSSiteCount 80
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
</IfModule>
Cont'Cont'HTTP Client10.10.10.10
Apache proses
Mod_evasive Create Hash10.10.10.10 -> /
Checks Hash Table
10.10.10.2 -> /image10.10.10.2 -> /dir10.10.10.10 -> /10.10.10.10 -> /10.10.10.10 -> /10.10.10.10 -> /10.10.10.10 -> /10.10.10.10 -> /
10.10.10.3 -> /image10.10.10.3 -> /dir
.
.
.
.
.
1 second blockGet
HTTP 403Forbidden
10.10.10.10 -> /Over threshold
403 respond
*Preventing Web Attack with Apache,Addison Wesley
Cont'Cont' DoHashTableSize
ukuran hash table untuk setiap proses di apache
DosPageCount
Batasan jumlah request untuk halaman yang sama
DosSiteCount
Batasan jumlah request untuk sebuah site(URL)
DosPageInterval
Batasan req Interval untuk setiap ganti halaman
DosSiteInterval
Batasan req interval untuk setiap site
DosBlockingPeriod
jumlah waktu untuk memblok request dari client
*Preventing Web Attack with Apache,Addison Wesley
Mod_deflateMod_deflate Mod deflate digunakan sebagai filter output dari web server yang akan
mengkompres file saat terjadi transaksi dengan browser klien.
GET /EPROC/app HTTP/1.0" 5568/35732 (15%)
*apache.org
SetOutputFilter DEFLATE
DeflateBufferSize 65536
DeflateCompressionLevel 9
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
DeflateMemLevel 9
DeflateWindowSize 15
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch "Windows 98" gzip-only-text/html
BrowserMatch "MSIE [45]" gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpeg|jpe|jpg|png|ico|t?gz|zip|rar|pdf|doc|xls|dat)$ no-gzip dont-vary
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog /var/log/apache2/deflate_log deflate
Configuration Configuration mod_deflatemod_deflate
SetOutputFilter Deflate
Enable compression
DeflateBufferSizze
ukuran direktori yang digunakan oleh zlib
DeflateCompressionLevel
level kompresi yang akan digunakan, semakin tinggi level maka kompresi semakin baik/cepat tetapi membutuhkan kinerja cpu yang lebih.
DeflateFilterNote
catatan yang digenerate dan nantinya bisa digunakan didalam log file sebagai informasi
*apache.org
Cont'Cont' DeflateMemLevel
konfigurasi untuk menentukan berapa banyak memori yang digunakan oleh zlib. Level antara 1-9
DeflateWindowSize
konfigurasi untuk menentukan kompresi zlib.Semakin tinggi level semakin tinggi ratio yang dihasilkan.Level antara 1-15.
BrowserMatch
mendeteksi sebuah browser yang nantinya digunakan untuk special purpose.
SetEnvIfNoCase Request_URI
Perintah untuk memfilter request *apache.org
Mod_jkMod_jk Mod jk adalah plugins milik apache yang berfungsi sebagai agen
untuk menangani komunikasi antara apache dan tomcat.
Module jk di apache harus diaktifkan dulu dengan command LoadModule
Format : LoadModule <nama module> <module file>
Contoh : LoadModule jk_module /usr/lib/apache2/mod_jk.so
Mendefinisikan workers.properties
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
Cont'Cont' JkWorkersFile
lokasi definisi untuk workers properties
JkLogFile
Lokasi untuk mencatat log mod_jk
JkLogLevel
level system untuk mencata log. Value :
debug,info,error,emerg
JkLogStampFormat
menggunakan fungsi strftime(). Default:
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
*apache.org
Cont'Cont' Mod jk juga memerlukan konfigurasi sebuah worker yang
bekerja menerima request servlet server. Konfigurasi ini dinamakan workers.properties.
ps=/
worker.list=worker2
worker.worker2.port=8089
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=2
Cont'Cont' Ps=/
file system separator.
worker.list=<property value>
List nama untuk masing-masing worker
worker.<property value>.host=<host>
alamat host yang harus “didengar” worker
worker.<property value>.type=<type>
definisi tipe(protocol) sebuah worker
worker.<property value>.lbfactor=<value>
jika dipakai sebagai load balancer maka nilai ini sebagai load-balancing factor
*apache.org
Cont'Cont' worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=worker1 worker2 worker3
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)catalina.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)
i386$(ps)classic$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
*apache.org
Cont'Cont' JkMount /latihan/app* worker2
setiap request yang berawalan /latihan/app akan dihandle oleh worker 2. .../app... notabene adalah proses tapestry dimana bisa kita sebut sebagai dinamic konten. Untuk file lain /latihan/...... akan dihandle langsung oleh apache. Dalam hal ini bisa disebut static konten.
Apache configurationApache configuration Dalam apache configuration kita membuat sebuah virtual host.
NameVirtualHost www.pengadaannasional-bappenas.go.id:80
<VirtualHost www.pengadaannasional-bappenas.go.id:80>
LogLevel warn
CustomLog /var/log/apache2/access.log combined
RedirectMatch ^/$ /eproc/app
RedirectMatch ^/latihan$ /latihan/app
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/x-httpd-php
SetInputFilter DEFLATE
SetOutputFilter DEFLATE
</VirtualHost>
Mod_security2Mod_security2 sekilas prinsip security
Confidentiality : Information is not disclosed to unauthorized parties.
Integrity : Informations remains unchanged in transit or iin storage until it is changed by an authorized party.
Availability : Authorized parties are given timely and uninterrupted access to resources and information.
*Apache Security,O'reilly,Ivan Ristic
IntroIntro ModSecurity adalah aplikasi firewall dalam web. Melindungi
serangan terhadap web aplikasi dan dapat digunakan untuk melihat HTTP traffic,logging dan real-time analisis.
*www.modsecurity.org
*Ivan Ristic,ApacheCon Europe 2008,Web Intrusion Detection with ModSecurity
Mod security Mod security configurationconfiguration
SecAuditEngine RelevantOnly
SecRequestBodyAccess On
SecResponseBodyAccess On
SecAuditLogParts ABCFHZ
SecAuditLog /home/logs_apache_tomcat/security/audit_apache.log
SecDebugLog /home/logs_apache_tomcat/security/modsec_debug.log
SecDebugLogLevel 3
SecDefaultAction log,auditlog,deny,status:403,phase:2,t:none
SecRuleEngine On
SecServerSignature "Netscape-Enterprise/6.0 PHP5.2.0 mod_asp/3.4.5"
SecRule ARGS "\.\./"SecRule ARGS "<[[:space:]]*script"SecRule ARGS "<(.|\n)+>"SecRule REQUEST_BODY "(document\.cookie|Set-Cookie|SessionID=)"SecRule REQUEST_BODY "<[^>]*meta*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*style*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*script*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*iframe*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*object*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*img*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*applet*\"?[^>]*>"SecRule REQUEST_BODY "<[^>]*form*\"?[^>]*>"SecRule REQUEST_HEADERS:User-Agent "Nikto" "log,deny,status:403,msg:'Nikto Scanners Identified'"SecRule HTTP_HOST "\x25"SecRule HTTP_HOST "^$" "log,allow,msg:'no http host'"SecRule HTTP_USER_AGENT "^$" "log,allow,msg:'No user agent'"SecRule REQUEST_BODY "/^(etc|bin|sbin|tmp|var|opt|dev|kernel|exe)$/"SecRule ARGS "delete[[:space:]]+from"SecRule ARGS "insert[[:space:]]+into"SecRule ARGS "select.+from"SecRule ARGS "\<\!--\#"SecRule ARGS "((=))[^\n]*(<)[^\n]+(>)"
SecRule REQUEST_BODY "(\'|\")"SecRule REQUEST_BODY "!^[\x20-\x7f]+$"SecRule REQUEST_URI "^/(bin|cgi|cgi(\.cgi|-91[45]|-sys|-local|s|-win|-exe|-home|-perl)|(mp|web)cgi|(ht|ows-)bin|scripts|fcgi-bin)/"SecRule REQUEST_BODY "/bin/ps"SecRule ARGS "wget\x20"SecRule ARGS "uname\x20-a"SecRule REQUEST_BODY "/nessus_is_probing_you_"SecRule REQUEST_URI "^OR 1=1--*"<LocationMatch /cgi-bin/>SecRule REQUEST_URI "!(script1\.cgi|script2\.cgi|custom_email\.pl|form\.cgi\.exe)"</LocationMatch>
Thank YouThank You