modul-3-firewall-iptables.pdf
-
Upload
habib-ahmad-purba -
Category
Documents
-
view
228 -
download
0
Transcript of modul-3-firewall-iptables.pdf
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 1/32
Network Security
Firewall1
Muhammad Zen S. Hadi, ST. MSc.
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 2/32
Pengertian Firewall2
Firewall adalah sebuah software atau hardware atau kombinasie uanya maupun s s em u sen r un u mencega a ses yang a
berhak ke suatu jaringan sehingga ada suatu mekanisme yang
bertujuan untuk melindungi, baik dengan menyaring, membatasi atau
bahkan menolak suatu hubungan/kegiatan (daridari luar luar kedalamkedalam atauatau daridari
dalamdalam keke luar luar ) suatu segmen pada jaringan pribadi dengan jaringan luar yang bukan merupakan ruang lingkupnya berdasarkan aturan-aturan
yang ditetapkan.
,
server,router, atau local area network (LAN) maupun wireless.
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 3/32
Konsep Firewall3
Tujuan untuk melindungi, dengan :
enyar ng membatasi
menolak
jaringan pribadi dengan jaringan luar yang
bukan merupakan ruang lingkupnya
egmen erse u apa merupa an se ua wor s a on, server, rou er, a aulocal area network (LAN) anda
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 4/32
Konfigurasi Sederhana4
c arin an local <==> firewall <==> internet arin an lain
Boleh lewat mbak ?
Nih surat-suratnya
Anak kec il ga bolehkeluar.. sudah malam
Firewall
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 5/32
Karakteristik Firewall5
Seluruh hubungan/kegiatan dari dalam ke luar , harus.
Hal ini dapat dilakukan dengan cara memblok/membatasi baiksecara fisik semua akses terhadap jaringan Lokal, kecuali melewatifirewall. Banyak sekali bentuk jaringan yang memungkinkan.
Hanya Kegiatan yang terdaftar/dikenal yang dapatmelewati/melakukan hubungan, hal ini dapat dilakukan dengan mengatur policy pada konfigurasi
eamanan o a . Banya se a en s rewa yang apat psekaligus berbagai jenis policy yang ditawarkan.
Firewall itu sendiri haruslah kebal atau relatif kuat
. hal ini berarti penggunaan sistem yang dapat dipercaya dan denganOperating system yang relatif aman.
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 6/32
Teknik Yang Digunakan6
Service control (kendali terhadap layanan) berdasarkan ti e-ti e la anan an di unakan di Internet dan boleh diakses
baik untuk kedalam ataupun keluar firewall. Biasanya firewall akan mencek no
IP Address dan juga nomor port yang di gunakan baik pada protokol TCP danUDP, bahkan bisa dilengkapi software untuk proxy yang akan menerima danmenterjemahkan setiap permintaan akan suatu layanan sebelummeng n annya. a an sa a so ware pa a server u sen r , seperlayanan untuk web ataupun untuk mail.
Direction Control (kendali terhadap arah) berdasarkan arah dari berbagai permintaan (request) terhadap layanan yang
a an ena an n an me ewat rewa .
User control (kendali terhadap pengguna) berdasarkan pengguna/user untuk dapat menjalankan suatu layanan, artinya
ada user an da at dan ada an tidak da at men alankan suatu servis hal ini
di karenakan user tersebut tidak di ijinkan untuk melewati firewall. Biasanyadigunakan untuk membatasi user dari jaringan lokal untuk mengakses keluar,tetapi bisa juga diterapkan untuk membatasi terhadap pengguna dari luar.
Behavior Control (kendali terhadap perlakuan) berdasarkan seberapa banyak layanan itu telah digunakan. Misal, firewall dapat
memfilter email untuk menanggulangi/mencegah spam.
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 7/32
Tipe Firewall7
Rule Based
Packet Filtering Static
Stateful
Application Level
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 8/32
I. Rules Based Firewall8
Rule Firewall dibuat agar sesuai dengan aturan
yang telah dibuat. Rule berdasarkan pada:
Rout ng ase ters W o – s apa Pengirim dan penerima
berasal dari mana ? Mau ke mana ?
Tidak peduli mau ngapain di sana
Content based filters What – mau a a No port TCP/IP dan layanan
Apa yang akan kamu lakukan di sana ?
-,seorang client
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 9/32
Dua pendekatan aturan
9
Default allow
Mengijinkan semua lewat kecuali yang terdaftar
Default deny
Semua dilarang lewat kecuali yang terdaftar
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 10/32
II. Packet Filtering10
Packet Filtering diaplikasikan dengan cara mengatur semua,
packet tersebut. pada tipe ini packet tersebut akan diatur apakah akan di
, . penyaringan packet ini di konfigurasikan untuk menyaring
packet yang akan di transfer secara dua arah (baik dari. Biasa dikenal sebagai packet inspection
Menginspeksi header IP, TCP, UDP, ICMP dan no port
Static packet inspection
Stateful inspection
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 11/32
IIa. Static Packet Filter Firewall11
Corporate Network The Internet
IP-H TCP-H Application MessagePermit
(Pass)
IP-H UDP-H Application Message
Deny- -(Drop)
Only IP, TCP, UDP and ICMP Headers ExaminedLog
File
StaticPacket
Filter Arriving Packets Examined One at a Time, in
Isolation; This Misses Many Attacks
rewa
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 12/32
IIb. Stateful Inspection Firewalls12
Permit connections initiated by an internal host Den connections initiated b an external host
Can change default behavior with ACL
Automatically Accept Connection Attempt
InternetRouter
u oma ca y eny onnec on emp
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 13/32
Stateful Inspection Firewalls13
State of Connection: Open or Closed
State: Order of packet within a dialog
Stateful Firewall Operation Record the two IP addresses and port numbers in state table as
OK (open)
Accept future packets between these hosts and ports with nofurther inspection
,except attacks based on application message content
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 14/32
Stateful Inspection Firewall Operation I14
2.
1.TCP SYN Segment
From: 60.55.33.12:62600
Connection 3.TCP SYN Segment
From: 60.55.33.12:62600
To: 123.80.5.34:80 To: 123.80.5.34:80
StatefulNote: Outgoing
External
Webserver
123.80.5.34
Client PC
60.55.33.12
Firewall Allowed By
Default
Type Internal
IP
Internal
Port
External
IP
External
Port Status
TCP 60.55.33.12 62600 123.80.5.34 80 OK
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 15/32
Stateful Inspection Firewall Operation I15
6. 4.
External
Webserver
123.80.5.34
Client PC
60.55.33.12
TCP SYN/ACK Segment
From: 123.80.5.34:80
To: 60.55.33.12:62600
TCP SYN/ACK Segment
From: 123.80.5.34:80
To: 60.55.33.12:62600
Check Connection
OK;
Pass the Packet
Type Internal
IP
Internal
Port
External
IP
External
Port Status
TCP 60.55.33.12 62600 123.80.5.34 80 OK
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 16/32
Stateful Inspection Firewalls16
State u Firewa Operation
For UDP, also record two IP addresses and port numbersin the state table
Type Internal
IP
Internal
Port
External
IP
External
Port Status
onnec on a e
TCP
UDP
60.55.33.12
60.55.33.12
62600
63206
123.80.5.34
1.8.33.4
80
69
OK
OK
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 17/32
PACKET FILTERING
17
Contohnya: packet bertujuan ke server kita menggunakan IP 202.159.121.38 dengan port 80
atribut an dimiliki aket tsb
An abbreviated packet…
Source SrcPort Destination DestPort
204.210.251.1 8104 128.146.2.205 31337
A Cisco packet filter
access-list 2640 deny any 128.146.2.0 0.0.0.255 gt 1023
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 18/32
Packet Filtering Example18
1. If source IP address = 10.*.*.*, DENY [private IP address range] * * * *. = . . . . . . ,
address range] 3. If source IP address = 192.168.*.*, DENY [private IP address range] . If source IP address = 60. 0.*.* DENY irm’s internal address ran e
5. If source IP address = 1.2.3.4, DENY [black-holed address of attacker]
6. If TCP SYN=1 AND FIN=1 DENY cra ted attack acket
7. If destination IP address = 60.47.3.9 AND TCP destination port=80 OR443, PASS [connection to a public webserver]
8. If TCP SYN=1 AND ACK=0, DENY [attempt to open a connection fromthe outside] 9. If TCP destination port = 20, DENY [FTP data connection]
. ,connection]
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 19/32
Packet Filtering Example19
11. If TCP destination port = 23, DENY [Telnet data connection] . = ,
connection for clients] 13. If TCP destination port = 513, DENY [UNIX rlogin without password]
14. If TCP destination port = 514, DENY [UNIX rsh launch shell withoutlogin]
15. If TCP destination port = 22, DENY [SSH for secure login, but some
16. If UDP destination port=69, DENY [Trivial File Transfer Protocol;no login necessary]
17. If ICMP Type = 0, PASS [allow incoming echo reply messages]
18. If TCP RST=1, DENY [do not allow outgoing resets; used in hostscanning]
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 20/32
Packet Filtering Example20
DENY ALL
Last rule
Dro s an ackets not s ecificall ermitted b earlier rules
In the previous ACL, Rules 8-18 are not needed; Deny all
would catch them
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 21/32
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 22/32
Packet Filtering22
Seran an an mun kin ter adi IP address spoofing :
intruder (penyusup) dari luar dapat melakukan ini dengan caramenyertakan/menggunakan ip address jaringan lokal yanbg telah
.
Source routing attacks : tipe ini tidak menganalisa informasi routing sumber IP, sehingga
memungkinkan untuk membypass firewall. ny ragment attac s :
intruder (penyusup) membagi IP kedalam bagian-bagian (fragment) yanglebih kecil dan memaksa terbaginya informasi mengenai TCP header.Serangan jenis ini di design untuk menipu aturan penyaringan yang
ergan ung epa a n ormas ar ea er. enyerang er araphanya bagian (fragment) pertama saja yang akan di periksa dan sisanyaakan bisa lewat dengan bebas. Hal ini dapat di tanggulangi dengan caramenolak semua packet dengan protokol TCP dan memiliki Offset = 1
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 23/32
A lication Level Gatewa (Prox Firewall)
Mekanismen a tidak han a berdasarkan
23
sumber, tujuan dan atribut paket, tetapi juga bisa mencapai isi paket tersebut
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 24/32
Application Level24
Application-level Gateway yang biasa juga di kenal sebagai proxy.
Tipe ini akan mengatur semua hubungan yang menggunakan layeraplikasi ,baik itu FTP, HTTP, GOPHER dll.
Cara kerjanya adalah apabila ada pengguna yang menggunakan salah,
gateway akan meminta user memasukkan alamat remote host yangakan di akses.Saat pengguna mengirimkan User ID serta informasi
lainnya yang sesuai maka gateway akan melakukan hubungan,menyalurkan data diantara kedua titik. Apabila data tersebut tidaksesuai maka firewall tidak akan meneruskan data tersebut ataumenolaknya. Lebih jauh lagi, pada tipe ini Firewall dapat di
menolak aplikasi lainnya untuk melewati firewall. Biasa dikenal Application Inspection
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 25/32
Application Level25
Kelebihannya : Relatif lebih aman daripada tipe packet filtering router, lebih mudah untuk
memeriksa (audit) dan mendata (log) semua aliran data yang masuk pada levelaplikasi.
Tidak mengijinkan langsung koneksi antara internal dan eksternal host Mendukung authentication, ‘classes’ of users Mendukung akses allow/deny berdasarkan content Dapat menyimpan log aktifitas yg detil (termasuk bagian data dari paket) Caching
Kekurangannya pemrosesan tambahan yang berlebih pada setiap hubungan. yang akan
menga a an er apa ua ua sam ungan one s an ara pema a an ga eway,dimana gateway akan memeriksa dan meneruskan semua arus dari dua arah.
Lebih lambat daripada packet filtering firewall Require additional hardware
slow hardware = slow service Some firewalls require special client configurations on the workstations. Some protocols may not be supported (AIM, RealAudio, Napster, H.323).
Must configure proxy for each protocol
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 26/32
Iptables
netfilter/iptables terdiri dari 3 tabel: filter, nat, mangle
26
Perintah 'iptables' digunakan untuk mengelola,memaintain, menginspeksi rule-rule IP packet filter
a am erne nux.
Rule di chain :
1. ACCEPTMenerima paket dan diproses lebih lanjut oleh kernel.
2. DROP
Menolak paket tanpa pemberitahuan sama sekali.3. REJECT
kesalahan ICMP.
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 27/32
Tabel Filter
filter: - .
It contains the built-in chains INPUT (for
,
packets being routed through the box), and
OUTPUT or locall - enerated ackets .
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 28/32
Tabel nat
This table is consulted when a packet that creates a.
three built-ins: PREROUTING (for altering
,alteringlocally-generated packets before routing),
and POSTROUTING or alterin ackets as the
are about to go out).
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 29/32
Tabel mangle
man le:
This table is used for specialized packet alteration. Untilkernel 2.4.17 it had two built-in chains: PREROUTING (for
altering incoming packets before routing) and OUTPUT
(for altering locally-generated packets before routing).
-. . ,
supported: INPUT (for packets coming into the box itself),
FORWARD (for altering packets being routed through the
box),and POSTROUTING (for altering packets as they areabout to go out).
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 30/32
Diagram netfilter/iptables
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 31/32
Contoh iptables
Untuk menambah daftar
31
#iptables -A FORWARD -s 192.168.56.100/32 -j DROP
Untuk melihat daftar
# p a es -n
Untuk menghapus daftar
#i tables -D FORWARD -s 1 2.168. 6.100 2 - DROP Untuk menghapus semua daftar
#iptables -F
Untuk menyimpan iptables#iptables-save
7/25/2019 modul-3-firewall-iptables.pdf
http://slidepdf.com/reader/full/modul-3-firewall-iptablespdf 32/32
Contoh iptables
Untuk mendrop service ssh
32
# pta es - -p tcp -- port 22 -
Untuk mendrop icmp (ping) -> semuanya#i tables -A FORWARD - icm - DROP
Drop icmp dari jaringan 192.168.56.0#iptables -A FORWARD -s 192.168.56.0/24 -p icmp -j DROP
#iptables -A FORWARD -s ! 192.168.56.100 -p icmp -j DROP
Drop ke port 80 (http)
# p a es - -p cp -- por 0 -