The aaPanel Fail2ban plugin automatically monitors log files (such as SSH, FTP, and aaPanel login logs) and inserts netfilter rules into iptables or nftables when a threshold of failed authentication attempts is exceeded. When an administrator is locked out, Fail2ban has written an active drop/reject rule for the client’s public IP into a specific jail chain (such as f2b-sshd or f2b-aaPanel). Because aaPanel manages Fail2ban as a background service via system-level scripts, resetting or clearing the block requires using the fail2ban-client binary or altering iptables rules directly via an out-of-band SSH session or provider console.
Quick Fix
Unban the locked-out IP directly using fail2ban-client by specifying the target jail, or clear the IP from all active jails using a one-liner:
fail2ban-client set <jail_name> unbanip <TARGET_IP>
To unban an IP across all active Fail2ban jails simultaneously:
fail2ban-client unban <TARGET_IP>
Step-by-Step Resolution
- Access the Server Out-of-Band
- If blocked on standard SSH (port 22), connect using a secondary non-blocked IP, a VPN, or your cloud provider’s VNC/Serial Console (e.g., DigitalOcean Console, AWS EC2 Serial Console, or Hetzner VNC).
- List Active Jails and Identify the Blocking Jail
- Query the status of the Fail2ban server to view all enabled jails managed by aaPanel:
fail2ban-client status
- Inspect specific jails (e.g.,
sshd,aapanel,ftp) to see which jail holds your IP in its Banned IP list:
fail2ban-client status sshd
fail2ban-client status aapanel
- Execute the Unban Command
- Remove the banned IP from the identified jail:
fail2ban-client set aapanel unbanip 192.0.2.100
- If the block was triggered by SSH brute-force protection:
fail2ban-client set sshd unbanip 192.0.2.100
- Verify and Flush Netfilter Rules (If Jail Unban Fails)
- Verify that the IP was removed from the netfilter firewall rules:
iptables -L -n -v | grep 192.0.2.100
- If the IP remains in an
iptableschain created by Fail2ban, manually delete the specific drop rule:
iptables -D f2b-sshd -s 192.0.2.100 -j DROP
- Whitelist Your Management IP to Prevent Future Lockouts
- Open the primary Fail2ban configuration managed by aaPanel:
nano /etc/fail2ban/jail.local
- Locate the
ignoreipparameter under the[DEFAULT]section and append your static IP address (separated by a space):
[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 192.0.2.100
- Restart Fail2ban to persist changes:
systemctl restart fail2ban
- Verify that the step was successful: Run
fail2ban-client status <jail_name>to confirm your IP is no longer present under Banned IP list, and test active authentication over SSH or the aaPanel WebGUI.
Why This Fails for Some Users
- Dual-Layer Firewalls (UFW / Firewalld / Cloud Security Groups): Clearing an IP from Fail2ban will not restore access if aaPanel’s System Firewall plugin (
ufworfirewalld) or an external cloud firewall (AWS Security Groups, Cloudflare, or DigitalOcean Firewalls) independently dropped the IP. Checkufw statusorfirewall-cmd --list-allseparately. - Socket File Path Discrepancies: On customized Linux distributions or non-standard aaPanel deployments, running
fail2ban-clientwithout root privileges causes connection errors (Failed to inspect server: Could not connect to server). Always run the command withsudoor as therootuser. - Non-Standard Jail Names Created by aaPanel: aaPanel names its GUI-created jails dynamically (e.g.,
aaPanel-ssh,aaPanel-panel,panel-login). Runningfail2ban-client set sshd unbanip ...will fail if aaPanel created the rule under a custom jail string; always runfail2ban-client statusfirst to retrieve exact jail identifiers. - Re-triggering Instant Bans via Persistent Connections: Background applications, active SSH tunnels, or open browser tabs constantly polling aaPanel in the background will immediately trigger a new ban upon sending unauthenticated requests the moment the IP is unbanned. Close all background sessions prior to executing the unban command.