Telegram Group & Telegram Channel
🔐 5 шагов для защиты SSH: от порта до fail2ban

Если ты всё ещё держишь SSH по умолчанию и без ограничений — пора это исправлять. Вот 5 базовых, но мощных шагов, которые сильно усложнят жизнь злоумышленнику:



1️⃣ Сменить порт SSH
По умолчанию — порт 22. Все боты мира сканируют именно его.
Как изменить:

sudo nano /etc/ssh/sshd_config
# Найди строку:
Port 22
# Измени, например, на:
Port 2222

Не забудь открыть новый порт в фаерволе и перезапустить SSH:

sudo systemctl restart sshd




2️⃣ Отключить вход по паролю
Пароли — дырка в безопасности. Только ключи.
В sshd_config:

PasswordAuthentication no
PermitRootLogin no


Используй SSH-ключи:

ssh-keygen
ssh-copy-id user@host




3️⃣ Ограничить доступ по IP
Открывать SSH всему миру — плохая идея.
Пример для UFW:

sudo ufw allow from <твой_IP> to any port 2222 proto tcp
sudo ufw enable


Аналогично — через iptables или firewalld.



4️⃣ Включить двухфакторную аутентификацию (2FA)
Устанавливаем Google Authenticator:

sudo apt install libpam-google-authenticator
google-authenticator

Добавить в /etc/pam.d/sshd:

auth required pam_google_authenticator.so

В sshd_config:

ChallengeResponseAuthentication yes




5️⃣ Настроить fail2ban
Автоматическая блокировка IP после X неудачных попыток входа.
Установка:

sudo apt install fail2ban

Пример конфига /etc/fail2ban/jail.local:

[sshd]
enabled = true
port = 2222
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 1h

Стартуем:

sudo systemctl enable fail2ban
sudo systemctl start fail2ban



Проверяй, как тебя видит мир:

ss -tuln | grep ssh



tg-me.com/linux_srv/478
Create:
Last Update:

🔐 5 шагов для защиты SSH: от порта до fail2ban

Если ты всё ещё держишь SSH по умолчанию и без ограничений — пора это исправлять. Вот 5 базовых, но мощных шагов, которые сильно усложнят жизнь злоумышленнику:



1️⃣ Сменить порт SSH
По умолчанию — порт 22. Все боты мира сканируют именно его.
Как изменить:


sudo nano /etc/ssh/sshd_config
# Найди строку:
Port 22
# Измени, например, на:
Port 2222

Не забудь открыть новый порт в фаерволе и перезапустить SSH:

sudo systemctl restart sshd




2️⃣ Отключить вход по паролю
Пароли — дырка в безопасности. Только ключи.
В sshd_config:

PasswordAuthentication no
PermitRootLogin no


Используй SSH-ключи:

ssh-keygen
ssh-copy-id user@host




3️⃣ Ограничить доступ по IP
Открывать SSH всему миру — плохая идея.
Пример для UFW:

sudo ufw allow from <твой_IP> to any port 2222 proto tcp
sudo ufw enable


Аналогично — через iptables или firewalld.



4️⃣ Включить двухфакторную аутентификацию (2FA)
Устанавливаем Google Authenticator:

sudo apt install libpam-google-authenticator
google-authenticator

Добавить в /etc/pam.d/sshd:

auth required pam_google_authenticator.so

В sshd_config:

ChallengeResponseAuthentication yes




5️⃣ Настроить fail2ban
Автоматическая блокировка IP после X неудачных попыток входа.
Установка:

sudo apt install fail2ban

Пример конфига /etc/fail2ban/jail.local:

[sshd]
enabled = true
port = 2222
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 1h

Стартуем:

sudo systemctl enable fail2ban
sudo systemctl start fail2ban



Проверяй, как тебя видит мир:

ss -tuln | grep ssh

BY Типичный Сисадмин


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/linux_srv/478

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

Telegram today rolling out an update which brings with it several new features.The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. The update also adds interactive emoji. When you send one of the select animated emoji in chat, you can now tap on it to initiate a full screen animation. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations. This is then visible to you or anyone else who's also present in chat at the moment. The animations are also accompanied by vibrations.

telegram from sg


Telegram Типичный Сисадмин
FROM USA