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: |

How Does Telegram Make Money?

Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.

How to Buy Bitcoin?

Most people buy Bitcoin via exchanges, such as Coinbase. Exchanges allow you to buy, sell and hold cryptocurrency, and setting up an account is similar to opening a brokerage account—you’ll need to verify your identity and provide some kind of funding source, such as a bank account or debit card. Major exchanges include Coinbase, Kraken, and Gemini. You can also buy Bitcoin at a broker like Robinhood. Regardless of where you buy your Bitcoin, you’ll need a digital wallet in which to store it. This might be what’s called a hot wallet or a cold wallet. A hot wallet (also called an online wallet) is stored by an exchange or a provider in the cloud. Providers of online wallets include Exodus, Electrum and Mycelium. A cold wallet (or mobile wallet) is an offline device used to store Bitcoin and is not connected to the Internet. Some mobile wallet options include Trezor and Ledger.

telegram from cn


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