Generate a complete jail.local config for SSH, Nginx, Apache, Postfix, vsftpd, and WordPress — with bantime, maxretry, ignoreip, and ready-to-run install commands.
SSH, Nginx, Apache, Postfix, vsftpd, WordPress용 jail.local 설정을 즉시 생성 — bantime, maxretry, ignoreip 및 설치·적용 명령어 포함.
Services to Protect
Common Settings
How to Use
STEP 1
Check the daemons running on your server — sshd is the minimum for any VPS. Add the Nginx or Apache jails if you serve websites, and postfix/vsftpd for mail or FTP.
STEP 2
Set maxretry (failed attempts allowed), bantime (how long an IP stays banned), and findtime (the counting window). Defaults of 3 / 1h / 10m work well for most servers.
STEP 3
Add your home or office IP to ignoreip so fail2ban can never lock you out — especially important if you choose a permanent ban time.
STEP 4
Copy or download the file to /etc/fail2ban/jail.local, then run the generated commands: install fail2ban, restart the service, and verify with fail2ban-client status.
사용 방법
STEP 1
서버에서 실행 중인 데몬을 체크하세요 — 모든 VPS에서 sshd는 필수입니다. 웹사이트를 운영하면 Nginx/Apache jail을, 메일·FTP는 postfix/vsftpd를 추가하세요.
STEP 2
maxretry(허용 실패 횟수), bantime(차단 유지 시간), findtime(집계 시간 창)을 설정하세요. 기본값 3 / 1h / 10m이 대부분의 서버에 적합합니다.
STEP 3
집이나 사무실 IP를 ignoreip에 추가해 스스로 차단되는 일을 방지하세요 — 영구 차단을 선택했다면 특히 중요합니다.
STEP 4
생성된 파일을 /etc/fail2ban/jail.local에 저장하고 명령어를 실행하세요: fail2ban 설치, 서비스 재시작, fail2ban-client status로 확인.
Frequently Asked Questions
1h) is a solid default — long enough to stop brute-force scripts, short enough to forgive a mistyped password. High-value servers often use 24h or 1w. A permanent ban (bantime = -1) is aggressive: use it only together with a correct ignoreip so you never lock yourself out.maxretry = 3 with findtime = 10m means: 3 failed logins within 10 minutes triggers a ban. Lower values are stricter; 3–5 is the common range for SSH.ignoreip line in the [DEFAULT] section of jail.local, e.g. ignoreip = 127.0.0.1/8 ::1 203.0.113.42. Fail2ban never bans addresses in this list. If you have a dynamic home IP, whitelist your ISP's subnet or use a VPN with a fixed exit IP.banaction = ufw in jail.local to have bans managed as ufw rules. They complement each other: ufw sets your static policy, fail2ban adds dynamic bans.sudo fail2ban-client set sshd unbanip 203.0.113.42 — replace sshd with the jail name and use the real IP. To list currently banned IPs, run sudo fail2ban-client status sshd. On fail2ban 0.10+ you can also unban an IP from every jail at once with sudo fail2ban-client unban 203.0.113.42.자주 묻는 질문
1h)이 무난한 기본값입니다 — 브루트포스 스크립트를 막기에 충분하고, 비밀번호 오타 정도는 용서할 만큼 짧습니다. 중요한 서버는 24h 또는 1w를 많이 사용합니다. 영구 차단(bantime = -1)은 공격적이므로 반드시 ignoreip를 올바르게 설정한 뒤 사용하세요.maxretry = 3, findtime = 10m이면 10분 안에 3번 로그인 실패 시 해당 IP가 차단됩니다. 값이 낮을수록 엄격하며 SSH에는 3~5가 일반적입니다.ignoreip에 내 IP나 서브넷을 추가하세요. 예: ignoreip = 127.0.0.1/8 ::1 203.0.113.42. 이 목록의 주소는 절대 차단되지 않습니다. 유동 IP라면 ISP 서브넷을 등록하거나 고정 IP VPN을 사용하세요.banaction = ufw로 설정하면 차단이 ufw 규칙으로 관리됩니다. ufw는 고정 정책, fail2ban은 동적 차단으로 서로 보완합니다.sudo fail2ban-client set sshd unbanip 203.0.113.42 를 실행하세요 (jail 이름과 IP는 실제 값으로 교체). 현재 차단 목록은 sudo fail2ban-client status sshd로 확인합니다. fail2ban 0.10+에서는 sudo fail2ban-client unban [IP]로 모든 jail에서 한 번에 해제할 수 있습니다.