BSMBasil Saji Mathew

Guide

Fail2ban for Windows? RDP and SSH Protection Options Compared

Fail2ban is the classic way to stop password-guessing attacks on Linux: it reads log files, counts failures per address, and bans offenders with the firewall. It does not run on Windows, which is where a lot of exposed RDP servers live. If you want fail2ban-style protection for both Windows RDP and Linux SSH, here are your options.

How fail2ban-style protection works

  1. Read authentication failures from a log (on Windows, Security Event ID 4625; on Linux, the SSH auth log).
  2. Count failures per source address inside a sliding time window.
  3. Ban an address that crosses a threshold by adding a firewall rule.
  4. Unban after a set time so mistakes are temporary.

Your options

ApproachWorks onBest forTrade-off
Fail2banLinuxSSH and other Linux servicesNot available for Windows
VPN or RD GatewayWindowsRemoving the exposure entirelyNeeds setup; not a ban tool
Scheduled script on Event 4625WindowsSmall servers, full controlYou maintain the code and edge cases
Open-source tools such as IPBan or EvlWatcherWindowsReady-made banning for Windows logsWindows-focused; separate tool for Linux
PortcullisWindows and LinuxOne tool and dashboard for RDP and SSHYoung project; read its README for what is tested

Where Portcullis fits

I built Portcullis because I wanted one small tool for both operating systems. It uses a sliding-window detector, blocks with netsh on Windows and iptables on Linux, shows everything in a web dashboard, and alerts through Discord, Telegram or Slack. It starts in observe mode, so it logs what it would block without touching your firewall until you are ready. It is written with the Python standard library only, so there are no dependencies to install or audit. It is open source under the MIT licence, with 118 automated tests.

Whichever you choose

  • Allowlist yourself first. The worst outcome of a ban tool is locking out the administrator.
  • Run it in observe mode for a day before you enforce bans.
  • Expire bans and keep an audit log.
  • Do not rely on it alone. Use a VPN or gateway, strong passwords, NLA on RDP and key-only authentication on SSH.

Frequently asked questions

Can I install fail2ban on Windows?

Not natively. Fail2ban is a Linux tool. On Windows use an equivalent such as the options in the table above.

Is banning IP addresses enough?

No. Attackers rotate addresses. Banning reduces noise and slows guessing, but exposure reduction and strong authentication matter more.