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 to Use Bitcoin?

n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

telegram from jp


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