You are on page 1of 312

Certified Security Engineer

(MTCSE)

Harijanto Pribadi
Caption in Bahasa
Schedule/Jadwal

• Training day: 9AM - 5PM


• 30min breaks: 10:30AM and 3PM
• 1h lunch: 12:30PM
• Certification test: last day, 1 hour
Introduce Yourself/Perkenalan

• Your name and company


• Your prior knowledge about networking
• Your prior knowledge about RouterOS
• What do you expect from this course?
• Please, note your number (XY): ___
LAB SETUP
Lab Setup
SSID : CLASS-AP

BAND : 2.4 / 5 Ghz


KEY : MikroTikLab

AP

R1 R2 Rn

Wireless-Link
Ether-Link
Module 1
INTRODUCTION
What Security is all about?

Security is about protection of assets / Keamanan adalah


tentang perlindungan aset
• D. Gollmann, Computer Security, Wiley
Confidentiality : Protecting personal privacy and proprietary
information / Melindungi privasi pribadi dan informasi hak milik
Integrity : Ensuring information non-repudiation and
authenticity / Memastikan informasi tanpa penolakan dan
keaslian
Availability : Ensuring timely and reliable access to and use of
information / Memastikan akses tepat waktu dan dapat
diandalkan ke dan penggunaan informasi
What Security is all about?

Prevention : take measures that prevent your assets from being


damaged (or stolen) / mengambil tindakan yang mencegah aset
Anda rusak (atau dicuri)
Detection : take measures so that you can detect when, how,
and by whom an asset has been damaged / mengambil
langkah-langkah sehingga Anda dapat mendeteksi kapan,
bagaimana, dan oleh siapa suatu aset telah rusak
Reaction : take measures so that you can recover your assets /
mengambil langkah-langkah sehingga Anda dapat memulihkan
aset Anda
Security Attacks, Mechanisms & Services

Security Attack : Any action that compromises the security of


information. / Setiap tindakan yang membahayakan keamanan
informasi
Security Mechanism : a process / device that is designed to
detect, prevent or recover from a security attack. / suatu proses
/ perangkat yang dirancang untuk mendeteksi, mencegah atau
memulihkan dari serangan keamanan.
Security Service : a service intended to counter security
attacks, typically by implementing one or more mechanisms. /
layanan yang dimaksudkan untuk melawan serangan keamanan,
biasanya dengan menerapkan satu atau lebih mekanisme.
Security Threats / Attacks

NORMAL FLOW

Information Information
source destination
Security Threats / Attacks

INTERRUPTION

Information Information
source destination

“services or data become unavailable, unusable, destroyed, and so on, such as loss of
file, denial of service, etc.” / “Layanan atau data menjadi tidak tersedia, tidak dapat
digunakan, dihancurkan, dan sebagainya, seperti kehilangan file, penolakan layanan,
dll.”
Security Threats / Attacks
INTERCEPTION

Information Information
source destination

Attacker

“an unauthorized 3rd party has gained access to an object, such as stealing data,
overhearing another's communication, etc.” / "Pihak ke-3 yang tidak sah telah
memperoleh akses ke objek, seperti mencuri data, mendengar komunikasi orang lain,
dll."
Security Threats / Attacks
MODIFICATION

Information Information
source destination

Attacker

unauthorized changing of data or tampering with services, such as alteration of data,


modification of messages, etc. / perubahan data yang tidak sah atau merusak
layanan, seperti perubahan data, modifikasi pesan, dll.
Security Threats / Attacks
FABRICATION

Information Information
source destination

Attacker

“additional data or activities are generated that would normally not exist, such as
adding a password to a system, replaying previously sent messages, etc.” / “Data atau
kegiatan tambahan dihasilkan yang biasanya tidak ada, seperti menambahkan kata
sandi ke sistem, memutar ulang pesan yang dikirim sebelumnya, dll.”
Threat / Attack Types

Interruption

Active Attacks / Threats Modification

Attack / Threats Fabrication

