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

The global forecast for the Asian markets is murky following recent volatility, with crude oil prices providing support in what has been an otherwise tough month. The European markets were down and the U.S. bourses were mixed and flat and the Asian markets figure to split the difference.The TSE finished modestly lower on Friday following losses from the financial shares and property stocks.For the day, the index sank 15.09 points or 0.49 percent to finish at 3,061.35 after trading between 3,057.84 and 3,089.78. Volume was 1.39 billion shares worth 1.30 billion Singapore dollars. There were 285 decliners and 184 gainers.

How Does Bitcoin Work?

Bitcoin is built on a distributed digital record called a blockchain. As the name implies, blockchain is a linked body of data, made up of units called blocks that contain information about each and every transaction, including date and time, total value, buyer and seller, and a unique identifying code for each exchange. Entries are strung together in chronological order, creating a digital chain of blocks. “Once a block is added to the blockchain, it becomes accessible to anyone who wishes to view it, acting as a public ledger of cryptocurrency transactions,” says Stacey Harris, consultant for Pelicoin, a network of cryptocurrency ATMs. Blockchain is decentralized, which means it’s not controlled by any one organization. “It’s like a Google Doc that anyone can work on,” says Buchi Okoro, CEO and co-founder of African cryptocurrency exchange Quidax. “Nobody owns it, but anyone who has a link can contribute to it. And as different people update it, your copy also gets updated.”

telegram from in


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