fruworg.github.io/content/posts/ssh-fail2ban.md
2023-12-26 04:34:28 +06:00

29 lines
599 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: fail2ban для SSH
description: Защита от брута пароля к SSH
date: 2022-11-29T13:41:00+05:00
tags: [linux, ssh]
---
## Установка пакета fail2ban
```shell
apt -y install fail2ban
```
## Правило для ssh
В файл `/etc/fail2ban/jail.d/sshd.conf` необходимо добавить следующее:
```config
[sshd]
enabled = true
port = <ssh-port>
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
findtime = 300
bantime = 3600
```
## Перезапуск сервиса fail2ban
```shell
systemctl restart fail2ban
```