docs: record ssh brute-force blocking and fail2ban hardening

This commit is contained in:
happybell80 2026-02-26 21:44:52 +09:00
parent ed629925f7
commit 404520cdc5

View File

@ -0,0 +1,35 @@
# 260226 51123 SSH 브루트포스 차단 및 fail2ban 교정
## 시간
- 기준일: 2026-02-26
## 배경
- 51123 SSH(포트 51123)로 무차별 대입 시도가 대량 유입됨
- 집계 기준(당일): `Failed password 56,613`, `Invalid user 48,030`
## 조치
1. UFW 수동 차단
- 허용(관리자 예외): `112.146.113.214`, `220.85.143.128`
- 차단(반복 실패 상위): `134.209.249.168`, `164.92.167.107`, `209.38.245.39`
2. fail2ban 설정 교정
- 파일: `/etc/fail2ban/jail.d/ssh-custom.conf`
- 핵심 변경:
- `port = 51123` (기존 `ssh` 포트 기본값 의존 제거)
- `ignoreip = 127.0.0.1/8 ::1 192.168.219.0/24 112.146.113.214 220.85.143.128`
- `sshd`: `maxretry=5`, `findtime=600`, `bantime=86400`
- `sshd-aggressive`: `maxretry=3`, `findtime=300`, `bantime=604800`
3. 서비스 반영
- `systemctl restart fail2ban`
- `fail2ban-client status``sshd`, `sshd-aggressive` 정상 활성 확인
## 확인 결과
- fail2ban 재시작 후 양쪽 jail에서 실시간 차단 동작 확인
- 화이트리스트 IP는 수동 `unbanip` 실행으로 차단 예외 재확인
- SSH 설정은 `Port 51123`, `PermitRootLogin no`, `PasswordAuthentication yes` 상태
## 후속 권장
1. 가능하면 `PasswordAuthentication no`로 전환(키 기반만 허용)
2. 비상 접속 계정 1개만 비밀번호 허용 + 소스 IP 제한
3. 월 1회 `fail2ban`/`ufw` 룰 정리 및 화이트리스트 검증