Skip to content

Latest commit

 

History

History
131 lines (114 loc) · 2.39 KB

linux-tehlukesizlik-artirma.tr.md

File metadata and controls

131 lines (114 loc) · 2.39 KB
title date tags author showToc TocOpen draft hidemeta comments description disableHLJS disableShare hideSummary searchHidden ShowReadingTime ShowBreadCrumbs ShowPostNavLinks ShowWordCount ShowRssButtonInSectionTermList UseHugoToc cover editPost
Linux Təməlli Serverlərin Təhlükəsizliyinin Yüksəldilməsi
2022-12-18 11:30:03 +0000
linux
Nijat
false
false
false
false
false
false
false
false
false
true
true
true
true
true
true
image alt caption relative hidden
./img/background-g80913faae_640.jpg
Meson Network
Meson Network
false
true
URL Text appendFilePath
Suggest Changes
true

1.Yeni istifadəçi yaratmaq

useradd <user>

2.İstifadəçiyə sudo icazəsi vermək

usermod -aG sudo <user>
passwd <user>

3.SSH key yaradılması

RSA

ssh-keygen

ED25519 (Tövsiyyə olunan):

ssh-keygen -t ed25519

4.SSH public keyi serverə kopyalamaq

ssh-copy-id -i <key> user@host

5.Serverin ssh portunu dəyişmək və şifrə ilə girişi bağlamaq üçün sshd_config faylında dəyişikliklər etmək

Orijinal faylı saxlamaq:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig

sshd_config faylını nano text editor ilə açmaq:

sudo nano /etc/ssh/sshd_config

6. Avtomatik yenilənmələri açmaq

sudo apt install unattended-upgrades
dpkg-reconfigure --priority=low unattended-upgrades

7.UFW firewall aktivləşdirmə

sudo apt install ufw
ufw allow <port>
sudo systemctl enable ufw && ufw enable

8.Echo istəkləri (ping) bağlamaq

sudo nano /etc/ufw/before.rules
-A --ufw-before-input -p --icmp-type echo-request -j DROP

9.Fail2Ban

sudo apt install fail2ban 
sudo nano /etc/fail2ban/jail.d/sshd.conf
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 120
ignoreip = whitelist-IP
sudo reboot