Passive Attacks /
Interception
Threats
Security Mechanisms
Encryption : transforming data into something an attacker cannot understand, i.e.,
providing a means to implement confidentiality, as well as allowing the user to check
whether data has been modified. / mengubah data menjadi sesuatu yang tidak dapat
dipahami oleh penyerang, yaitu memberikan cara untuk menerapkan kerahasiaan,
serta memungkinkan pengguna untuk memeriksa apakah data telah dimodifikasi.
Authentication : verifying the claimed identity of a user, such as user name,
password, etc. / memverifikasi identitas yang diklaim pengguna, seperti nama
pengguna, kata sandi, dll.
Authorization : checking whether the user has the right to perform the action
requested. / memeriksa apakah pengguna memiliki hak untuk melakukan tindakan
yang diminta.
Auditing : tracing which users accessed what, when, and which way. In general,
auditing does not provide protection, but can be a tool for analysis of problems. /
melacak pengguna mana yang mengakses apa, kapan, dan ke mana. Secara umum,
audit tidak memberikan perlindungan, tetapi dapat menjadi alat untuk analisis
masalah.
COMMON THREATS
Common Security Threats
Botnet
“Collection of software robots, or 'bots', that creates an army of
infected computers (known as ‘zombies') that are remotely controlled by the
originator” / “Kumpulan robot perangkat lunak, atau 'bot', yang menciptakan
pasukan komputer yang terinfeksi (dikenal sebagai‘ zombie ') yang
dikendalikan dari jarak jauh oleh pencetusnya ”

What it can do :
• Send spam emails with viruses attached. / Kirim email spam dengan virus
terlampir.
• Spread all types of malware. / Sebarkan semua jenis malware.
• Can use your computer as part of a denial of service attack against other
systems. / Dapat menggunakan komputer Anda sebagai bagian dari
serangan "penolakan layanan" terhadap sistem lain.
Common Security Threats
Distributed denial-of-service (DDoS)
“A distributed denial-of-service (DDoS) attack — or DDoS attack — is when
a malicious user gets a network of zombie computers to sabotage a specific website or
server.” / Serangan penolakan layanan (DDoS) terdistribusi - atau serangan DDoS -
adalah ketika pengguna jahat mendapatkan jaringan komputer zombie untuk
menyabot situs web atau server tertentu. "

What it can do :
• The most common and obvious type of DDoS attack occurs when an attacker
“floods” a network with useless information. / Jenis serangan DDoS yang paling
umum dan jelas terjadi ketika penyerang "membanjiri" jaringan dengan informasi
yang tidak berguna.
• The flood of incoming messages to the target system essentially forces it to shut
down, thereby denying access to legitimate users. / Banjir pesan yang masuk ke
sistem target pada dasarnya memaksa untuk ditutup, sehingga menolak akses ke
pengguna yang sah.
Common Security Threats
Hacking
“Hacking is a term used to describe actions taken by someone to
gain unauthorised access to a computer.” / "Peretasan adalah istilah yang
digunakan untuk menggambarkan tindakan yang dilakukan seseorang untuk
mendapatkan akses tidak sah ke komputer."

What it can do :
• Find weaknesses (or pre-existing bugs) in your security settings and
exploit them in order to access your devices. / Temukan kelemahan (atau
bug yang sudah ada sebelumnya) di pengaturan keamanan Anda dan
manfaatkan mereka untuk mengakses perangkat Anda.
• Install a Trojan horse, providing a back door for hackers to enter and
search for your information. / Instal kuda Troya, memberikan pintu
belakang bagi peretas untuk masuk dan mencari informasi Anda.
Common Security Threats
Malware
“Malware is one of the more common ways to infiltrate or damage
your computer, it’s software that infects your computer, such as computer
viruses, worms, Trojan horses, spyware, and adware.” / "Malware adalah
salah satu cara yang lebih umum untuk menyusup atau merusak komputer
Anda, itu adalah perangkat lunak yang menginfeksi komputer Anda, seperti
virus komputer, worm, Trojan horse, spyware, dan adware."
What it can do :
• Intimidate you with scareware, which is usually a pop-up message that tells you your computer
has a security problem or other false information. / Mengintimidasi Anda dengan scareware,
yang biasanya merupakan pesan pop-up yang memberitahu Anda komputer Anda memiliki
masalah keamanan atau informasi palsu lainnya.
• Reformat the hard drive of your computer causing you to lose all your information. / Memformat
ulang hard drive komputer Anda menyebabkan Anda kehilangan semua informasi Anda
• Alter or delete files. / Ubah atau hapus file.
• Steal sensitive information. / Curi informasi sensitif.
• Send emails on your behalf. / Kirim email atas nama Anda.
• Take control of your computer and all the software running on it. / Kendalikan komputer Anda
dan semua perangkat lunak yang menjalankannya.
Common Security Threats
Phishing
“Phishing is used most often by cyber criminals because it's easy to
execute and can produce the results they're looking for with very little effort.” /
"Phishing paling sering digunakan oleh penjahat dunia maya karena mudah
dieksekusi dan dapat menghasilkan hasil yang mereka cari dengan sedikit usaha."

What it can do :
• Trick you into giving them information by asking you to update, validate or
confirm your account. It is often presented in a manner than seems official and
intimidating, to encourage you to take action. / Menipu Anda agar memberi
mereka informasi dengan meminta Anda memperbarui, memvalidasi, atau
mengonfirmasi akun Anda. Seringkali disajikan dengan cara, daripada yang
tampak resmi dan menakutkan, untuk mendorong Anda mengambil tindakan.
• Provides cyber criminals with your username and passwords so that they can
access your accounts (your online bank account, shopping accounts, etc.) and
steal your credit card numbers. / Berikan para penjahat cyber dengan nama
pengguna dan kata sandi Anda sehingga mereka dapat mengakses akun Anda
(akun bank online Anda, akun belanja, dll.) Dan mencuri nomor kartu kredit
Anda.
Common Security Threats
Ransomware
“Ransomware is a type of malware that restricts access to your computer
or your files and displays a message that demands payment in order for the
restriction to be removed.” / "Ransomware adalah jenis malware yang membatasi
akses ke komputer Anda atau file Anda dan menampilkan pesan yang menuntut
pembayaran agar pembatasan dihapus."

What it can do :
• Lockscreen ransomware: displays an image that prevents you from accessing your
computer. / Ransomware Lockscreen: menampilkan gambar yang mencegah Anda
mengakses komputer Anda.
• Encryption ransomware: encrypts files on your system's hard drive and
sometimes on shared network drives, USB drives, external hard drives, and even
some cloud storage drives, preventing you from opening them. / Encryption
ransomware: mengenkripsi file pada hard drive sistem Anda dan kadang-kadang
pada drive jaringan bersama, drive USB, hard drive eksternal, dan bahkan
beberapa drive penyimpanan cloud, mencegah Anda untuk membukanya.
Common Security Threats
Spam
“Spam is one of the more common methods of both sending
information out and collecting it from unsuspecting people.” / "Spam adalah salah
satu metode yang lebih umum untuk mengirim informasi dan mengumpulkannya
dari orang yang tidak menaruh curiga."
What it can do :
• Annoy you with unwanted junk mail. / Mengganggu Anda dengan surat sampah
yang tidak diinginkan.
• Create a burden for communications service providers and businesses to filter
electronic messages. / Buat beban bagi penyedia layanan komunikasi dan bisnis
untuk memfilter pesan elektronik.
• Phish for your information by tricking you into following links or entering details
with too-good-to-be-true offers and promotions. / Lihat informasi Anda dengan
menipu Anda ke tautan berikut atau memasukkan detail dengan penawaran dan
promosi yang terlalu bagus.
• Provide a vehicle for malware, scams, fraud and threats to your privacy. /
Berikan kendaraan untuk malware, penipuan, penipuan, dan ancaman terhadap
privasi Anda.
Common Security Threats
Spoofing
“This technique is often used in conjunction with phishing in an
attempt to steal your information.” / "Teknik ini sering digunakan
bersamaan dengan phishing dalam upaya mencuri informasi Anda."
What it can do :
• Sends spam using your email address, or a variation of your email
address, to your contact list. / Mengirim spam menggunakan alamat
email Anda, atau variasi alamat email Anda, ke daftar kontak Anda.
• Recreates websites that closely resemble the authentic site. This could
be a financial institution or other site that requires login or other
personal information. / Membuat situs web yang mirip dengan situs
asli. Ini bisa berupa lembaga keuangan atau situs lain yang memerlukan
login atau informasi pribadi lainnya.
Common Security Threats
Spyware & Adware
“This technique is often used by third parties to infiltrate your computer
or steal your information without you knowing it.” / "Teknik ini sering digunakan
oleh pihak ketiga untuk menyusup ke komputer Anda atau mencuri informasi Anda
tanpa Anda sadari."

What it can do :
• Collect information about you without you knowing about it and give it to third
parties. / Kumpulkan informasi tentang Anda tanpa Anda sadari dan berikan
kepada pihak ketiga.
• Send your usernames, passwords, surfing habits, list of applications you've
downloaded, settings, and even the version of your operating system to third
parties. / Kirim nama pengguna, kata sandi, kebiasaan berselancar, daftar
aplikasi yang telah Anda unduh, pengaturan, dan bahkan versi sistem operasi
Anda ke pihak ketiga.
• Change the way your computer runs without your knowledge. / Ubah cara
komputer Anda berjalan tanpa sepengetahuan Anda.
• Take you to unwanted sites or inundate you with uncontrollable pop-up ads. /
Membawa Anda ke situs yang tidak diinginkan atau membanjiri Anda dengan
iklan pop-up yang tidak terkendali.
Common Security Threats
Trojan Horses
“A malicious program that is disguised as, or embedded within,
legitimate software. It is an executable file that will install itself and run
automatically once it's downloaded.” / “Program jahat yang disamarkan sebagai,
atau tertanam di dalam, perangkat lunak yang sah. Ini adalah file yang dapat
dieksekusi yang akan menginstal sendiri dan berjalan secara otomatis setelah
diunduh. ”
What it can do :
• Delete your files. / Hapus file Anda.
• Use your computer to hack other computers. / Gunakan komputer Anda untuk
meretas komputer lain.
• Watch you through your web cam. / Mengamati Anda melalui web cam Anda.
• Log your keystrokes (such as a credit card number you entered in an online
purchase). / Catat keystrokes Anda (seperti nomor kartu kredit yang Anda
masukkan dalam pembelian online).
• Record usernames, passwords and other personal information. / Catat nama
pengguna, kata sandi, dan informasi pribadi lainnya.
Common Security Threats
Virus
“Malicious computer programs that are often sent as an email
attachment or a download with the intent of infecting your computer.” /
"Program komputer jahat yang sering dikirim sebagai lampiran email
atau unduhan dengan maksud menginfeksi komputer Anda."

What it can do :
• Send spam. / Kirim spam.
• Provide criminals with access to your computer and contact lists. /
Berikan penjahat akses ke komputer dan daftar kontak Anda.
• Scan and find personal information like passwords on your computer. /
Pindai dan temukan informasi pribadi seperti kata sandi di komputer
Anda.
• Hijack your web browser. / Bajak browser web Anda.
• Disable your security settings. / Nonaktifkan pengaturan keamanan
Anda.
• Display unwanted ads. / Tampilkan iklan yang tidak diinginkan.
Common Security Threats
Worm
“A worm, unlike a virus, goes to work on its own without attaching itself
to files or programs. It lives in your computer memory, doesn't damage or alter the
hard drive and propagates by sending itself to other computers in a network.” /
“Cacing, tidak seperti virus, bekerja sendiri tanpa melampirkan file atau program.
Ia hidup di memori komputer Anda, tidak merusak atau mengubah hard drive dan
menyebar dengan mengirimkan dirinya sendiri ke komputer lain di jaringan. "

What it can do :
• Spread to everyone in your contact list. / Sebarkan ke semua orang di daftar
kontak Anda.
• Cause a tremendous amount of damage by shutting down parts of the Internet,
wreaking havoc on an internal network and costing companies enormous
amounts of lost revenue. / Menyebabkan sejumlah besar kerusakan dengan
mematikan bagian-bagian Internet, mendatangkan malapetaka pada jaringan
internal dan membuat perusahaan kehilangan banyak pendapatan.
ROUTEROS
SECURITY
DEPLOYMENT
MikroTik as a Global Firewall Router

DATA CENTER

OFFICE
INTERNET

GUEST
MikroTik as a Global Firewall Router

Pro's
• Simple topology / Topologi sederhana
• Easy to manage / Mudah dikelola

Con's
• Single-point-of-failure / Titik kegagalan
• Demands high resources / Menuntut sumber daya yang tinggi
MikroTik as a Specific Router Firewall

DATA CENTER

OFFICE
INTERNET

GUEST
MikroTik as a Specific Router Firewall
Pro's
• Less resource consumption on each router / Konsumsi sumber daya lebih sedikit
pada setiap router
• Only focusing security firewall on each network / Hanya memfokuskan firewall
keamanan pada setiap jaringan

Con's
• Different network segment, different treatment / Segmen jaringan yang berbeda,
perawatan yang berbeda
• Need to configure firewall differently on each router / Perlu mengkonfigurasi
firewall secara berbeda pada setiap router
• Possible to configure double firewall rules on one another's routers / Kemungkinan
untuk mengkonfigurasi aturan firewall ganda pada router satu sama lain
MikroTik as an IPS

DATA CENTER

OFFICE
INTERNET

GUEST
MikroTik as an IPS

Pros
• Clean firewall configuration on router, because all firewall
configuration already defined on an IPS (Intrusion Prevention
System) router / Bersihkan konfigurasi firewall pada router,
karena semua konfigurasi firewall sudah ditentukan pada
router IPS (Intrusion Prevention System)
Cons
• A lot of resources will be needed to use RouterOS as an IPS /
Banyak sumber daya akan dibutuhkan untuk menggunakan
RouterOS sebagai IPS
MikroTik with IDS as a trigger

DATA CENTER

OFFICE
INTERNET

GUEST
IDS SERVER
MikroTik with IDS as a trigger
Pro's
• All firewall rules are made automatically by API from IDS (Intrusion
Detection System) server / Semua aturan firewall dibuat secara otomatis
oleh API dari server IDS (Intrusion Detection System)
Con's
• Additional device is needed to be triggered by the "bad" traffic / Perangkat
tambahan diperlukan untuk dipicu oleh lalu lintas "buruk"
• A powerful device is needed for mirroring all traffic from networks /
Perangkat yang kuat diperlukan untuk mencerminkan semua lalu lintas
dari jaringan
• Need special scripting for sending information to router / Perlu skrip
khusus untuk mengirim informasi ke router
• Expensive / Mahal
Module 2
FIREWALL
STATEFUL
FIREWALL
Stateful firewall

• RouterOS implements a stateful firewall. A


stateful-firewall is a firewall capable of tracking
ICMP, UDP, and TCP connections. / RouterOS
mengimplementasikan firewall stateful. Stateful-
firewall adalah firewall yang mampu melacak
koneksi ICMP, UDP, dan TCP.
• This means that the firewall is able to identify if a
packet is related to previous packet. / Ini berarti
bahwa firewall dapat mengidentifikasi apakah
suatu paket terkait dengan paket sebelumnya.
• Firewall can track operating state. / Firewall dapat
melacak kondisi pengoperasian.
Connection tracking
Connection tracking
Connection tracking
Lab. ICMP tracking

/interface ethernet
set [ find default-name=ether1 ] comment="To Internet" name=ether1-internet
set [ find default-name=ether2 ] comment="To Lan" name=ether2-Lan

/ip pool
add name=dhcp_pool0 ranges=192.168.11.2-192.168.11.254

/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether2-Lan name=dhcp1
Lab. ICMP tracking

/ip address
add address=192.168.11.1/24 interface=ether2-Lan network=192.168.11.0

/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1-internet

/ip dhcp-server network


add address=192.168.11.0/24 gateway=192.168.11.1

/ip firewall nat


add action=masquerade chain=srcnat out-interface=ether1-internet

/system identity
set name=R1
Lab. ICMP tracking
Lab. ICMP tracking
Lab. ICMP tracking

/ip firewall mangle


add action=mark-connection chain=forward dst-address=8.8.8.8 new-connection-
mark=icmp passthrough=yes protocol=icmp

add action=mark-packet chain=forward connection-mark=icmp new-packet-mark=icmpout


out-interface=ether1-internet passthrough=yes

add action=mark-packet chain=forward connection-mark=icmp new-packet-mark=icmpin


out-interface=ether2-Lan passthrough=yes
Lab. ICMP tracking

/ip firewall mangle


add action=mark-connection chain=forward dst-address=8.8.8.8 new-
connection-mark=icmp passthrough=yes protocol=icmp
Lab. ICMP tracking
Lab. ICMP tracking
Lab. ICMP tracking

/ip firewall mangle


add action=mark-packet chain=forward connection-mark=icmp new-packet-mark=icmpout
out-interface=ether1-internet passthrough=yes
Lab. ICMP tracking
Lab. ICMP tracking

/ip firewall mangle


add action=mark-packet chain=forward connection-mark=icmp new-packet-mark=icmpin
out-interface=ether2-Lan passthrough=yes
Lab. ICMP tracking
Lab. Securing areas
Lab. Securing areas

/interface bridge
add fast-forward=no name=Lan

/interface ethernet
set [ find default-name=ether1 ] name=E1-ToInternet

/interface list
add name=WAN
add name=LAN
Lab. Securing areas

/ip pool
add name=dhcp_pool0 ranges=192.168.188.2-192.168.188.254

/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=Lan name=dhcp1

/interface bridge port


add bridge=Lan interface=ether2
add bridge=Lan interface=ether3
add bridge=Lan interface=ether4

/interface list member


add interface=E1-ToInternet list=WAN
add interface=Lan list=LAN
Lab. Securing areas

/ip address
add address=192.168.188.1/24 interface=Lan network=192.168.188.0

/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=E1-ToInternet

/ip dhcp-server network


add address=192.168.188.0/24 gateway=192.168.188.1

/ip firewall filter


add action=drop chain=forward comment="Drop external traffic" connection-
state=new in-interface-list=WAN

/ip firewall nat


add action=masquerade chain=srcnat out-interface-list=WAN

/system identity
set name=R1
PACKET
FLOW
Packet flow
Packet flow
Packet flow
Packet flow
Packet flow
RAW
TABLE
RouterOS Default Configuration
• RAW table offer two chains - prerouting and output
/ Tabel RAW menawarkan dua rantai - prerouting
dan output
• The function of the RAW table is to process the
packets before the connection tracking,
significantly reducing load on CPU / Fungsi tabel
RAW adalah untuk memproses paket sebelum
pelacakan koneksi, secara signifikan mengurangi
beban pada CPU
• This is much more efficient. / Ini jauh lebih efisien.
RAW table chains
RAW table
RAW table. Drop packets
RAW table. Drop packets
RAW table. SYN flood attack

/ip firewall filter


add action=drop chain=input protocol=tcp tcp-flags=syn in-
interface=E1-ToInternet
RAW table. SYN flood attack
RAW table. SYN flood attack

/ip firewall raw


chain=input action=drop tcp-flags=syn protocol=tcp in-interface=E1-
ToInternet
RAW table. SYN flood attack
RAW table. TCP SACK Panic attack

Recently Netflix discovered a vulnerability CVE-2019-11477 whereby a


Kernel Panic can be triggered by sending multiple TCP Selective ACK's
(SACK) with a low MSS. One mitigation is to block incoming packets
with a low MSS from initiating a connection to the router with the
following rules in IPv4 and IPv6 Firewall Raw Tables:

/ip firewall raw


add action=drop chain=prerouting protocol=tcp tcp-flags=syn tcp-mss=1-500 in-interface=E1-
ToInternet

/ipv6 firewall raw


add action=drop chain=prerouting protocol=tcp tcp-flags=syn tcp-mss=1-500 in-interface=E1-
ToInternet

Please note the values of 1-500 are nominal and might need to be adjusted to allow legitmate
traffic to your site. The use of a whitelist could also be included with these rules
RAW table. TCP SACK Panic attack

TIP: Use comments to describe rules


RAW table. SYN flood attack

Test it on your router!


ROUTEROS
DEFAULT
CONFIGURATION
RouterOS Default Configuration
• All RouterBOARDs from factory come with a default configuration. There are
several different configurations depending on the board type: / Semua
RouterBOARDs dari pabrik dilengkapi dengan konfigurasi default. Ada beberapa
konfigurasi berbeda tergantung pada jenis papan:
• CPE router
• LTE CPE AP router
• AP router (single or dual band)
• PTP Bridge (AP or CPE)
• WISP Bridge (AP in ap_bridge mode)
• Switch
• IP only
• CAP (Controlled Access Point)
• When should you remove the default-configuration and set up the router from
scratch? / Kapan Anda harus menghapus konfigurasi default dan mengatur router
dari awal?
CPE Router
• In this type of configurations router is configured as wireless client
device. / Dalam jenis konfigurasi ini, router dikonfigurasikan sebagai
perangkat klien nirkabel.
• WAN interface is Wireless interface. / Antarmuka WAN adalah
antarmuka nirkabel.
• WAN port has configured DHCP client, is protected by IP firewall
and MAC discovery/connection is disabled. / Port WAN telah
mengkonfigurasi klien DHCP, dilindungi oleh firewall IP dan
penemuan / koneksi MAC dinonaktifkan.
CPE Router
• List of routers using this type of configuration: / Daftar router yang
menggunakan jenis konfigurasi ini:
• RB711, 911, 912, 921, 922 - with Level3 (CPE) license
• SXT
• QRT
• SEXTANT
• LHG
• LDF
• DISC
• Groove
• Metal
LTE CPE AP router
• This configuration type is applied to routers that have both an LTE and a wireless
interface. / Tipe konfigurasi ini diterapkan pada router yang memiliki antarmuka
LTE dan nirkabel.
• The LTE interface is considered as a WAN port protected by the firewall and MAC
discovery/connection disabled. / Antarmuka LTE dianggap sebagai port WAN yang
dilindungi oleh firewall dan koneksi / penemuan MAC dinonaktifkan.
• IP address on the WAN port is acquired automatically. Wireless is configured as an
access point and bridged with all available Ethernet ports. / Alamat IP pada port
WAN diperoleh secara otomatis. Nirkabel dikonfigurasikan sebagai titik akses dan
dijembatani dengan semua port Ethernet yang tersedia.
• List of routers using this type of configuration: / Daftar router yang menggunakan
jenis konfigurasi ini:
• wAP LTE kit
• LtAP mini kit
AP Router (single or dual band)
• This type of configuration is applied to home access point routers to be used straight out of the
box without additional configuration (except router and wireless passwords) / Jenis konfigurasi ini
diterapkan pada router titik akses rumah untuk digunakan langsung dari kotak tanpa konfigurasi
tambahan (kecuali kata sandi router dan nirkabel)
• First Ethernet port is configured as a WAN port (protected by firewall, with a DHCP client and
disabled MAC connection/discovery) / Port Ethernet pertama dikonfigurasikan sebagai port WAN
(dilindungi oleh firewall, dengan klien DHCP dan koneksi / penemuan MAC yang dinonaktifkan)
• Other Ethernet ports and wireless interfaces are added to local LAN bridge with an IP
192.168.88.1/24 and a DHCP server / Port Ethernet dan antarmuka nirkabel lainnya ditambahkan
ke jembatan LAN lokal dengan IP 192.168.88.1/24 dan server DHCP
• In case of dual band routers, one wireless is configured as 5 GHz access point and the other as 2.4
GHz access point. / Dalam hal router dual band, satu nirkabel dikonfigurasikan sebagai jalur akses
5 GHz dan yang lainnya sebagai jalur akses 2,4 GHz.
• List of routers using this type of configuration: / Daftar router yang menggunakan jenis konfigurasi
ini:
• RB: 450, 751, 850, 951, 953, 2011, 3011, 4011
• mAP, wAP, hAP, OmniTIK
PTP Bridge (AP or CPE)
• Bridged ethernet with wireless interface / Ethernet terjembatani dengan
antarmuka nirkabel
• Default IP address 192.168.88.1/24 is set on the bridge interface / Alamat
IP default 192.168.88.1/24 diatur pada antarmuka jembatan
• There are two possible options - as CPE and as AP / Ada dua opsi yang
mungkin - sebagai CPE dan sebagai AP
• For CPE wireless interface is set in "station-bridge" mode. / Untuk antarmuka
nirkabel CPE diatur dalam mode "station-bridge".
• For AP "bridge" mode is used. / Untuk mode AP "jembatan" digunakan.
• List of routers using this type of configuration: / Daftar router yang
menggunakan jenis konfigurasi ini:
• DynaDish - as CPE
WISP Bridge
• Configuration is the same as PTP Bridge in AP mode, except that wireless mode is
set to ap_bridge for PTMP setups. / Konfigurasi sama dengan PTP Bridge dalam
mode AP, kecuali mode nirkabel diatur ke ap_bridge untuk pengaturan PTMP.
• Router can be accessed directly using MAC address. / Router dapat diakses
langsung menggunakan alamat MAC.
• If device is connected to the network with enabled DHCP server, configured DHCP
client configured on the bridge interface will get the IP address, that can be used
to access the router. / Jika perangkat terhubung ke jaringan dengan server DHCP
yang diaktifkan, klien DHCP yang dikonfigurasi yang dikonfigurasi pada antarmuka
jembatan akan mendapatkan alamat IP, yang dapat digunakan untuk mengakses
router.
• List of routers using this type of configuration: / Daftar router yang menggunakan
jenis konfigurasi ini:
• RB 911,912,921,922 - with Level4 license , cAP, Groove A, Metal A, RB711 A
• BaseBox, NetBox , mANTBox, NetMetal
Switch
• This configuration takes advantage of the switch chip features to configure
the switch. / Konfigurasi ini memanfaatkan fitur chip sakelar untuk
mengkonfigurasi sakelar.
• All ethernet ports are added to switch group and default IP address
192.168.88.1/24 is set on master port. / Semua port ethernet ditambahkan
ke grup beralih dan alamat IP default 192.168.88.1/24 diatur pada port
master.
• From RouterOS v6.41 and onwards uses Hardware Offload and adds all
ports into a bridge instead. / Dari RouterOS v6.41 dan seterusnya, gunakan
Hardware Offload dan tambahkan semua port ke dalam bridge.
• List of routers using this type of configuration: / Daftar router yang
menggunakan jenis konfigurasi ini:
• FiberBox
• CRS without wireless interface
IP Only
• When no specific configuration is found, IP address
192.168.88.1/24 is set on ether1, or combo1, or sfp1. / Ketika tidak
ada konfigurasi khusus yang ditemukan, alamat IP 192.168.88.1/24
diatur pada ether1, atau combo1, atau sfp1.
• List of routers using this type of configuration: / Daftar router yang
menggunakan jenis konfigurasi ini:
• RB 411,433,435,493,800,M11,M33,1100
• CCR
CAP
• This type of configuration is used when device is to be used as a wireless access
point which is controlled by the CAPsMAN / Jenis konfigurasi ini digunakan ketika
perangkat akan digunakan sebagai titik akses nirkabel yang dikendalikan oleh
CAPsMAN
• When CAP default configuration is loaded, ether1 is considered as a management
port with a DHCP client / Ketika konfigurasi default CAP dimuat, ether1 dianggap
sebagai port manajemen dengan klien DHCP
• All other Ethernet interfaces are bridged and all wireless interfaces are set to be
managed by the CAPsMAN / Semua antarmuka Ethernet lainnya dijembatani dan
semua antarmuka nirkabel diatur untuk dikelola oleh CAPsMAN
• None of the current boards come with the CAP mode enabled from the factory. The
above mentioned configuration is applied to all boards with at least one wireless
interfaces when set to the CAP mode / Tak satu pun dari papan saat ini datang
dengan mode CAP diaktifkan dari pabrik. Konfigurasi yang disebutkan di atas berlaku
untuk semua papan dengan setidaknya satu antarmuka nirkabel ketika diatur ke
mode CAP
IPv6
• Note. The IPv6 package by default is disabled on RouterOS v6. /
Catatan. Paket IPv6 secara default dinonaktifkan pada RouterOS
v6.
• If the router configuration is reset with default-
configuration=yes and the IPv6 package is enabled then the
default configuration will be applied to the IPv6 firewall as well.
/ Jika konfigurasi router diatur ulang dengan konfigurasi default
= ya dan paket IPv6 diaktifkan maka konfigurasi default juga
akan diterapkan ke firewall IPv6.
Print the factory default-configuration
• /system default-configuration print
IP firewall to the router
• Work with new connections to decrease load on a router; / Bekerja
dengan koneksi baru untuk mengurangi beban pada router;
• Create address-list for IP addresses that are allowed to access your router;
/ Buat daftar alamat untuk alamat IP yang diizinkan mengakses router
Anda;
• Enable ICMP access (optionally); / Aktifkan akses ICMP (opsional);
• Drop everything else, log=yes might be added to log packets that hit the
specific rule; / Lepaskan yang lainnya, log = yes mungkin ditambahkan ke
paket log yang sesuai dengan aturan tertentu;
IP firewall for the clients
• Established/related packets are added to fasttrack** for faster data throughput / Paket yang
dibuat / terkait ditambahkan ke fasttrack ** untuk throughput data yang lebih cepat
• firewall will work with new connections only; / firewall hanya akan bekerja dengan
koneksi baru;
• Drop invalid connection and log them with prefix invalid; / Putuskan koneksi yang tidak valid dan
catat dengan awalan tidak valid;
• Drop attempts to reach non public addresses from your local network (rfc1918) (10.0.0.0/8,
172.16.0.0/12, 192.168.0.0/16) / Drop upaya untuk mencapai alamat non publik dari jaringan
lokal Anda (rfc1918) (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
• drop forward dst-address-list=not_in_internet / drop forward dst-address-list =
not_in_internet
• bridge1 is local network interface / bridge1 adalah antarmuka jaringan lokal
• log attempts with prefix="!public_from_LAN"; / mencoba log dengan awalan = "!
public_from_LAN";
** note Fasttrack limitations for Queues and other facilities / ** Catatan Batasan Fasttrack
untuk Antrian dan fasilitas lainnya
IP firewall for the clients
• Drop incoming packets that are not NATed, / Jatuhkan paket masuk yang bukan
NATed,
• ether1 is public interface, log attempts with !NAT prefix; / ether1 adalah
antarmuka publik, coba login dengan awalan NAT!
• Drop incoming packets from Internet, which are not public IP addresses (rfc1918), /
Jatuhkan paket yang masuk dari Internet, yang bukan alamat IP publik (rfc1918),
• ether1 is public interface, / ether1 adalah antarmuka publik,
• log attempts with prefix="!public"; / mencoba log dengan awalan = "! publik";
• Drop packets from LAN that does not have LAN IP, / Jatuhkan paket dari LAN yang
tidak memiliki IP LAN,
• 192.168.88.0/24 is local network used subnet; / 192.168.88.0/24 adalah
jaringan lokal yang digunakan subnet;
MANAGEMENT
ACCESS
RouterOS services
• /ip service disable telnet,ftp,www,api,api-ssl
Change default ports
• /ip service set ssh port=2200
Restrict access by IP address
• /ip service set winbox address=192.168.88.0/24
Mac-server
RouterOS has built-in options for easy management access to network
devices even without IP configuration. On production networks the
particular services should be set to restricted access (e.g. only internal
interfaces) or disable entirely! / RouterOS memiliki opsi bawaan untuk akses
manajemen yang mudah ke perangkat jaringan bahkan tanpa konfigurasi IP.
Pada jaringan produksi, layanan tertentu harus disetel ke akses terbatas
(mis. Hanya antarmuka internal) atau nonaktifkan seluruhnya!

/tool mac-server set allowed-interface-list=none


/tool mac-server mac-winbox set allowed-interface-list=none
/tool mac-server ping set enabled=no
Bandwidth Test
Bandwidth test server is used to test throughput between two
RouterOS instances. It is recommended to disable it on a production
environment. / Server uji bandwidth digunakan untuk menguji
throughput antara dua instance RouterOS. Disarankan untuk
menonaktifkannya di lingkungan produksi.
/tool bandwidth-server set enabled=no
DNS Cache
DNS cache facility can be used to provide domain name resolution for the
router itself as well as for the clients connected to it.
In case the DNS cache is not required on your router or if another router is
used for such purposes, DNS cache should be disabled: / Fasilitas cache DNS
dapat digunakan untuk memberikan resolusi nama domain untuk router itu
sendiri serta untuk klien yang terhubung dengannya.
Jika cache DNS tidak diperlukan pada router Anda atau jika router lain
digunakan untuk tujuan tersebut, cache DNS harus dinonaktifkan:
/ip dns set allow-remote-requests=no

If DNS cache is left enabled be sure to protect UDP/53 on the input chain with
firewall rules / Jika cache DNS dibiarkan aktif pastikan untuk melindungi UDP /
53 pada rantai input dengan aturan firewall
Other Client Services
/ip proxy set enabled=no
/ip socks set enabled=no
/ip upnp set enabled=no
/ip cloud set ddns-enabled=no update-time=no
More Secure SSH - Strong-Crypto=Yes
Introduces following changes in the SSH configuration: /
Memperkenalkan perubahan berikut dalam konfigurasi SSH:
• Prefer 256 and 192 bit encryption instead of 128 bits
• Disable null encryption
• Prefer sha256 for hashing instead of sha1
• Disable md5
• Use 2048bit prime for Diffie Hellman exchange instead of
1024bit

/ip ssh set strong-crypto=yes


Unused interfaces
In order to protect from unauthorised access, it is considered good
practice to disable all unused interfaces on the router / Untuk
melindungi dari akses yang tidak sah, dianggap praktik yang baik
untuk menonaktifkan semua antarmuka yang tidak digunakan pada
router
BRIDGE
FIREWALL
Bridge Firewall

The bridge firewall implements packet filtering and thereby provides


security functions that are used to manage data flow to, from and
through bridge. / Firewall jembatan mengimplementasikan penyaringan
paket dan dengan demikian menyediakan fungsi keamanan yang
digunakan untuk mengelola aliran data ke, dari dan melalui jembatan.
Bridge Firewall
Bridge Firewall
Lab. Only PPPoE Traffic
Lab. Only PPPoE Traffic

R1 Setup (PPPoE Server)

/interface ethernet
set [ find default-name=ether1 ] name=E1-ToBridge

/ip address
add address=192.168.100.1/30 interface=E1-ToBridge
network=192.168.100.0
Lab. Only PPPoE Traffic
/interface pppoe-server server
add disabled=no interface=E1-ToBridge

/ppp secret
add local-address=10.100.100.1 name=test password=test \
remote-address=10.200.200.2 service=pppoe

/system identity
set name=R1
Lab. Only PPPoE Traffic

R3 Setup (PPPoE Client)

/interface ethernet
set [ find default-name=ether1 ] name=E1-ToBridge

/interface pppoe-client
add disabled=no interface=E1-ToBridge name=test password=test \
user=test

/ip address
add address=192.168.100.2/30 interface=E1-ToBridge \
network=192.168.100.0

/system identity set name=R3


Lab. Only PPPoE Traffic

Bridge Setup

/interface bridge
add name=bridge1

/interface ethernet
set [ find default-name=ether2 ] name=E2-ToR1
set [ find default-name=ether3 ] name=E3-ToR3

/interface bridge filter


add action=accept chain=forward mac-protocol=pppoe
add action=accept chain=forward mac-protocol=pppoe-discovery
add action=drop chain=forward

/interface bridge port


add bridge=bridge1 interface=E2-ToR1
add bridge=bridge1 interface=E3-ToR3

/system identity
set name=Bridge
ICMP FILTERING
What is ICMP Filtering
• ICMP helps networks to cope with communication problems / ICMP
membantu jaringan untuk mengatasi masalah komunikasi
• No authentication method; can be used by hackers to crash computers on
the network / Tidak ada metode otentikasi; dapat digunakan oleh peretas
untuk membuat crash komputer di jaringan
• Firewall/packet filter must be able to determine, based on its message
type, whether an ICMP packet should be allowed to pass / Firewall / filter
paket harus dapat menentukan, berdasarkan pada jenis pesannya, apakah
paket ICMP harus diizinkan untuk lulus
ICMPv4 FILTERING
Table Filtering Recommendations

ICMPv4 Message Sourced from Through Destined to


Device Device Device
ICMPv4-unreach-net Limit rate Limit rate Limit rate

ICMPv4-unreach-host Limit rate Limit rate Limit rate

ICMPv4-unreach-proto Limit rate Deny Limit rate

ICMPv4-unreach-port Limit rate Deny Limit rate

ICMPv4-unreach-frag-needed Send Permit Limit rate

ICMPv4-unreach-src-route Limit rate Deny Limit rate

ICMPv4-unreach-net-unknown (Depr) Deny Deny Deny

ICMPv4-unreach-host-unknown Limit rate Deny Ignore

ICMPv4-unreach-host-isolated (Depr) Deny Deny Deny

ICMPv4-unreach-net-tos Limit rate Deny Limit rate

Recommendations for ICMPv4


Table Filtering Recommendations

ICMPv4 Message Sourced from Through Destined to


Device Device Device
ICMPv4-unreach-host-tos Limit rate Deny Limit rate
ICMPv4-unreach-admin Limit rate Limit rate Limit rate
ICMPv4-unreach-prec-violation Limit rate Deny Limit rate
ICMPv4-unreach-prec-cutoff Limit rate Deny Limit rate
ICMPv4-quench Deny Deny Deny
ICMPv4-redirect-net Limit rate Deny Limit rate
ICMPv4-redirect-host Limit rate Deny Limit rate
ICMPv4-redirect-tos-net Limit rate Deny Limit rate
ICMPv4-redirect-tos-host Limit rate Permit Limit rate
ICMPv4-timed-ttl Limit rate Permit Limit rate

Recommendations for ICMPv4


Table Filtering Recommendations

ICMPv4 Message Sourced from Through Destined to


Device Device Device
ICMPv4-timed-reass Limit rate Permit Limit rate
ICMPv4-parameter-pointer Limit rate Deny Limit rate
ICMPv4-option-missing Limit rate Deny Limit rate
ICMPv4-req-echo-message Limit rate Permit Limit rate
ICMPv4-req-echo-reply Limit rate Permit Limit rate
ICMPv4-req-router-sol Limit rate Deny Limit rate
ICMPv4-req-router-adv Limit rate Deny Limit rate
ICMPv4-req-timestamp-message Limit rate Deny Limit rate
ICMPv4-req-timestamp-reply Limit rate Deny Limit rate
ICMPv4-info-message (Depr) Deny Deny Deny

Recommendations for ICMPv4


Table Filtering Recommendations

ICMPv4 Message Sourced from Through Destined to


Device Device Device
ICMPv4-info-reply (Depr) Deny Deny Deny
ICMPv4-mask-request Limit rate Deny Limit rate
ICMPv4-mask-reply Limit rate Deny Limit rate

Recommendations for ICMPv4


ICMPv4 Error Messages
• Echo Reply (Type 0, Code 0)
• Destination Unreachable (Type 3)
• Net Unreachable (Code 0)
• Host Unreachable (Code 1)
• Protocol Unreachable (Code 2)
• Port Unreachable (Code 3)
• Fragmentation Needed and DF Set (Code 4)
• Source Route Failed (Code 5)
• Destination Network Unknown (Code 6) (Deprecated)
• Destination Host Unknown (Code 7)
• Source Host Isolated (Code 8) (Deprecated)
• Communication with Destination Network Administratively
Prohibited (Code 9) (Deprecated)
ICMPv4 Error Messages
• Destination Unreachable (Type 3)
• Communication with Destination Host Administratively
Prohibited (Code 10) (Deprecated)
• Network Unreachable for Type of Service (Code 11)
• Host Unreachable for Type of Service (Code 12)
• Communication Administratively Prohibited (Code 13)
• Host Precedence Violation (Code 14)
• Precedence Cutoff in Effect (Code 15)
ICMPv4 Error Messages

• Source Quench (Type 4, Code 0)


• Redirect (Type 5)
• Redirect Datagrams for the Network (Code 0)
• Redirect Datagrams for the Host (Code 1)
• Redirect datagrams for the Type of Service and Network (Code 2)
• Redirect Datagrams for the Type of Service and Host (Code 3)
• Time Exceeded (Type 11)
• Time to Live Exceeded in Transit (Code 0)
• Fragment Reassembly Time Exceeded (Code 1)
ICMPv4 Error Messages
• Parameter Problem (Type 12)
• Pointer Indicates the Error (Code 0)
• Required Option is Missing (Code 1)
ICMPv4 Informational Messages
• Echo or Echo Reply Message
• Echo Message (Type 8, Code 0)
• Echo Reply Message (Type 0, Code 0)
• Router Solicitation or Router Advertisement message
• Router Solicitation Message (Type 10, Code 0)
• Router Advertisement Message (Type 9, Code 0)
• Timestamp or Timestamp Reply Message
• Timestamp Message (Type 13, Code 0)
• Timestamp Reply Message (Type 14, Code 0)
ICMPv4 Informational Messages
• Information Request or Information Reply Message (Deprecated)
• Information Request Message (Type 15, Code 0)
• Information Reply Message (Type 16, Code 0)
• Address Mask Request or Address Mask Reply
• Address Mask Request (Type 17, Code 0)
• Address Mask Reply (Type 18, Code 0)
How the ICMP Filtering Works
How the ICMP Filtering Works

/ip firewall filter


add action=jump chain=forward jump-target=icmp
add action=accept chain=icmp comment="echo reply" icmp-options=0:0 protocol=icmp
add action=accept chain=icmp comment="net unreachable" icmp-options=3:0 protocol=icmp
add action=accept chain=icmp comment="host unreachable" icmp-options=3:1 protocol=icmp
add action=accept chain=icmp comment="host unreachable fragmentation required" \
icmp-options=3:4 protocol=icmp
add action=accept chain=icmp comment="allow source quench" icmp-options=4:0 protocol=icmp
add action=accept chain=icmp comment="allow echo request" icmp-options=8:0 protocol=icmp
add action=accept chain=icmp comment="allow time exceed" icmp-options=11:0 protocol=icmp
add action=accept chain=icmp comment="allow parameter bad" icmp-options=12:0 protocol=icmp
add action=drop chain=icmp comment="deny all other types"
Module 3
OSI LAYER
ATTACKS
MikroTik Neighbor Discovery Protocol
• MikroTik Neighbor Discovery protocol (MNDP) allows to "find" other devices
compatible with MNDP or CDP (Cisco Discovery Protocol) or LLDP in Layer2
broadcast domain. / MikroTik Neighbor Discovery protocol (MNDP)
memungkinkan untuk "menemukan" perangkat lain yang kompatibel dengan
MNDP atau CDP (Cisco Discovery Protocol) atau LLDP dalam domain broadcast
Layer2.
• works on interfaces that support IP protocol and have at least one IP address and
on all ethernet-like interfaces even without IP addresses / bekerja pada antarmuka
yang mendukung protokol IP dan memiliki setidaknya satu alamat IP dan pada
semua antarmuka seperti ethernet bahkan tanpa alamat IP
• is enabled by default for all new ethernet-like interfaces / diaktifkan secara default
untuk semua antarmuka seperti ethernet baru
• uses UDP protocol port 5678 / menggunakan port protokol UDP 5678
MNDP Attack
• This tool (yersinia) will be sending a lot of “fake” CDP neighbors to the
RouterOS device. / Alat ini (yersinia) akan mengirim banyak tetangga CDP
"palsu" ke perangkat RouterOS.
MNDP Attack
• RouterOS is receiving information about thousands of “fake” neighbor
devices. / RouterOS menerima informasi tentang ribuan perangkat
tetangga yang "palsu".
MNDP Attack

• It’s exhausting the resources of


the router and impacting the
performance / Ini melelahkan
sumber daya router dan
berdampak pada kinerja

tool profile freeze-frame-interval=1

system resource cpu print


Preventing MNDP Attacks

• To prevent such attacks we must select which interfaces can


communicate using MNDP/CDP/LLDP. / Untuk mencegah
serangan seperti itu, kita harus memilih antarmuka mana
yang dapat berkomunikasi menggunakan MNDP / CDP / LLDP.
• Creating “interface-list” and selecting which interfaces to
enable neighbor discovery on (MNDP) / Membuat "daftar
antarmuka" dan memilih antarmuka mana yang
memungkinkan penemuan tetangga aktif (MNDP)
MNDP Attack

• Creating “interface-list” for accessing MikroTik Neighbor


Discovery Protocol / Membuat "antarmuka-daftar" untuk
mengakses Protokol MikroTik Neighbor Discovery

/interface list add name=NEIGHBOR


/interface list member
add interface=etherX list=NEIGHBOR
add interface=etherY list=NEIGHBOR
MNDP Attack
• IP > Neighbors and set Discovery Settings to previous
“interface-list been made. / IP> Tetangga dan atur Pengaturan
Penemuan ke “antarmuka-daftar sebelumnya telah dibuat.

/ip neighbor discovery-settings set discover-interface-list=NEIGHBOR


DHCP Starvation Attack

• An attack that works by broadcasting DHCP requests with spoofed MAC


addresses. / Serangan yang berfungsi dengan menyiarkan permintaan
DHCP dengan alamat MAC palsu.
• DHCP starvation attack targets DHCP servers whereby forged DHCP
requests are crafted by an attacker with the intent of exhausting all
available IP addresses that can be allocated by the DHCP server / Target
serangan kelaparan DHCP menargetkan server DHCP di mana permintaan
DHCP yang dibuat dibuat oleh penyerang dengan maksud melelahkan
semua alamat IP yang tersedia yang dapat dialokasikan oleh server DHCP
DHCP Starvation Attack
• This tool (yersinia) sends multiple “fake” DHCP requests to the router /
Alat ini (yersinia) mengirimkan beberapa permintaan DHCP "palsu" ke
router
DHCP Starvation Attack

• Attacker exhausts DHCP leases with multiple dhcp-requests to


the router. / Penyerang membuang sewa DHCP dengan
beberapa permintaan dhcp ke router.
Preventing DHCP Starvation Attacks
• Attacker uses a new MAC address to request a new DHCP lease /
Penyerang menggunakan alamat MAC baru untuk meminta sewa DHCP
baru
• Restrict the number of MAC addresses on the port of switch. / Batasi
jumlah alamat MAC pada port switch.
• Will not be able to lease more IP addresses than MAC addresses allowed
on the port / Tidak akan dapat menyewakan lebih banyak alamat IP
daripada alamat MAC yang diizinkan pada port
port-security
Router max 1 MAC
port-security
max 1 MAC
Rogue DHCP server

• A rogue DHCP server is a DHCP server on a network which is


not under the administrative control. / Server DHCP jahat
adalah server DHCP di jaringan yang tidak berada di bawah
kendali administratif.
• It is set up on a network by an attacker, for taking advantage
from clients. / Itu diatur pada jaringan oleh penyerang, untuk
mengambil keuntungan dari klien.
Rogue DHCP server
Rogue DHCP server

• Server IP – the IP server, the name of which will send the answer the
DHCP (xxx.xxx.xxx.xxx);
• Start IP – initiaIP, , issued to customers -address address range
(xxx.xxx.xxx.xxx);
• End IP – IP , issued to customers -address address range (xxx.xxx.xxx.xxx);
• Time The Lease (secs) – The time in seconds for which the address is given
• Time The Renew (secs) – The time in seconds how many clients must
renew the address lease
• Subnet Mask – Subnet mask for the clients (xxx.xxx.xxx.xxx);
• Router – router address issued to clients (xxx.xxx.xxx.xxx ,the address of a
fake router);
• DNS Server – DNS server provided to clients (xxx.xxx.xxx.xxx ,the address
of a fake DNS server);
• The Domain – a domain name in the local area network ( abc.def );
Preventing Rogue DHCP
• Enable DHCP Snooping on the switch / Aktifkan DHCP Mengintip pada sakelar
• Make port facing router as DHCP Snooping Trusted / Jadikan port menghadap router sebagai
DHCP Snooping Tepercaya
• Binding Address and MAC for known clients / Alamat Binding dan MAC untuk klien yang
dikenal
• RouterOS DHCP alert is ONLY sending information, not stopping or preventing an attack. /
Peringatan RouterOS DHCP HANYA mengirim informasi, tidak menghentikan atau mencegah
serangan.
DHCP Snooping enabled

Router trusted untrusted


untrusted

https://wiki.mikrotik.com/wiki/Manual:Interface/Bridge#DHCP_Snooping_and_DHCP_Option_82
TCP SYN Attack

SYN

SYN-ACK

• This type of attack takes advantage of the three-way handshake to establish


communication / Jenis serangan ini memanfaatkan jabat tangan tiga arah untuk
membangun komunikasi
• In SYN flooding, the attacker send the target a large number of TCP/SYN packets. /
Dalam flooding SYN, penyerang mengirim target sejumlah besar paket TCP / SYN.
• These packets have a source address, and the target computer replies (TCP/SYN-
ACK packet) back to the source IP, trying to establish a TCP connection / Paket-
paket ini memiliki alamat sumber, dan komputer target membalas (paket TCP /
SYN-ACK) kembali ke IP sumber, mencoba untuk membuat koneksi TCP
TCP SYN Attack

• Scanning available ports on target, commonly used target is


80/http service
TCP SYN Attack

• Download and install “hping3” and run command bellow


TCP SYN Attack
• “IP > Firewall > Connections” please observe the “syn sent”
from random source addresses / “IP> Firewall> Connections”
harap perhatikan “syn terkirim” dari alamat sumber acak
TCP SYN Attack

• Torch interface traffic


TCP SYN Attack
• The attack is exhausting the resources of the router and impacting the
performance / Serangan itu menghabiskan sumber daya router dan
berdampak pada kinerja

tool profile freeze-frame-interval=1


system resource cpu print
Preventing TCP SYN Attack

• Rate-limiting for each new tcp connection / Pembatasan nilai


untuk setiap koneksi tcp baru
• Reduce syn-received timer / Kurangi timer yang diterima
secara syn
• And setup tcp syn-cookies / Dan pengaturan tcp syn-cookies
Preventing TCP SYN Attack
• Creating firewall for preventing tcp SYN flood / Membuat
firewall untuk mencegah banjir tcp SYN

/ip firewall filter


add action=jump chain=forward comment="SYN Flood protect FORWARD" connection-state=new jump-
target=syn-attack protocol=tcp tcp-flags=syn
add action=jump chain=input comment="SYN Flood protect INPUT" connection-state=new jump-target=syn-
attack protocol=tcp tcp-flags=syn
add action=accept chain=syn-attack connection-state=new limit=400,5:packet protocol=tcp tcp-flags=syn
add action=drop chain=syn-attack connection-state=new protocol=tcp tcp-flags=syn
Preventing TCP SYN Attack

• IP > Settings and enable “TCP


SynCookies”

/ip settings set tcp-syncookies=yes


TCP SYN Attack

• Run hping3 again


Preventing TCP SYN Attack
• These rules are stopping the tcp SYN attack, but still affecting the CPU
resources. (need more powerful router for preventing) / Aturan-aturan ini
menghentikan serangan SYN tcp, tetapi masih mempengaruhi sumber daya
CPU. (perlu router yang lebih kuat untuk mencegah)
UDP Flood Attack
• An UDP flood does not exploit any vulnerability. / Banjir UDP
tidak mengeksploitasi kerentanan apa pun.
• The aim of UDP floods is creating and sending large amount
of UDP datagrams from spoofed IP’s to the target server. /
Tujuan dari banjir UDP adalah membuat dan mengirim
sejumlah besar datagram UDP dari IP palsu ke server target.
• When a server receives this type of traffic, it is unable to
process every request and it consumes its bandwidth with
sending ICMP “destination unreachable” packets. / Ketika
server menerima jenis lalu lintas ini, ia tidak dapat
memproses setiap permintaan dan menghabiskan
bandwidthnya dengan mengirimkan paket ICMP "destination
unreachable".
UDP Flood Attack
• Scanning available port on target, commonly used target is
53/dns service / Memindai port yang tersedia pada target,
target yang umum digunakan adalah layanan 53 / dns
UDP Flood Attack

• Start attacking UDP protocol port 53(dns) with hping3


UDP Flood Attack
• “IP > Firewall > Connections” please observe “udp” protocol
from random source addresses / "IP> Firewall> Connections"
mohon perhatikan protokol "udp" dari alamat sumber acak
UDP Flood Attack

• Torch interface traffic


UDP Flood Attack

• The attack is exhausting the resources of the router and


impacting the performance / Serangan itu menghabiskan
sumber daya router dan berdampak pada kinerja
Preventing UDP Flood Attack

• Disable DNS forwarder on MikroTik if not required. /


Nonaktifkan DNS forwarder di MikroTik jika tidak diperlukan.
• If “IP -> DNS” – Allow remote request is enabled, make sure
appropriate filter rule is set to prevent incoming DNS attacks.
/ Jika "IP -> DNS" - Izinkan permintaan jarak jauh diaktifkan,
pastikan aturan filter yang tepat diatur untuk mencegah
serangan DNS yang masuk.
• Rate-limiting for each new udp connection. / Pembatasan
nilai untuk setiap koneksi udp baru.
Preventing UDP Flood Attack

• Uncheck Allow Remote


Requests on router / Hapus
centang Izinkan Permintaan
Jarak Jauh pada router
Preventing UDP Flood Attack

• Block dns request “udp/53” traffic from outside / Blok dns


meminta lalu lintas “udp / 53” dari luar

/interface list add name=OUTSIDE


/interface list member add interface=ether3-internet list=OUTSIDE

/ip firewall raw add action=drop chain=prerouting dst-port=53 in-interface-list=OUTSIDE protocol=udp


Preventing UDP Flood Attack
• Rate-limiting every udp/53 packet requests / Batas-
membatasi setiap permintaan paket udp / 53

/ip firewall raw


add action=accept chain=prerouting dst-port=53 in-interface-list=!OUTSIDE limit=100,5:packet protocol=udp
add action=drop chain=prerouting dst-port=53 in-interface-list=!OUTSIDE protocol=udp
ICMP Smurf Attack
• This type of attack uses large amount of Internet Control Message
Protocol (ICMP) ping traffic targeted at an Internet Broadcast Address e.g
192.168.1.255. / Jenis serangan ini menggunakan sejumlah besar lalu
lintas ping Protokol Pesan Kontrol Internet (ICMP) yang ditargetkan pada
Alamat Siaran Internet, mis. 192.168.1.255.
• The reply IP address is spoofed to that of the intended victim e.g 1.2.3.4 /
Alamat IP balasan dipalsukan dengan alamat korban yang dimaksud mis.
1.2.3.4
• All the replies are sent to the victim instead of the IP used for the pings. /
Semua balasan dikirim ke korban, bukan IP yang digunakan untuk ping.
• Since a single Internet Broadcast Address can support a maximum of 255
hosts, a smurf attack amplifies a single ping 255 times. / Karena satu
Alamat Siaran Internet dapat mendukung maksimal 255 host, serangan
smurf menguatkan ping tunggal 255 kali.
ICMP Smurf Attack

• Start attacking ICMP smurf with random source


ICMP Smurf Attack

• All of attacker’s traffic as a destination address has the broadcast address of the
network / Semua lalu lintas penyerang sebagai alamat tujuan memiliki alamat
broadcast jaringan
ICMP Smurf Attack
ICMP Smurf Attack
• The attack is exhausting the resources of the router and
impacting the performance / Serangan itu menghabiskan
sumber daya router dan berdampak pada kinerja
Preventing ICMP Smurf Attack

• Configure routers not to forward or accept packets directed to


broadcast addresses. / Konfigurasikan router untuk tidak
meneruskan atau menerima paket yang diarahkan ke alamat
broadcast.
• Configure individual hosts or routers to not respond to ping
requests from outside / Konfigurasikan setiap host atau router
untuk tidak menanggapi permintaan ping dari luar
Preventing ICMP Smurf Attack

/ip firewall filter


add action=drop chain=input dst-address-type=broadcast icmp-options=0:0-255 protocol=icmp
add action=drop chain=input in-interface-list=OUTSIDE protocol=icmp
Password Brute Force Attack
• A brute force attack is a trial-and-error method used to obtain
information such as a users password or any other credential
information. / Serangan brute force adalah metode coba-coba
yang digunakan untuk mendapatkan informasi seperti kata
sandi pengguna atau informasi kredensial lainnya.
• In a brute force attack, automated software is used to
generate a large number of consecutive guesses as to the
value of the desired data. / Dalam serangan brute force,
perangkat lunak otomatis digunakan untuk menghasilkan
sejumlah besar tebakan berturut-turut mengenai nilai data
yang diinginkan.
Password Brute Force Attack

• Router under SSH Brute Force Attack


Password Brute Force Attack

• Router under Telnet Brute Force Attack


Preventing Brute Force Attack

• Limiting the number of times a user can unsuccessfully


attempt to log in / Membatasi berapa kali seorang pengguna
gagal mencoba masuk
• Temporarily locking out users who exceed the specified
maximum number of failed login attempts / Mengunci
sementara pengguna yang melebihi jumlah maksimum yang
ditentukan dari upaya login gagal
• Requiring users to create complex passwords / Mengharuskan
pengguna untuk membuat kata sandi yang rumit
• Periodically changing a password / Mengubah kata sandi
secara berkala
Preventing Brute Force Attack
Preventing Brute Force Attack

/ip firewall filter


add action=drop chain=input comment="Drop SSH Brute Forcers" dst-port=22 protocol=tcp \
src-address-list=brute-force_blacklist
add action=add-src-to-address-list address-list=brute-force_blacklist address-list-timeout=1d chain=input \
connection-state=new dst-port=22,23 protocol=tcp src-address-list=bruteforce_stage3
add action=add-src-to-address-list address-list=bruteforce_stage3 address-list-timeout=30s chain=input \
connection-state=new dst-port=22,23 protocol=tcp src-address-list=bruteforce_stage2
add action=add-src-to-address-list address-list=bruteforce_stage2 address-list-timeout=30s chain=input \
connection-state=new dst-port=22,23 protocol=tcp src-address-list=bruteforce_stage1
add action=add-src-to-address-list address-list=bruteforce_stage1 address-list-timeout=1m chain=input \
connection-state=new dst-port=22,23 protocol=tcp
Port Scanner Detection

• A port scan is a method for determining which ports on a network are open or
available. / Scan port adalah metode untuk menentukan port mana pada jaringan
yang terbuka atau tersedia.
• Running a port scan on a network or server reveals which ports are open and
listening (receiving information) / Menjalankan pemindaian port pada jaringan
atau server mengungkapkan port mana yang terbuka dan mendengarkan
(menerima informasi)
• Port Scan tools (like NMAP) can detect what version of an application is running on
a port / Port Scan tools (seperti NMAP) dapat mendeteksi versi aplikasi apa yang
berjalan pada port
• Port scanning is the “gate” for starting an attack or penetration to your networks /
Pemindaian port adalah "gerbang" untuk memulai serangan atau penetrasi ke
jaringan Anda
Port Scanner Detection

• Scanning available ports on the target


Preventing Port Scanner
• Create Port Scanner Detection on router and block the
address / Buat Port Scanner Detection pada router dan blokir
alamatnya
Preventing Port Scanner

/ip firewall filter


add action=drop chain=input src-address-list="port scanners"
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="Port scanners to list " protocol=tcp psd=21,3s,3,1
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="NMAP FIN Stealth scan" protocol=tcp tcp-flags=\
fin,!syn,!rst,!psh,!ack,!urg
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="SYN/FIN scan" protocol=tcp tcp-flags=fin,syn
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="SYN/RST scan" protocol=tcp tcp-flags=syn,rst
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="FIN/PSH/URG scan" protocol=tcp tcp-flags=\
fin,psh,urg,!syn,!rst,!ack
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="ALL/ALL scan" protocol=tcp tcp-flags=\
fin,syn,rst,psh,ack,urg
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input
comment="NMAP NULL scan" protocol=tcp tcp-flags=\
!fin,!syn,!rst,!psh,!ack,!urg
Module 4
CRYPTOGRAPHY
What is Cryptography
• Cryptography is the "ART" of creating documents that can be shared secretly over public
communication. / Kriptografi adalah "ART" untuk membuat dokumen yang dapat dibagikan
secara diam-diam melalui komunikasi publik.
• Traditionally, cryptography refers to : / Secara tradisional, kriptografi mengacu pada:
• The practice and the study of encryption. / Praktik dan studi enkripsi.
• Transforming information in order to prevent unauthorized people to read it. /
Mengubah informasi untuk mencegah orang yang tidak berhak membacanya.
• But today, cryptography goes beyond encryption/decryption to include : / Tetapi hari ini,
kriptografi melampaui enkripsi / dekripsi untuk memasukkan:
• Techniques for making sure that encrypted messages are not modified. / Teknik untuk
memastikan bahwa pesan terenkripsi tidak diubah.
• Techniques for secure identification/authentication of communication partners. /
Teknik untuk identifikasi / otentikasi yang aman dari mitra komunikasi.
Security Mechanisms
Encryption :
• Process of transforming plaintext to ciphertext using a cryptographic key / Proses
mengubah plaintext menjadi ciphertext menggunakan kunci kriptografi
• Used all around us / Digunakan di sekitar kita
• In Application Layer – used in secure email, database sessions, and messaging / Dalam
Lapisan Aplikasi - digunakan dalam email yang aman, sesi basis data, dan pengiriman
pesan
• In session layer – using Secure Socket Layer (SSL) or Transport Layer Security (TLS) /
Dalam lapisan sesi - menggunakan Secure Socket Layer (SSL) atau Transport Layer
Security (TLS)
• In the Network Layer – using protocols such as Ipsec / Di Lapisan Jaringan -
menggunakan protokol seperti IPsec
• Benefits of good encryption algorithm: / Manfaat dari algoritma enkripsi yang
baik:
• Resistant to cryptographic attack / Tahan terhadap serangan kriptografis
• They support variable and long key lengths and scalability / Mereka mendukung
panjang kunci dan skalabilitas variabel dan panjang
• They create an avalanche effect / Mereka menciptakan efek longsoran salju
• No export or import restrictions / Tidak ada batasan ekspor atau impor
Terminology
plaintext (P) : the original message / plaintext (P): pesan aslinya
ciphertext (C) : the coded message / ciphertext (C): pesan kode
cipher : algorithm for transforming plaintext to cipher text / cipher: algoritme untuk mengubah
teks teks menjadi teks sandi
key (k) : info used in cipher known only to sender/receiver / key (k): info yang digunakan dalam
sandi hanya diketahui oleh pengirim / penerima
encipher/encrypt (e) : converting plaintext to cipher text / encipher / mengenkripsi (e): mengubah plaintext
menjadi teks sandi
decipher/decrypt (d) : recovering cipher text from plaintext / decipher / decrypt (d): memulihkan teks sandi
dari plaintext
cryptography : study of encryption principles/methods / kriptografi: studi tentang prinsip / metode
enkripsi
cryptanalysis : the study of principles/ methods of deciphering / cryptanalysis: studi tentang prinsip /
metode penguraian
cipher text without knowing key / teks sandi tanpa mengetahui kunci
cryptology : the field of both cryptography and cryptanalysis / kriptologi: bidang kriptografi dan
kriptanalisis
Encryption Methods
There are 2 kinds of encryption methods : / Ada 2 jenis metode enkripsi:
• Symmetric cryptography / Kriptografi simetris
• Sender and receiver keys are identical / Kunci pengirim dan penerima
identik
• Asymmetric (public-key) cryptography / Kriptografi asimetris (kunci publik)
• Encryption key (public), decryption key secret (private) / Kunci enkripsi
(publik), rahasia kunci dekripsi (pribadi)
Symmetric Encryption
• Uses a single key to both encrypt and decrypt information / Menggunakan satu
kunci untuk mengenkripsi dan mendekripsi informasi
• Also known as a secret-key algorithm / Juga dikenal sebagai algoritma kunci-
rahasia
• The key must be kept a “secret” to maintain security / Kuncinya harus dijaga "rahasia"
untuk menjaga keamanan
• This key is also known as a private key / Kunci ini juga dikenal sebagai kunci pribadi
• Follows the more traditional form of cryptography with key lengths ranging from
40 to 256 bits / Mengikuti bentuk kriptografi yang lebih tradisional dengan
panjang kunci mulai dari 40 hingga 256 bit
Symmetric Key Algorithms
Asymmetric Encryption
• Also called public-key cryptography / Juga disebut kriptografi kunci publik
• Keep private key private / Kunci pribadi tetap pribadi
• Anyone can see public key / Siapa pun dapat melihat kunci publik
• Separate keys for encryption and decryption (public and private key pairs) / Kunci
terpisah untuk enkripsi dan dekripsi (pasangan kunci publik dan pribadi)
• Examples of asymmetric key algorithms: / Contoh algoritma kunci asimetris:
• RSA, DSA, Diffie-Hellman, El Gamal, Elliptic Curve and PKCS / RSA, DSA,
Diffie-Hellman, El Gamal, Kurva Elliptic dan PKCS
Asymmetric Encryption
• RSA : the first and still most common implementation / RSA:
implementasi pertama dan masih paling umum
• DSA : specified in NIST’s Digital Signature Standard (DSS), provides digital
signature capability for authentication of messages / DSA: ditentukan
dalam Digital Signature Standard (DSS) NIST, menyediakan kemampuan
tanda tangan digital untuk otentikasi pesan
• Diffie-Hellman : used for secret key exchange only, and not for
authentication or digital signature / Diffie-Hellman: digunakan untuk
pertukaran kunci rahasia saja, dan bukan untuk otentikasi atau tanda
tangan digital
• ElGamal : similar to Diffie-Hellman and used for key exchange / ElGamal:
mirip dengan Diffie-Hellman dan digunakan untuk pertukaran kunci
• PKCS : set of interoperable standards and guidelines / PKCS: serangkaian
standar dan pedoman yang dapat dioperasikan
Public Key Infrastructure (PKI)
• Framework that builds the network of trust / Kerangka kerja yang membangun
jaringan kepercayaan
• Combines public key cryptography, digital signatures, to ensure confidentiality,
integrity, authentication, non-repudiation, and access control / Menggabungkan
kriptografi kunci publik, tanda tangan digital, untuk memastikan kerahasiaan,
integritas, otentikasi, non-repudiation, dan kontrol akses
• Protects applications that require high level of security / Melindungi aplikasi yang
membutuhkan tingkat keamanan tinggi

Functions of a PKI :
• Registration / Registrasi • Key generation / Generasi
• Initialization / Inisialisasi kunci
• Certification / Sertifikasi • Key update / Pembaruan
• Key pair recovery / kunci
Pemulihan pasangan • Cross-certification /
kunci Sertifikasi silang
• Revocation / Pencabutan
Components of a PKI

• Certificate authority / Otoritas sertifikat


• The trusted third party / Pihak ketiga yang dipercaya
• Trusted by both the owner of the certificate and the party relying upon the certificate.
/ Dipercaya oleh kedua pemilik sertifikat dan partai mengandalkan sertifikat.
• Validation authority / Otoritas validasi
• Registration authority / Otoritas Registrasi
• For big CAs, a separate RA might be necessary to take some work off the CA / Untuk
CA besar, RA terpisah mungkin diperlukan untuk mengambil beberapa pekerjaan dari
CA
• Identity verification and registration of the entity applying for a certificate / Verifikasi
identitas dan pendaftaran entitas yang mengajukan sertifikat
• Central directory / Direktori pusat
CERTIFICATES
Certificates
• Public key certificates bind public key values to subjects / Sertifikat kunci publik
mengikat nilai kunci publik ke subjek
• A trusted certificate authority (CA) verifies the subject’s identity and digitally sign
each certificate / Otoritas sertifikat tepercaya (CA) memverifikasi identitas subjek
dan menandatangani secara digital setiap sertifikat
• Validates / Validasi
• Has a limited valid lifetime / Memiliki masa berlaku yang terbatas
• Can be used using untrusted communications and can be cached in unsecured
storage / Dapat digunakan menggunakan komunikasi yang tidak terpercaya dan
bisa di-cache dalam penyimpanan yang tidak aman
• Because client can independently check the certificate’s signature / Karena klien dapat
secara independen memeriksa tanda tangan sertifikat
• Certificate is NOT equal to signature / Sertifikat TIDAK sama dengan tanda tangan
• It is implemented using signature / Itu diimplementasikan menggunakan tanda tangan
• Certificates are static / Sertifikat bersifat statis
• If there are changes, it has to be re-issued / Jika ada perubahan, itu harus dikeluarkan
kembali
Digital Certificates
• Digital certificate – basic element of PKI; secure
credential that identifies the owner / Sertifikat digital
- elemen dasar PKI; kredensial aman yang
mengidentifikasi pemilik
• Also called public key certificate / Juga disebut
sertifikat kunci publik
• Deals with the problem of / Berurusan dengan
masalah
• Binding a public key to an entity / Mengikat kunci
publik ke suatu entitas
• A major legal issue related to e-commerce / Masalah
hukum utama terkait dengan perdagangan elektronik
• A digital certificate contains : / Sertifikat digital berisi:
• User’s public key / Kunci publik pengguna
• User’s ID / ID pengguna
• Other information e.g. validity period / Informasi lain mis. masa berlaku
Digital Certificates
• Certificate examples : / Contoh sertifikat:
• X509 (standard) / X509 (standar)
• PGP (Pretty Good Privacy) / PGP (Privasi Cukup Bagus)
• Certificate Authority (CA) creates and digitally signs certificates / Certificate Authority
(CA) membuat dan menandatangani sertifikat secara digital
• To obtain a digital certificate, Alice must : / Untuk mendapatkan sertifikat digital,
Alice harus:
• Make a certificate signing request to the CA / Buat permintaan penandatanganan
sertifikat ke CA
• CA returns Alice’s digital certificate, cryptographically binding her identity to
public key : / CA mengembalikan sertifikat digital Alice, yang secara kriptografis
mengikat identitasnya ke kunci publik:
• CertA = {IDA, KA_PUB, info, SigCA(IDA,KA_PUB,info)}

wiki.apnictraining.net/_media/apnic44/apnic44-crypto_pgp.pdf, slide #55


X.509
• An ITU-T standard for a public key infrastructure (PKI) and Privilege
Management Infrastructure (PMI) / Standar ITU-T untuk infrastruktur
kunci publik (PKI) dan Infrastruktur Manajemen Privilege (PMI)
• Assumes a strict hierarchical system of Certificate Authorities (CAs) /
Mengasumsikan sistem hierarki ketat Otoritas Sertifikat (CA)
• RFC 1422 – basis of X.509-based PKI / RFC 1422 - basis PKI berbasis X.509
• Current version X.509v3 provides a common baseline for the Internet /
Versi saat ini X.509v3 menyediakan dasar umum untuk Internet
• Structure of a certificate, certificate revocation (CRLs) / Struktur
sertifikat, pencabutan sertifikat (CRL)
X.509
X.509 Certificate Usage: / Penggunaan Sertifikat
X.509:
• Fetch certificate / Ambil sertifikat
• Fetch certificate revocation list (CRL) /
Ambil daftar pencabutan sertifikat
(CRL)
• Check the certificate against the CRL /
Periksa sertifikat terhadap CRL
• Check signature using the certificate /
Periksa tanda tangan menggunakan
sertifikat
Every Certificate Contains
• Body of the certificate / Badan sertifikat
• Version number, serial number, names of the issuer and subject / Nomor versi, nomor
seri, nama penerbit dan subjek
• Public key associated with the subject / Kunci publik yang terkait dengan subjek
• Expiration date (not before, not after) / Tanggal kedaluwarsa (bukan sebelum, bukan
setelah)
• Extensions for additional tributes / Ekstensi untuk upeti tambahan
• Signature algorithm / Algoritme tanda tangan
• Used by the CA to sign the certificate / Digunakan oleh CA untuk menandatangani
sertifikat
• Signature / Tanda Tangan
• Created by applying the certificate body as input to a one-way hash function. The
output value is encrypted with the CA’s private key to form the signature value /
Dibuat dengan menerapkan badan sertifikat sebagai input ke fungsi hash satu arah.
Nilai output dienkripsi dengan kunci pribadi CA untuk membentuk nilai tanda tangan
Certificate Authority
• Issuer and signer of the certificate / Penerbit dan penandatangan sertifikat
• Trusted (Third) Party / Pihak Tepercaya (Ketiga)
• Based on trust model / Berdasarkan model kepercayaan
• Who to trust? / Siapa yang harus dipercaya?
• Types: / Jenis:
• Enterprise CA / Enterprise CA
• Individual CA (PGP) / Individual CA (PGP)
• Global CA (such as VeriSign) / Global CA (seperti VeriSign)
• Functions : / Fungsi:
• Enrols and Validates Subscribers / Enrols dan Validasikan Pelanggan
• Issues and Manages Certificates / Masalah dan Mengelola Sertifikat
• Manages Revocation and Renewal of Certificates / Mengelola Pencabutan dan
Pembaruan Sertifikat
• Establishes Policies & Procedures / Menetapkan Kebijakan & Prosedur
Certificate Revocation List

• CA periodically publishes a data structure called a certificate revocation


list (CRL) / CA secara berkala menerbitkan struktur data yang disebut
daftar pencabutan sertifikat (CRL)
• Described in the X.509 standard / Dijelaskan dalam standar X.509
• Each revoked certificate is identified in a CRL by its serial number / Setiap
sertifikat yang dicabut diidentifikasi dalam CRL dengan nomor seri
• CRL might be distributed by posting on a known web URL or from CA’s
own X.500 directory entry / CRL mungkin didistribusikan dengan
memposting di URL web yang dikenal atau dari entri direktori X.500 milik
CA sendiri
SELF-SIGNED
CERTIFICATES
Self-Signed Certificates

• A self-signed SSL certificate does not use the chain of trust commonly
used by other SSL certificates / Sertifikat SSL yang ditandatangani sendiri
tidak menggunakan rantai kepercayaan yang biasa digunakan oleh
sertifikat SSL lainnya
• Is an identity certificate that is signed by the same entity whose identity
it certifies / Adalah sertifikat identitas yang ditandatangani oleh entitas
yang sama yang identitasnya disertifikasi
• Most often used when a company wants to perform internal testing
without the effort or expense of acquiring a standard SSL certificate. /
Paling sering digunakan ketika perusahaan ingin melakukan pengujian
internal tanpa upaya atau biaya untuk memperoleh sertifikat SSL standar.
Self-Signed Certificates

certificate add name=CA country=ES state=Toledo locality=Illescas organization=IT unit=IT common-name=example.com \


subject-alt-name=DNS:example.com key-size=2048 days-valid=365 \
key-usage=digital-signature,key-encipherment,data-encipherment,key-cert-sign,crl-sign
Self-Signed Certificates

certificate sign CA name=CA


Self-Signed Certificates

certificate add name=www country=ES state=Toledo locality=Illescas organization=IT unit=IT \


common-name=webfix.example.com subject-alt-name=DNS:webfix.example.com key-size=2048 days-valid=365 \
key-usage=digital-signature,key-encipherment,tls-client,tls-server
Self-Signed Certificates

certificate sign www name=www ca=CA


FREE OF CHARGE
VALID
CERTIFICATES
Let’s Encrypt
• Let's Encrypt is a new Certificate Authority (CA) that offers FREE SSL
certificates that are just as secure as current paid certificates. / Let's
Encrypt adalah Otoritas Sertifikat (CA) baru yang menawarkan sertifikat
SSL GRATIS yang sama amannya dengan sertifikat berbayar saat ini.
• Let’s Encrypt is a free certificate authority developed by the Internet
Security Research Group (ISRG). / Mari Enkripsi adalah otoritas sertifikat
gratis yang dikembangkan oleh Internet Security Research Group (ISRG).
• SSL certificates are issued for a period of 90 days, and need to renew for
validity issue. / Sertifikat SSL dikeluarkan untuk jangka waktu 90 hari, dan
perlu diperbarui untuk masalah validitas.
• These certificates are domain-validated, don't require a dedicated IP and
are supported on all SiteGround hosting solutions. / Sertifikat ini
divalidasi domain, tidak memerlukan IP khusus dan didukung pada
semua solusi hosting SiteGround.
Let’s Encrypt
Key benefits of using a Let’s Encrypt SSL certificate: / Manfaat utama menggunakan sertifikat
Mari Enkripsi SSL:
• It's free – Anyone who owns a domain can obtain a trusted certificate for that domain at
zero cost. / Gratis - Siapa pun yang memiliki domain dapat memperoleh sertifikat tepercaya
untuk domain itu tanpa biaya.
• It's automatic – The entire enrolment process for certificates occurs during the server’s
native installation or configuration process. The renewal occurs automatically in the
background. / Otomatis - Seluruh proses pendaftaran untuk sertifikat terjadi selama proses
instalasi atau konfigurasi asli server. Pembaruan terjadi secara otomatis di latar belakang.
• It's simple – There's no payment, no validation emails, and certificates renew automatically.
/ Sederhana - Tidak ada pembayaran, tidak ada email validasi, dan sertifikat diperpanjang
secara otomatis.
• It's secure – Let’s Encrypt serves as a platform for implementing modern security
techniques and best practices. / Aman - Mari Enkripsi berfungsi sebagai platform untuk
menerapkan teknik keamanan modern dan praktik terbaik.
• More info – https://letsencrypt.org
SSL For Free

https://www.sslforfree.com
SSL For Free
SSL For Free
SSL For Free
Free of Charge Valid Certificates

Upload “certificate.crt” and “private.key” to the RouterOS


Free of Charge Valid Certificates

“System > Certificate”: import both the “certificate.crt” and the “private.key”
Free of Charge Valid Certificates
Module 5
SECURING THE
ROUTER
PORT KNOCKING
What is Port Knocking
• Port knocking is a method that enables access to the router only after receiving a sequenced
connection attempts on a set of “pre-specified” open ports. / Port knocking adalah metode
yang memungkinkan akses ke router hanya setelah menerima upaya koneksi berurutan pada
satu set port terbuka "yang ditentukan".
• Once the correct sequence of the connection attempts is received, the RouterOS dynamically
adds a host source IP to the allowed address list and you will be able to connect to your
router. / Setelah urutan yang benar dari upaya koneksi diterima, RouterOS secara dinamis
menambahkan sumber IP host ke daftar alamat yang diizinkan dan Anda akan dapat
terhubung ke router Anda.
• You can use some online available port-knock clients, or manually connect router IP address
with defined ports. / Anda dapat menggunakan beberapa klien port-knock online yang
tersedia, atau secara manual menghubungkan alamat IP router dengan port yang ditentukan.
• The port "knock" itself is similar to a secret handshake and can consist of any number of TCP,
UDP, or ICMP or other protocol packets to numbered ports on the destination machine / Port
"ketukan" itu sendiri mirip dengan jabat tangan rahasia dan dapat terdiri dari sejumlah TCP,
UDP, atau ICMP atau paket protokol lainnya ke port bernomor pada mesin tujuan
How the Port Knocking works

Host trying to make a connection to first


“knocking-port”

RouterOS dynamically adds a host source IP


to the allowed address-list

Host trying to make a second attempt


“knocking-port”

RouterOS will check if IP coming from the same first


connection on allowed address-list

If the IP is the same and the time between first attempt


and seconds within a specified time then the host IP
will be allowed to access the router
How the Port Knocking works

/ip firewall filter


add action=drop chain=input dst-port=8291 protocol=tcp src-address-list=!knock-final
add action=add-src-to-address-list address-list=knock1 address-list-timeout=10s chain=input dst-port=11111 \
protocol=tcp
add action=add-src-to-address-list address-list=knock2 address-list-timeout=10s chain=input dst-port=22222 \
protocol=tcp src-address-list=knock1
add action=add-src-to-address-list address-list=knock-final address-list-timeout=1d chain=input \
dst-port=33333 protocol=tcp src-address-list=knock2
How the Port Knocking works

Port Knocking for Windows

Port Knocking for Linux

apt-get install knockd or yum install knockd


knock your.mikrotik.ip-address-or-domain 12345:tcp 54321:udp
SECURE
CONNECTIONS
What is a Secure Connection
• A connection that is encrypted by one or more security
protocols to ensure the security of data flowing between two
or more nodes. / Koneksi yang dienkripsi oleh satu atau lebih
protokol keamanan untuk memastikan keamanan data yang
mengalir di antara dua atau lebih node.
• When a connection is not encrypted, it can be easily listened
to by anyone with the knowledge on how to do it. / Ketika
suatu koneksi tidak dienkripsi, itu dapat dengan mudah
didengarkan oleh siapa saja yang memiliki pengetahuan
tentang bagaimana melakukannya.
• Protect the data being transferred from one computer to
another / Lindungi data yang ditransfer dari satu komputer ke
komputer lain
Self-signed Certificate

ip service set www-ssl certificate=www


Self-signed Certificate
Self-signed Certificate
Free of Charge Valid Certificate

ip service set www-ssl certificate=certificate.crt_0


Free of Charge Valid Certificate
DEFAULT
PORTS FOR THE
SERVICES
Default Ports for the Services
• In TCP/IP and UDP networks, a port is an endpoint to a logical connection and the
way a client program specifies a specific server program on a computer in a
network. / Dalam jaringan TCP / IP dan UDP, port adalah titik akhir untuk koneksi
logis dan cara program klien menentukan program server tertentu pada komputer
dalam jaringan.
• The port number identifies what type of port it is, and what kind of service those
port is serving / Nomor port mengidentifikasi jenis port apa itu, dan jenis layanan
apa yang dilayani port tersebut
• Some ports have numbers that are assigned to them by the IANA, and these are
called the "well-known ports" which are specified in RFC1700. / Beberapa port
memiliki nomor yang ditugaskan kepada mereka oleh IANA, dan ini disebut "port
terkenal" yang ditentukan dalam RFC1700.
• Port numbers range from 0 to 65535, but only port numbers 0 to 1023 are
reserved for privileged services and designated as well-known ports. / Nomor port
berkisar dari 0 hingga 65535, tetapi hanya nomor port 0 hingga 1023 yang
dicadangkan untuk layanan istimewa dan ditunjuk sebagai port yang terkenal.
Default Ports for the Services

/ip service set telnet disabled=yes


/ip service set ftp disabled=yes
/ip service set www port=8800
/ip service set ssh port=22000
/ip service set www-ssl disabled=no port=44300
/ip service set api disabled=yes
/ip service set winbox port=58291

NB: Obscurity is not security - you should also use firewall rules
TUNNELING
THROUGH SSH
What is an SSH Tunnel

• An SSH tunnel consists of an encrypted tunnel created using


the SSH protocol connection / Terowongan SSH terdiri dari
terowongan terenkripsi yang dibuat menggunakan koneksi
protokol SSH
• The SSH tunnel can be used to encapsulate unencrypted
traffic and transmit it via an encrypted channel. / Terowongan
SSH dapat digunakan untuk merangkum lalu lintas yang tidak
terenkripsi dan mengirimkannya melalui saluran terenkripsi.
How SSH Works

Host connects to RouterOS using ssh with


local-port forwarding parameter

RouterOS accepted ssh connections from host

Host trying to open unencrypted port (80) from


ssh tunnel via local-port forwarding ip

RouterOS sending http request from host via


ssh tunnel
Configuring the SSH tunnel

SSH Local-Forwarding for Windows

SSH Local-Forwarding for Linux


ssh –L 80:127.0.0.1:80 your.router.ip-or-domain
Configuring the SSH tunnel
Module 6
SECURE TUNNELS
L2TP/IPsec
What is L2TP/IPsec
• L2TP stands for Layer 2 Tunnelling Protocol. L2TP was first proposed in 1999
as an upgrade to both L2F (Layer 2 Forwarding Protocol) and PPTP (Point-to-
Point Tunnelling Protocol) / L2TP adalah singkatan dari Layer 2 Tunneling
Protocol. L2TP pertama kali diusulkan pada tahun 1999 sebagai upgrade ke
L2F (Protokol Penerusan Lapisan 2) dan PPTP (Protokol Tunneling Point-to-
Point)
• Because L2TP does not provide strong encryption or authentication by itself,
another protocol called IPsec is most often used in conjunction with L2TP /
Karena L2TP tidak menyediakan enkripsi atau otentikasi yang kuat dengan
sendirinya, protokol lain yang disebut IPsec paling sering digunakan bersama
dengan L2TP
• Used together, L2TP and IPsec is much more secure than PPTP (Point-to-
Point Tunnelling Protocol), but also slightly slower / Digunakan bersama-
sama, L2TP dan IPsec jauh lebih aman daripada PPTP (Point-to-Point
Tunneling Protocol), tetapi juga sedikit lebih lambat
What is L2TP/IPsec
• L2TP/IPSec offers high speeds, and high levels of security for
transmitting data / L2TP / IPSec menawarkan kecepatan tinggi, dan
tingkat keamanan yang tinggi untuk mentransmisikan data
• It generally makes use of AES ciphers for encryption / Biasanya
menggunakan cipher AES untuk enkripsi
• L2TP sometimes has problems traversing firewalls due to its use of
UDP port 500 which some firewalls have been known to block by
default / L2TP kadang-kadang memiliki masalah melintasi firewall
karena penggunaannya port UDP 500 yang beberapa firewall telah
dikenal untuk memblokir secara default
Lab Setup

INTERNET

R1
L2TP/IPsec
Setup L2TP/IPsec Server

/interface l2tp-server server set authentication=mschap1,mschap2 \


enabled=yes ipsec-secret=84GsvZAtUQnE use-ipsec=yes
Setup L2TP/IPsec Server

/ppp secret add name=demo password=demo local-address=10.0.0.1 \


remote-address=10.0.0.11 profile=default-encryption service=l2tp
Setup L2TP/IPsec Client
Setup L2TP/IPsec Client
Setup L2TP/IPsec Client
Setup L2TP/IPsec Client
Setup L2TP/IPsec Client
SSTP
What is SSTP
• Microsoft introduced Secure Socket Tunnelling Protocol (SSTP) in Windows Vista and it still
considered to be a Windows-only platform even though it is available on a number of other
operating systems. / Microsoft memperkenalkan Secure Socket Tunneling Protocol (SSTP) di
Windows Vista dan itu masih dianggap sebagai platform Windows saja meskipun tersedia di
sejumlah sistem operasi lain.
• It has very similar advantages as OpenVPN as SSTP uses SSLv3 and it has greater stability as it is
included with Windows which also makes it simpler to use. / Ini memiliki keuntungan yang sangat
mirip dengan OpenVPN karena SSTP menggunakan SSLv3 dan memiliki stabilitas yang lebih besar
karena disertakan dengan Windows yang juga membuatnya lebih mudah untuk digunakan.
• It uses the same port used by SSL connections; port 443. / Ia menggunakan port yang sama yang
digunakan oleh koneksi SSL; port 443.
• It uses 2048 bit encryption and authentication certificates. / Ia menggunakan sertifikat enkripsi
dan otentikasi 2048 bit.
• SSTP uses SSL transmissions instead of IPsec because SSL supports roaming instead of just site-to-
site transmissions. / SSTP menggunakan transmisi SSL alih-alih IPsec karena SSL mendukung
roaming alih-alih hanya transmisi dari satu situs ke situs lainnya.
• RouterOS has both the SSTP server and client implementation / RouterOS memiliki implementasi
server SSTP dan klien
How the SSTP works

tcp connection
ssl negotiation

SSTP over HTTPS

IP binding

SSTP tunnel
How the SSTP works
• TCP connection is established from client to server (by default on
port 443) / Koneksi TCP dibuat dari klien ke server (secara default
pada port 443)
• SSL validates server certificate. If certificate is valid connection is
established otherwise connection is torn down. (But see note
below) / SSL memvalidasi sertifikat server. Jika sertifikat adalah
koneksi yang sah dibuat jika tidak koneksi dihancurkan. (Tapi lihat
catatan di bawah)
• The client sends SSTP control packets within the HTTPS session
which establishes the SSTP state machine on both sides / Klien
mengirim paket kontrol SSTP dalam sesi HTTPS yang membentuk
mesin negara SSTP di kedua sisi
How the SSTP works
• PPP negotiation over SSTP. Client authenticates to the server and binds IP
addresses to SSTP interface / Negosiasi PPP atas SSTP. Klien
mengautentikasi ke server dan mengikat alamat IP ke antarmuka SSTP
• SSTP tunnel is now established and packet encapsulation can begin. /
Terowongan SSTP sekarang didirikan dan enkapsulasi paket dapat dimulai.
• Note: Two RouterOS devices can establish an SSTP tunnel even without
the use of certificates (not in accordance with Microsoft standard) /
Catatan: Dua perangkat RouterOS dapat membuat terowongan SSTP
bahkan tanpa menggunakan sertifikat (tidak sesuai dengan standar
Microsoft)
• It is recommended to use the certificates at all times! / Dianjurkan untuk
menggunakan sertifikat setiap saat!
Lab Setup

INTERNET

R1
SSTP
Self-signed Certificate

certificate add name=sstp country=ES state=Toledo locality=Illescas organization=IT unit=IT \


common-name=sstp.example.com subject-alt-name=DNS:sstp.example.com key-size=2048 days-valid=365 \
key-usage=digital-signature,key-encipherment,tls-client,tls-server

/ certificate sign sstp name=sstp ca=CA


/ certificate set sstp trusted=yes
Lab Setup

/interface sstp-server server set authentication=mschap1,mschap2 certificate=sstp default-profile=default-encryption \


enabled=yes force-aes=yes
Setup SSTP Server

sstp

/ppp secret add name=demo password=demo local-address=10.0.0.1 remote-address=10.0.0.11 \


profile=default-encryption service=sstp
Setup SSTP Server

SSTP Server
Setup SSTP Client
Setup SSTP Client
Setup SSTP Client
IPsec
What is IPsec
Internet Protocol Security (IPsec) is a set of protocols defined by the Internet
Engineering Task Force (IETF) to secure packet exchange over unprotected
IPv4 or IPv6 networks such as Internet. Provides Layer 3 security (RFC 2401)
/ Internet Protocol Security (IPsec) adalah seperangkat protokol yang
didefinisikan oleh Internet Engineering Task Force (IETF) untuk
mengamankan pertukaran paket melalui jaringan IPv4 atau IPv6 yang tidak
dilindungi seperti Internet. Memberikan keamanan Layer 3 (RFC 2401)

IPsec Combines different components : / IPsec Menggabungkan berbagai


komponen:
• Security associations (SA) / Asosiasi keamanan (SA)
• Authentication headers (AH) / Header otentikasi (AH)
• Encapsulating security payload (ESP) / Encapsulating payload keamanan (ESP)
• Internet Key Exchange (IKE) / Pertukaran Kunci Internet (IKE)
What is IPsec

IPsec standardization defined in :


• RFC 4301 Defines the original IPsec architecture and elements common to
both AH and ESP
• RFC 4302 Defines authentication headers (AH)
• RFC 4303 Defines the Encapsulating Security Payload (ESP)
• RFC 2408 ISAKMP
• RFC 5996 IKE v2 (Sept 2010)
• RFC 4835 Cryptographic algorithm implementation for ESP and AH
The Benefits of IPsec
Confidentiality / Kerahasiaan
• By encrypting data / Dengan mengenkripsi data
Integrity / Integritas
• Routers at each end of a tunnel calculate the checksum or hash
value of the data / Router di setiap ujung terowongan menghitung
checksum atau nilai hash data
Authentication / Autentikasi
• Signatures and certificates / Tanda tangan dan sertifikat
• All these while still maintaining the ability to route through existing
IP Networks / Semua ini sambil tetap mempertahankan kemampuan
rute melalui Jaringan IP yang ada
The Benefits of IPsec
Data integrity and source authentication / Integritas data dan otentikasi
sumber
• The data is “signed” by the sender and the “signature” is verified by the recipient /
Data "ditandatangani" oleh pengirim dan "tanda tangan" diverifikasi oleh
penerima
• Modification of the data can be detected by the signature “verification” /
Modifikasi data dapat dideteksi oleh tanda tangan "verifikasi"
• Because the “signature” is based on a shared secret, it gives source authentication
/ Karena "tanda tangan" didasarkan pada rahasia bersama, itu memberikan
otentikasi sumber
Anti-replay protection / Perlindungan anti-replay
• Optional; the sender must provide it but the recipient may ignore / Pilihan;
pengirim harus menyediakannya tetapi penerima mungkin mengabaikannya
The Benefits of IPsec
Key management / Manajemen kunci
• IKE – session negotiation and establishment / IKE - negosiasi dan
pendirian sesi
• Sessions are rekeyed or deleted automatically / Sesi direkam kembali atau
dihapus secara otomatis
• Secret keys are securely established and authenticated / Kunci rahasia
dibuat dengan aman dan diautentikasi
• Remote peer is authenticated through varying options / Rekan jarak jauh
diautentikasi melalui berbagai opsi
IPsec Modes
Transport Mode / Moda transportasi
• IPsec header is inserted into the IP packet / Header IPsec dimasukkan ke dalam paket IP
• No new packet is created / Tidak ada paket baru yang dibuat
• Works well in networks where increasing a packet’s size could cause an issue / Berfungsi
dengan baik di jaringan di mana peningkatan ukuran paket dapat menyebabkan masalah
• Frequently used for remote-access VPNs / Sering digunakan untuk VPN akses jarak jauh
IPsec Modes
Tunnel Mode / Mode Terowongan
• Entire IP packet is encrypted and becomes the data component of a new (and
larger) IP packet. / Seluruh paket IP dienkripsi dan menjadi komponen data dari
paket IP baru (dan lebih besar).
• Frequently used in an IPsec site-to-site VPN / Sering digunakan dalam VPN IPsec
situs-ke-situs
IPsec Architecture
Authentication Header (AH)
AH is a protocol that provides authentication of either all or part of the contents of a datagram
through the addition of a header that is calculated based on the values in the datagram. / AH
adalah protokol yang menyediakan otentikasi semua atau sebagian isi datagram melalui
penambahan header yang dihitung berdasarkan nilai-nilai dalam datagram.
What parts of the datagram are used for the calculation, and the placement of the header,
depends whether tunnel or transport mode is used. / Bagian mana dari datagram yang
digunakan untuk perhitungan, dan penempatan header, tergantung apakah mode tunnel atau
transport digunakan.

• Provides source authentication and data integrity / Memberikan otentikasi sumber dan
integritas data
• Protection against source spoofing and replay attacks / Perlindungan terhadap spoofing sumber dan
serangan replay

• Authentication is applied to the entire packet, with the mutable fields in the IP header zeroed
out / Otentikasi diterapkan ke seluruh paket, dengan bidang yang bisa berubah di header IP
dihapus
Authentication Header (AH)
• Operates on top of IP using protocol 51 / Beroperasi di atas IP menggunakan
protokol 51
• In IPv4, AH protects the payload and all header fields except mutable fields and IP
options (such as IPsec option) / Dalam IPv4, AH melindungi payload dan semua
bidang header kecuali bidang yang bisa berubah dan opsi IP (seperti opsi IPsec)

MikroTik RouterOS supports the following authentication algorithms for AH: /


MikroTik RouterOS mendukung algoritma otentikasi berikut untuk
• SHA1
• MD5
Encapsulating Security Payload (ESP)
Encapsulating Security Payload (ESP) uses shared key encryption to provide data privacy. ESP also
supports its own authentication scheme like that used in AH, or can be used in conjunction with AH. /
Encapsulating Security Payload (ESP) menggunakan enkripsi kunci bersama untuk memberikan privasi
data. ESP juga mendukung skema otentikasi sendiri seperti yang digunakan dalam AH, atau dapat
digunakan bersama dengan AH.
ESP packages its fields in a very different way than AH. Instead of having just a header, it divides its
fields into three components: / ESP mengemas bidangnya dengan cara yang sangat berbeda dari AH.
Alih-alih hanya memiliki header, ia membagi bidangnya menjadi tiga komponen:

ESP Header : Comes before the encrypted data and its placement depends on / ESP Header: Hadir sebelum data terenkripsi dan
penempatannya tergantung
: whether ESP is used in transport mode or tunnel mode. / : apakah ESP digunakan dalam mode transportasi atau mode
terowongan.
ESP Trailer : This section is placed after the encrypted data. It /
Cuplikan ESP: Bagian ini ditempatkan setelah data terenkripsi itu
: contains padding that is used to align the encrypted data. /
: berisi padding yang digunakan untuk menyelaraskan data terenkripsi.
ESP Auth Data : This field contains an Integrity Check Value (ICV), computed / Data Auth ESP: Bidang ini berisi Nilai
Pemeriksaan Integritas (ICV), dihitung
: in a manner similar to how the AH protocol works, for / : dengan cara yang mirip dengan cara kerja protokol AH, untuk
: when ESP's optional authentication feature is used. / : ketika fitur otentikasi opsional ESP digunakan.
Encapsulating Security Payload (ESP)
• Uses IP protocol 50 / Menggunakan protokol IP 50
• Provides all that is offered by AH, plus data confidentiality / Menyediakan
semua yang ditawarkan oleh AH, plus kerahasiaan data
• It uses symmetric key encryption / Ini menggunakan enkripsi kunci simetris
• Must encrypt and/or authenticate in each packet / Harus mengenkripsi
dan / atau mengautentikasi dalam setiap paket
• Encryption occurs before authentication / Enkripsi terjadi sebelum otentikasi
• Authentication is applied to data in the IPsec header as well as the data
contained as payload / Otentikasi diterapkan ke data dalam header IPsec
serta data yang terkandung dalam payload
Encapsulating Security Payload (ESP)

RouterOS ESP supports various encryption and authentication algorithms. /


RouterOS ESP mendukung berbagai algoritma enkripsi dan otentikasi

Authentication : SHA1, MD5

Encryption :
DES : 56-bit DES-CBC encryption algorithm;
3DES : 168-bit DES encryption algorithm;
AES : 128, 192 and 256-bit key AES-CBC encryption algorithm;
Blowfish : added since v4.5
Twofish : added since v4.5
Camellia : 128, 192 and 256-bit key Camellia encryption algorithm
: added since v4.5
Internet Key Exchanger (IKE)
The Internet Key Exchange (IKE) is a protocol that provides authenticated keying material for
Internet Security Association and Key Management Protocol (ISAKMP) framework. There are other
key exchange schemes that work with ISAKMP, but IKE is the most widely used one. Together they
provide means for authentication of hosts and automatic management of security associations
(SA). / Internet Key Exchange (IKE) adalah protokol yang menyediakan materi kunci yang
diautentikasi untuk kerangka kerja Asosiasi Keamanan Internet dan Protokol Manajemen Kunci
(ISAKMP). Ada skema pertukaran kunci lain yang bekerja dengan ISAKMP, tetapi IKE adalah yang
paling banyak digunakan. Bersama-sama mereka menyediakan sarana untuk otentikasi host dan
manajemen otomatis asosiasi keamanan (SA).
• “An IPsec component used for performing mutual authentication and establishing and
maintaining Security Associations.” (RFC 5996) / "Komponen IPsec yang digunakan untuk
melakukan otentikasi bersama dan membangun dan memelihara Asosiasi Keamanan." (RFC
5996)
• Typically used for establishing IPSec sessions / Biasanya digunakan untuk membuat sesi IPSec
• A key exchange mechanism / Mekanisme pertukaran kunci
• Five variations of an IKE negotiation: / Lima variasi negosiasi IKE:
• Two modes (aggressive and main modes) / Dua mode (mode agresif dan utama)
• Three authentication methods (pre-shared, public key encryption, and public key signature) / Tiga
metode otentikasi (pra-bagi, enkripsi kunci publik, dan tanda tangan kunci publik)
• Uses UDP port 500 / Menggunakan port UDP 500
IKE Mode
Internet Key Exchanger (IKE)
Phase I / Fase I
• Establish a secure channel (ISAKMP SA) / Buat saluran aman (ISAKMP SA)
• Using either main mode or aggressive mode / Menggunakan mode utama atau mode agresif
• Authenticate computer identity using certificates or pre-shared secret / Otentikasi identitas
komputer menggunakan sertifikat atau rahasia yang dibagikan sebelumnya

Phase II / Fase II
• Establishes a secure channel between computers intended for the transmission of data (IPsec
SA) / Membuat saluran aman antara komputer yang ditujukan untuk transmisi data (IPsec SA)
• Using quick mode / Menggunakan mode cepat
Internet Key Exchanger (IKE)
IKE Phase 1 (Main Mode)
• Main mode negotiates an ISAKMP SA which will be used to create
IPsec SAs. / Mode utama menegosiasikan ISAKMP SA yang akan
digunakan untuk membuat IPsec SA.
• Three steps / Tiga langkah
• SA negotiation (encryption algorithm, hash algorithm, authentication
method, which DF group to use) / Negosiasi SA (algoritma enkripsi,
algoritma hash, metode otentikasi, grup DF mana yang akan
digunakan)
• Do a Diffie-Hellman exchange / Lakukan pertukaran Diffie-Hellman
• Provide authentication information / Berikan informasi otentikasi
• Authenticate the peer / Otentikasi rekan
IKE Phase 1 (Main Mode)
IKE Phase 1 (Aggressive Mode)

• Uses 3 (vs 6) messages to establish IKE SA / Menggunakan 3


(vs 6) pesan untuk membuat IKE SA
• No denial of service protection / Tidak ada penolakan
perlindungan layanan
• Does not have identity protection / Tidak memiliki
perlindungan identitas
• Optional exchange and not widely implemented / Pertukaran
opsional dan tidak diterapkan secara luas
IKE Phase 2 (Quick Mode)

• All traffic is encrypted using the ISAKMP Security Association /


Semua lalu lintas dienkripsi menggunakan Asosiasi Keamanan
ISAKMP
• Creates/refreshes keys / Membuat / menyegarkan kunci
• Each quick mode negotiation results in two IPsec Security
Associations (one inbound, one outbound) / Setiap negosiasi
mode cepat menghasilkan dua Asosiasi Keamanan IPsec (satu
masuk, satu keluar)
IKE Phase 2 (Quick Mode)
IKEv2
• Internet Key Exchange Version 2 (IKEv2) is the second-generation standard
for a secure key exchange between connected devices. / Internet Key
Exchange Version 2 (IKEv2) adalah standar generasi kedua untuk
pertukaran kunci aman antara perangkat yang terhubung.
• IKEv2 works by using an IPsec-based tunneling protocol to establish a
secure connection. / IKEv2 bekerja dengan menggunakan protokol
tunneling berbasis IPsec untuk membangun koneksi yang aman.
• One of the single most important benefits of IKEv2 is its ability to
reconnect very quickly in the event that your VPN connection gets
disrupted. / Salah satu manfaat paling penting dari IKEv2 adalah
kemampuannya untuk terhubung kembali dengan sangat cepat jika
koneksi VPN Anda terganggu.
• Quick reconnections and strong encryption IKEv2 makes an excellent
candidate to use / Koneksi ulang yang cepat dan enkripsi yang kuat IKEv2
membuat kandidat yang sangat baik untuk digunakan
Lab Setup

R1 R2
– Public Address : 11.11.11.2/24 – Public Address : 22.22.22.2/24
– Local Address : 192.168.1.0/24 – Local Address : 192.168.2.0/24
Lab Setup

INTERNET

R1 R2
IPsec
Setup IPsec R1

/ip address
add address=11.11.11.2/24 interface=ether1-to-internet network=11.11.11.0
add address=192.168.1.1/24 interface=ether2-to-local network=192.168.1.0
Setup IPsec R1

/ip route add distance=1 gateway=11.11.11.1


Setup IPsec R1

/ip firewall nat add action=masquerade chain=srcnat out-interface=ether1-to-internet


Setup IPsec R1

/ip ipsec peer add address=22.22.22.2/32 nat-traversal=no secret=ipsec-lab


Setup IPsec R1-NEW

/ip ipsec peer add address=22.22.22.2/32 local-address=11.11.11.2 name=peer-R2


Setup IPsec R1-NEW

/ip ipsec identity add peer=peer-R2 secret=myIPSecLABsecret


Setup IPsec R1

/ip ipsec policy


add dst-address=192.168.2.0/24 tunnel=yes sa-dst-address=22.22.22.2 \
sa-src-address=11.11.11.2 src-address=192.168.1.0/24
Setup IPsec R1

/ip firewall nat add chain=srcnat dst-address=192.168.2.0/24 src-address=192.168.1.0/24 place-before=0


Setup IPsec R2

/ip address
add address=22.22.22.2/24 interface=ether1-to-internet network=22.22.22.0
add address=192.168.2.1/24 interface=ether2-to-local network=192.168.2.0
Setup IPsec R2

/ip route add distance=1 gateway=22.22.22.1


Setup IPsec R2

/ip firewall nat add action=masquerade chain=srcnat out-interface=ether1-to-internet


Setup IPsec R2-OLD

/ip ipsec peer add address=11.11.11.2/32 nat-traversal=no secret=ipsec-lab


Setup IPsec R2-NEW

/ip ipsec peer add address=11.11.11.2/32 local-address=22.22.22.2 name=peer-R1


Setup IPsec R2-NEW

/ip ipsec identity add peer=peer-R1 secret=myIPSecLABsecret


Lab Setup

/ip ipsec policy


add dst-address=192.168.1.0/24 tunnel=yes sa-dst-address=11.11.11.2 \
sa-src-address=22.22.22.2 src-address=192.168.2.0/24
Lab Setup

/ip firewall nat add chain=srcnat dst-address=192.168.1.0/24 src-address=192.168.2.0/24 place-before=0


Lab Setup
Lab Setup
MTCSE
SUMMARY
Certification Test

• If needed reset router configuration and restore from a


backup
• Make sure that you have an access to the www.mikrotik.com
training portal
• Login with your account
• Choose my training sessions
• Good luck!
Thank You!
Thank you
José Manuel Román Fernández Checa
and
Fajar Nugroho
for creating and sharing the initial version of
the MTCSE course materials.

Caption in Bahasa by google translate


Harijanto Pribadi

You might also like