Thuta Learning
ရှာဖွေရန်
AdvancedSecuritybeginner

Linux Server Hardening

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Linux Server Hardening ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • လက်တွေ့ scenario ထဲမှာ ဒီ concept ကို ချက်ချင်း အသုံးချတတ်မယ်
  • ကိုယ်တိုင်နဲ့ တခြားသူများအတွက်ပါ security risk ကို ရှောင်တတ်အောင် လုပ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

Server hardening ဆိုတာ default setting တွေကို secure configuration အဖြစ် ပြောင်းလဲခြင်းပါ — attack surface (attacker ဝင်နိုင်တဲ့ ဝင်ပေါက်) ကို လျှော့ချတာပါ။ Key hardening step များ — SSH password authentication ကို disable လုပ်ပြီး key-only authentication ဖြင့် ပြောင်း, root login ကို SSH ကနေ disable, unused service/port ကို ပိတ်, fail2ban သုံးပြီး repeated login failure ရှိရင် IP ကို ban, security update ကို automatic install ဖြစ်အောင် setup လုပ်ခြင်း။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

SSH config ဖိုင် (/etc/ssh/sshd_config) ထဲမှာ PasswordAuthentication no, PermitRootLogin no ဆိုတဲ့ setting ကို ဖွင့်ရင် brute-force password attack risk ကို လုံးဝ ဖယ်ရှားနိုင်ပါတယ် (key-based auth ကိုပဲ ခွင့်ပြု)။ fail2ban ကို install ပြီး SSH jail ကို enable ရင် login failure ၅ ကြိမ်ဆက်တိုက်ရရင် IP address ကို minute ၁၀ လောက် အလိုအလျောက် ban ပေးနိုင်ပါတယ်။

အတူတူ ကြည့်မယ်

bash
# /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no

# Restart SSH service to apply
sudo systemctl restart sshd

# Install fail2ban
sudo apt install fail2ban
sudo systemctl enable fail2ban --now
You should see
SSH hardening config ၂ ခု (password auth disable, root login disable) ကို ဖော်ပြပြီး fail2ban ရဲ့ အလုပ်ကို ရှင်းပြနိုင်မည်။

၅ မိနစ် စမ်းကြည့်

Linux tutorial ရဲ့ SSH/Firewall lesson ကို ပြန်ကြည့်ပြီး ဒီ hardening checklist ထဲက item ၃ ခုကို VM/WSL ပေါ်မှာ practice run ကြည့်ပါ (root/production server ပေါ်မှာ မလုပ်ပါနှင့်)။

သတိလေးတစ်ချက်

SSH config ပြောင်းလိုက်ပြီးရင် existing connection ကို မပိတ်ခင် terminal အသစ်တစ်ခုနဲ့ login ပြန်စမ်းကြည့်ပါ — config မှားရင် server ကနေ locked out ဖြစ်နိုင်ပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • PasswordAuthentication ကို disable လုပ်ခင် SSH key ကို server ဆီ upload ထားမှတ်မှတ် — မထားရင် locked out ဖြစ်နိုင် (Linux tutorial ၏ firewall lesson ကို ပြန်သတိရပါ)
  • fail2ban ကို install ရုံနဲ့ configure/enable မလုပ်ဘဲ ထားခြင်း

အခု ကိုယ်တိုင် စမ်းကြည့်

Linux tutorial ရဲ့ SSH/Firewall lesson ကို ပြန်ကြည့်ပြီး ဒီ hardening checklist ထဲက item ၃ ခုကို VM/WSL ပေါ်မှာ practice run ကြည့်ပါ (root/production server ပေါ်မှာ မလုပ်ပါနှင့်)။

You'll know it worked when: SSH hardening config ၂ ခု (password auth disable, root login disable) ကို ဖော်ပြပြီး fail2ban ရဲ့ အလုပ်ကို ရှင်းပြနိုင်မည်။

Linux Server Hardening | Thuta Learning