[PR #4085] [MERGED] x-ui.sh: bundle nftables when installing fail2ban #5594

Closed
opened 2026-10-31 20:48:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/4085
Author: @pwnnex
Created: 4/22/2026
Status: ✅ Merged
Merged: 4/22/2026
Merged by: @pwnnex

Base: main ← Head: fix/iplimit-install-nftables


📝 Commits (1)

  • 71ac920 x-ui.sh: install nftables alongside fail2ban in install_iplimit

📊 Changes

1 file changed (+16 additions, -9 deletions)

View changed files

📝 x-ui.sh (+16 -9)

📄 Description

Fresh Debian 12+, Ubuntu 24+ and recent RHEL-family minimal server images ship fail2ban with banaction = nftables-multiport as the default in /etc/fail2ban/jail.conf, but do not pull in the nftables package. The first SSH brute-force attempt reaches the default sshd jail and fail2ban logs:

stderr: /bin/sh: 1: nft: not found
returned 127 -- HINT on 127: "Command not found"

over and over until the attacker gives up. Noisy, looks like a 3x-ui regression on first install — see the discussion on #4083 where a user updated, checked Service Status / Ban Logs from the x-ui menu, and assumed the update caused it.

The 3x-ipl jail itself is fine because create_iplimit_jails writes an iptables-based action (action.d/3x-ipl.conf inherits from iptables-allports.conf). But the default sshd jail is inherited from the distro fail2ban config and the noise is real.

Add nftables to the package list in every branch of install_iplimit so fresh installs end up with a working default sshd jail. Installs that already have nftables present are a no-op.

No effect on existing deployments — install_iplimit only runs when the admin explicitly picks "Install IP Limit" from the x-ui menu, and only when fail2ban-client is not already on the system.

Test plan

  • bash syntax check on x-ui.sh (no errors)
  • diff review — only the package arg changed per distro, nothing else
  • behaviourally equivalent on systems where nftables is already installed (apt / dnf / pacman / apk all no-op an already-installed package)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/4085 **Author:** [@pwnnex](https://github.com/pwnnex) **Created:** 4/22/2026 **Status:** ✅ Merged **Merged:** 4/22/2026 **Merged by:** [@pwnnex](https://github.com/pwnnex) **Base:** `main` ← **Head:** `fix/iplimit-install-nftables` --- ### 📝 Commits (1) - [`71ac920`](https://github.com/MHSanaei/3x-ui/commit/71ac92043681318153cec6d82062cf79d53ef280) x-ui.sh: install nftables alongside fail2ban in install_iplimit ### 📊 Changes **1 file changed** (+16 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `x-ui.sh` (+16 -9) </details> ### 📄 Description Fresh Debian 12+, Ubuntu 24+ and recent RHEL-family minimal server images ship `fail2ban` with `banaction = nftables-multiport` as the default in `/etc/fail2ban/jail.conf`, but do not pull in the `nftables` package. The first SSH brute-force attempt reaches the default `sshd` jail and fail2ban logs: ``` stderr: /bin/sh: 1: nft: not found returned 127 -- HINT on 127: "Command not found" ``` over and over until the attacker gives up. Noisy, looks like a 3x-ui regression on first install — see the discussion on #4083 where a user updated, checked `Service Status` / `Ban Logs` from the x-ui menu, and assumed the update caused it. The `3x-ipl` jail itself is fine because `create_iplimit_jails` writes an iptables-based action (`action.d/3x-ipl.conf` inherits from `iptables-allports.conf`). But the default sshd jail is inherited from the distro fail2ban config and the noise is real. Add `nftables` to the package list in every branch of `install_iplimit` so fresh installs end up with a working default sshd jail. Installs that already have `nftables` present are a no-op. No effect on existing deployments — `install_iplimit` only runs when the admin explicitly picks "Install IP Limit" from the x-ui menu, and only when `fail2ban-client` is not already on the system. ### Test plan - [x] bash syntax check on x-ui.sh (no errors) - [x] diff review — only the package arg changed per distro, nothing else - [x] behaviourally equivalent on systems where `nftables` is already installed (apt / dnf / pacman / apk all no-op an already-installed package) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:48:03 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5594
No description provided.