[GH-ISSUE #6569] [Bug]: EL7 - fail2ban setup pulls in firewalld and blocks all panel/inbound ports after reboot #4404

Closed
opened 2026-10-31 20:39:26 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Drswith on GitHub (Sep 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6569

Describe the bug

On RHEL/CentOS 7 (EL7), the automatic Fail2ban setup that runs during install/upgrade
silently pulls in firewalld as a transitive dependency and leaves the unit
enabled.

firewalld is not started by the package transaction, so nothing appears to break at
that moment — the panel keeps working normally. But on the next reboot it starts with
its default public zone, which only allows ssh and dhcpv6-client. Every 3x-ui port
is then rejected by the host firewall:

  • the panel port (e.g. 44328)
  • the subscription port (2096)
  • every Xray inbound port

Clients get Connection refused (the firewall rejects with icmp-host-prohibited),
which looks exactly like "the panel died" even though x-ui is running and listening
correctly on all ports.

This is especially confusing to diagnose because the operator never configured a
firewall in the first place: on EL7 the dependency is pulled in silently, by a package
transaction that the 3x-ui script triggers on their behalf.

How to reproduce the problem

  1. Start from a RHEL/CentOS 7 system where firewalld is not installed. Many
    minimal/VPS images remove it at provisioning time, so verify first:
    rpm -q firewalld → package firewalld is not installed.
  2. Install or upgrade 3x-ui with the official script. During the run the installer
    prints Setting up Fail2ban for the IP Limit feature... and then executes:
    yum makecache -y && yum install epel-release -y
    yum -y install fail2ban nftables
  3. Do not change anything else. At this point the panel and all inbounds are still
    reachable — nothing looks wrong.
  4. Reboot the host (reboot).
  5. After the reboot, the panel and every inbound port are unreachable
    (curl: (7) Failed to connect ... Connection refused), while SSH on port 22 still
    works.
  6. Confirm the cause:
    firewall-cmd --list-all → services: dhcpv6-client ssh, ports: empty
    iptables -L INPUT -n -v → final REJECT ... reject-with icmp-host-prohibited

Expected behavior

Installing or upgrading 3x-ui should not leave the host in a state where a firewall the
operator never asked for blocks the panel and all inbounds on the next boot.

If firewalld really has to be installed on EL7 as a side effect of fail2ban, the
installer should either leave it disabled (the 3x-ipl jail does not need it), or open
the ports 3x-ui relies on, or at minimum warn loudly that a firewall was just enabled.

Actual behavior

firewalld is installed and enabled as a side effect of the fail2ban dependency chain,
with an empty public zone. After the next reboot it rejects all traffic except SSH,
taking the panel, the subscription service, and every inbound offline — with no
indication in the 3x-ui output that anything firewall-related was installed.

Relevant logs

The yum transaction triggered by the installer (note firewalld arriving as a
Dep-Install, not as a user-requested package):

# yum history info <id>
Command Line   : -y install fail2ban nftables
Packages Altered:
    Install     fail2ban-0.11.2-3.el7.noarch                @epel
    Dep-Install fail2ban-firewalld-0.11.2-3.el7.noarch      @epel
    Dep-Install fail2ban-server-0.11.2-3.el7.noarch         @epel
    Dep-Install firewalld-0.6.3-13.el7_9.noarch             @updates
    Dep-Install python-firewall-0.6.3-13.el7_9.noarch       @updates
    Dep-Install firewalld-filesystem-0.6.3-13.el7_9.noarch  @updates
    Install     nftables-1:0.8-14.el7.x86_64                @base
    ...

firewalld is the only reverse dependency on EL7, so there is no way to install
fail2ban there without it:

# rpm -q --whatrequires firewalld
fail2ban-firewalld-0.11.2-3.el7.noarch

The resulting zone / ruleset (empty ports: is the whole problem):

# firewall-cmd --list-all
public (active)
  target: default
  interfaces: eth0
  services: dhcpv6-client ssh
  ports:
# iptables -L INPUT -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source        destination
1    19668 5223K ACCEPT     all  --  *      *       0.0.0.0/0     0.0.0.0/0     ctstate RELATED,ESTABLISHED
2      727 43600 ACCEPT     all  --  lo     *       0.0.0.0/0     0.0.0.0/0
...
7    22881 4478K REJECT     all  --  *      *       0.0.0.0/0     0.0.0.0/0     reject-with icmp-host-prohibited

# iptables -L IN_public_allow -n -v
Chain IN_public_allow (1 references)
 pkts bytes target     prot opt in     out     source        destination
   18  1104 ACCEPT     tcp  --  *      *       0.0.0.0/0     0.0.0.0/0     tcp dpt:22 ctstate NEW,UNTRACKED

firewalld was enabled at install time but only started at the reboot — the firewall
log contains a single line, timestamped at boot, not at package-install time:

# systemctl is-enabled firewalld ; systemctl is-active firewalld
enabled
active

# cat /var/log/firewalld
2026-09-16 09:39:34 WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. ...

Meanwhile the panel and Xray are up and listening — only the firewall is blocking them:

# ss -tlnp | grep -E '44328|2096|3000'
LISTEN 0 4096 [::]:2096   *:*  users:(("x-ui",pid=854,fd=16))
LISTEN 0 4096 [::]:30000  *:*  users:(("xray-linux-amd6",pid=865,fd=9))
LISTEN 0 4096 [::]:30001  *:*  users:(("xray-linux-amd6",pid=865,fd=11))
LISTEN 0 4096 [::]:30003  *:*  users:(("xray-linux-amd6",pid=865,fd=10))
LISTEN 0 4096 [::]:30007  *:*  users:(("xray-linux-amd6",pid=865,fd=5))
LISTEN 0 4096 [::]:44328  *:*  users:(("x-ui",pid=854,fd=10))

# curl -sk -o /dev/null -w '%{http_code}\n' https://127.0.0.1:44328/<basePath>/
200

3x-ui version

3.8.5

Xray-core version

26.9.9

How did you install 3x-ui?

install.sh script

Operating system

CentOS 7.9 (EL7), kernel 5.4.x, KVM VPS. The image had firewalld removed at
provisioning time (yum history shows an -y remove firewalld linux-firmware
transaction), so the host had no firewall at all before the upgrade.

Which parts of the panel are affected?

Install / upgrade script

Is the panel behind a reverse proxy or CDN?

No — direct access

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).

Additional context

Root cause. x-ui.sh → setup_fail2ban_iplimit() → the centos) branch:

centos)
    if [[ "${VERSION_ID}" =~ ^7 ]]; then
        yum makecache -y && yum install epel-release -y
        yum -y install fail2ban nftables
    else
        dnf makecache -y && dnf -y install fail2ban nftables
    fi
    ;;

The comment above this block explains that nftables was added so the default sshd
jail
would not log nft: not found, and it explicitly mentions "fresh RHEL-family"
systems. The problem is that on EL7 the same command also drags in firewalld, and
nothing in the script ever accounts for that: install_firewall() only implements
ufw, so there is no firewalld code path anywhere, and no port is ever opened in its
zone.

Because the RPM only enables the unit (systemd preset) without starting it, the
breakage is deferred to the next boot — which makes it very hard to connect the symptom
back to the install/upgrade that caused it. Debian/Ubuntu are unaffected, which likely
explains why this has gone unnoticed.

Impact. Any EL7 deployment that did not already have firewalld installed loses all
non-SSH connectivity after the first reboot following a 3x-ui install or upgrade.

Suggested fix (any of these).

  1. On the RHEL family, if firewalld was pulled in by this transaction and was not
    present/running before, leave it disabled afterwards (systemctl disable --now firewalld). The 3x-ipl jail uses plain iptables
    (before = iptables-allports.conf) and does not need firewalld, so IP Limit keeps
    working.
  2. Or open the panel port in the firewalld zone before reloading, and tell the operator
    that inbound ports must be opened manually.
  3. Or, at minimum, print a prominent warning when the transaction introduces
    firewalld, so the operator is not left debugging a "panel is down" symptom that has
    nothing to do with the panel.

Workaround for affected users (IP Limit / fail2ban keeps working):

systemctl disable --now firewalld

Note. As of this report, x-ui.sh on main still contains the same block.

Originally created by @Drswith on GitHub (Sep 16, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6569 ### Describe the bug On RHEL/CentOS 7 (EL7), the automatic Fail2ban setup that runs during install/upgrade silently pulls in **`firewalld`** as a transitive dependency and leaves the unit **enabled**. `firewalld` is *not* started by the package transaction, so nothing appears to break at that moment — the panel keeps working normally. But on the **next reboot** it starts with its default `public` zone, which only allows `ssh` and `dhcpv6-client`. Every 3x-ui port is then rejected by the host firewall: * the panel port (e.g. `44328`) * the subscription port (`2096`) * every Xray inbound port Clients get `Connection refused` (the firewall rejects with `icmp-host-prohibited`), which looks exactly like "the panel died" even though `x-ui` is running and listening correctly on all ports. This is especially confusing to diagnose because the operator never configured a firewall in the first place: on EL7 the dependency is pulled in silently, by a package transaction that the 3x-ui script triggers on their behalf. ### How to reproduce the problem 1. Start from a RHEL/CentOS 7 system where `firewalld` is **not** installed. Many minimal/VPS images remove it at provisioning time, so verify first: `rpm -q firewalld` → `package firewalld is not installed`. 2. Install or upgrade 3x-ui with the official script. During the run the installer prints `Setting up Fail2ban for the IP Limit feature...` and then executes: `yum makecache -y && yum install epel-release -y` `yum -y install fail2ban nftables` 3. Do **not** change anything else. At this point the panel and all inbounds are still reachable — nothing looks wrong. 4. Reboot the host (`reboot`). 5. After the reboot, the panel and every inbound port are unreachable (`curl: (7) Failed to connect ... Connection refused`), while SSH on port 22 still works. 6. Confirm the cause: `firewall-cmd --list-all` → `services: dhcpv6-client ssh`, `ports:` empty `iptables -L INPUT -n -v` → final `REJECT ... reject-with icmp-host-prohibited` ### Expected behavior Installing or upgrading 3x-ui should not leave the host in a state where a firewall the operator never asked for blocks the panel and all inbounds on the next boot. If `firewalld` really has to be installed on EL7 as a side effect of `fail2ban`, the installer should either leave it disabled (the `3x-ipl` jail does not need it), or open the ports 3x-ui relies on, or at minimum warn loudly that a firewall was just enabled. ### Actual behavior `firewalld` is installed and enabled as a side effect of the fail2ban dependency chain, with an empty `public` zone. After the next reboot it rejects all traffic except SSH, taking the panel, the subscription service, and every inbound offline — with no indication in the 3x-ui output that anything firewall-related was installed. ### Relevant logs The yum transaction triggered by the installer (note `firewalld` arriving as a `Dep-Install`, not as a user-requested package): ```text # yum history info <id> Command Line : -y install fail2ban nftables Packages Altered: Install fail2ban-0.11.2-3.el7.noarch @epel Dep-Install fail2ban-firewalld-0.11.2-3.el7.noarch @epel Dep-Install fail2ban-server-0.11.2-3.el7.noarch @epel Dep-Install firewalld-0.6.3-13.el7_9.noarch @updates Dep-Install python-firewall-0.6.3-13.el7_9.noarch @updates Dep-Install firewalld-filesystem-0.6.3-13.el7_9.noarch @updates Install nftables-1:0.8-14.el7.x86_64 @base ... ``` `firewalld` is the only reverse dependency on EL7, so there is no way to install `fail2ban` there without it: ```text # rpm -q --whatrequires firewalld fail2ban-firewalld-0.11.2-3.el7.noarch ``` The resulting zone / ruleset (empty `ports:` is the whole problem): ```text # firewall-cmd --list-all public (active) target: default interfaces: eth0 services: dhcpv6-client ssh ports: ``` ```text # iptables -L INPUT -n -v --line-numbers Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 19668 5223K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED 2 727 43600 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 ... 7 22881 4478K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited # iptables -L IN_public_allow -n -v Chain IN_public_allow (1 references) pkts bytes target prot opt in out source destination 18 1104 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW,UNTRACKED ``` `firewalld` was enabled at install time but only *started* at the reboot — the firewall log contains a single line, timestamped at boot, not at package-install time: ```text # systemctl is-enabled firewalld ; systemctl is-active firewalld enabled active # cat /var/log/firewalld 2026-09-16 09:39:34 WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. ... ``` Meanwhile the panel and Xray are up and listening — only the firewall is blocking them: ```text # ss -tlnp | grep -E '44328|2096|3000' LISTEN 0 4096 [::]:2096 *:* users:(("x-ui",pid=854,fd=16)) LISTEN 0 4096 [::]:30000 *:* users:(("xray-linux-amd6",pid=865,fd=9)) LISTEN 0 4096 [::]:30001 *:* users:(("xray-linux-amd6",pid=865,fd=11)) LISTEN 0 4096 [::]:30003 *:* users:(("xray-linux-amd6",pid=865,fd=10)) LISTEN 0 4096 [::]:30007 *:* users:(("xray-linux-amd6",pid=865,fd=5)) LISTEN 0 4096 [::]:44328 *:* users:(("x-ui",pid=854,fd=10)) # curl -sk -o /dev/null -w '%{http_code}\n' https://127.0.0.1:44328/<basePath>/ 200 ``` ### 3x-ui version 3.8.5 ### Xray-core version 26.9.9 ### How did you install 3x-ui? install.sh script ### Operating system CentOS 7.9 (EL7), kernel 5.4.x, KVM VPS. The image had `firewalld` removed at provisioning time (`yum history` shows an `-y remove firewalld linux-firmware` transaction), so the host had no firewall at all before the upgrade. ### Which parts of the panel are affected? Install / upgrade script ### Is the panel behind a reverse proxy or CDN? No — direct access ### Before submitting - [x] I searched [existing issues](https://github.com/MHSanaei/3x-ui/issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs). ### Additional context **Root cause.** `x-ui.sh` → `setup_fail2ban_iplimit()` → the `centos)` branch: ```bash centos) if [[ "${VERSION_ID}" =~ ^7 ]]; then yum makecache -y && yum install epel-release -y yum -y install fail2ban nftables else dnf makecache -y && dnf -y install fail2ban nftables fi ;; ``` The comment above this block explains that `nftables` was added so the *default sshd jail* would not log `nft: not found`, and it explicitly mentions "fresh RHEL-family" systems. The problem is that on EL7 the same command also drags in `firewalld`, and nothing in the script ever accounts for that: `install_firewall()` only implements `ufw`, so there is no firewalld code path anywhere, and no port is ever opened in its zone. Because the RPM only *enables* the unit (systemd preset) without starting it, the breakage is deferred to the next boot — which makes it very hard to connect the symptom back to the install/upgrade that caused it. Debian/Ubuntu are unaffected, which likely explains why this has gone unnoticed. **Impact.** Any EL7 deployment that did not already have `firewalld` installed loses all non-SSH connectivity after the first reboot following a 3x-ui install or upgrade. **Suggested fix (any of these).** 1. On the RHEL family, if `firewalld` was pulled in by *this* transaction and was not present/running before, leave it disabled afterwards (`systemctl disable --now firewalld`). The `3x-ipl` jail uses plain iptables (`before = iptables-allports.conf`) and does not need firewalld, so IP Limit keeps working. 2. Or open the panel port in the firewalld zone before reloading, and tell the operator that inbound ports must be opened manually. 3. Or, at minimum, print a prominent warning when the transaction introduces `firewalld`, so the operator is not left debugging a "panel is down" symptom that has nothing to do with the panel. **Workaround for affected users** (IP Limit / fail2ban keeps working): ```bash systemctl disable --now firewalld ``` **Note.** As of this report, `x-ui.sh` on `main` still contains the same block.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 16, 2026):

Confirmed — this is a real bug, and your root-cause analysis matches the source line for line. The install/upgrade path does run the fail2ban package transaction unattended on EL7, and there is no firewalld handling anywhere in the repository, so nothing detects or compensates for a firewall arriving as a dependency.

What I verified in the source

The transaction is unattended, on both install and upgrade.

  • install.sh:1828 calls setup_fail2ban at the end of a fresh install; it shells out to the CLI at install.sh:1405 — if /usr/bin/x-ui setup-fail2ban; then.
  • update.sh:1266 does the same on every upgrade, which is the path x-ui update and the panel self-updater both take.
  • x-ui.sh:3593 maps that subcommand to setup_fail2ban_iplimit.

The EL7 branch is exactly as you quoted (x-ui.sh:2317):

centos)
    if [[ "${VERSION_ID}" =~ ^7 ]]; then
        yum makecache -y && yum install epel-release -y
        yum -y install fail2ban nftables
    else
        dnf makecache -y && dnf -y install fail2ban nftables
    fi
    ;;

It is reached only when fail2ban is absent — x-ui.sh:2279: if ! command -v fail2ban-client &> /dev/null; then — which is why hosts that already had fail2ban (or already had firewalld) never see this.

Nothing in the repository knows firewalld exists. A grep for firewalld across all *.sh, *.go and *.md returns zero hits. install_firewall() (x-ui.sh:1080) is ufw-only and apt-get-only:

if ! command -v ufw &> /dev/null; then
    echo "ufw firewall is not installed. Installing now..."
    apt-get update
    apt-get install -y ufw

so it cannot even run on EL7, and every other entry in firewall_menu (x-ui.sh:1031-1078) calls ufw directly. The docs page for this is ufw/nftables-only too (docs/content/docs/en/reference/ports-firewall.mdx:3).

Your point that the IP Limit jail does not need firewalld is correct. The jail pins its own action (x-ui.sh:2523, action=3x-ipl), and that action is raw iptables (x-ui.sh:2551, before = iptables-allports.conf; x-ui.sh:2564, actionban = <iptables> -I f2b-<name> 1 -s <ip> ...). Disabling firewalld therefore does not break IP Limit.

When it became unattended. 0d764f1b — "feat(iplimit): auto-install fail2ban on install and update" (2026-06-22), first shipped in v3.4.0. Before that commit the same yum transaction existed but only ran when an operator chose the IP Limit menu item. 71ac9204 (2026-04-22) added nftables to that command, but per your yum history the firewalld chain comes from fail2ban itself, not from nftables. Still present on the default branch at the tip; v3.8.5 is the latest release, so there is nothing newer to upgrade into.

What I could not verify

I have no access to EPEL package metadata from here, so the fail2ban → fail2ban-firewalld → firewalld dependency edge and the systemd-preset enablement rest on your yum history info and rpm -q --whatrequires firewalld output rather than on anything in this repo. Both of those are self-consistent and I have no reason to doubt them. I could not read the firewall-cmd output you pasted as anything other than text, which is all that was needed.

Workaround for anyone hitting this

Check first, on any EL7 host that ran a 3x-ui install or upgrade and has not yet rebooted — this is the window where the host still looks healthy:

rpm -q firewalld && systemctl is-enabled firewalld

If that prints enabled, either drop the firewall you did not ask for (IP Limit keeps working, per the jail lines above):

systemctl disable --now firewalld

or keep it and open your own ports before rebooting — substitute your panel port, your subscription port and every inbound port:

firewall-cmd --permanent --add-port=44328/tcp
firewall-cmd --permanent --add-port=2096/tcp
firewall-cmd --permanent --add-port=30000/tcp
firewall-cmd --reload

Verdict: Confirmed bug
Severity: High
Confidence: High for the panel-side chain (every line cited above); the EPEL dependency edge is reporter-supplied, see "What I could not verify"
Root cause: setup_fail2ban_iplimit() in x-ui.sh:2270, the centos) EL7 branch at x-ui.sh:2317, runs yum -y install fail2ban nftables unattended from install.sh:1828 / update.sh:1266, and no code path in the repository inspects, disables or configures a firewall the transaction may have introduced. Triggers when ID=centos and VERSION_ID starts with 7 and fail2ban-client is absent (x-ui.sh:2279) and firewalld was not already installed. Made unattended by 0d764f1b (v3.4.0); the same command was previously menu-driven.
Already fixed: Still present on the default branch — x-ui.sh:2317 is unchanged at the tip, and v3.8.5 is the latest release
Duplicate of: None. gh search issues "firewalld" and a search for firewall/reboot/unreachable return no other report of this
Evidence: install.sh:1405 if /usr/bin/x-ui setup-fail2ban; then; install.sh:1828 setup_fail2ban; update.sh:1266 setup_fail2ban; x-ui.sh:2279 if ! command -v fail2ban-client &> /dev/null; then; x-ui.sh:2320 yum -y install fail2ban nftables; x-ui.sh:1083 apt-get install -y ufw inside install_firewall(); x-ui.sh:2551 before = iptables-allports.conf; x-ui.sh:2564 actionban = <iptables> -I f2b-<name> 1 -s <ip> -p tcp -m multiport ! --dports <exemptports> -j <blocktype>; commit 0d764f1b; zero firewalld hits repo-wide
Not determined: Whether the RHEL-family branch at x-ui.sh:2309 (dnf -y install fail2ban nftables, used for fedora/rhel/almalinux/rocky/ol/amzn and CentOS 8+) pulls the same fail2ban-firewalld dependency — if it does, the fix belongs in both branches rather than only the EL7 one. It would matter less there because those images usually ship firewalld enabled already, so the transaction changes nothing. dnf repoquery --requires --resolve fail2ban on an EL8/EL9 host settles it.

Suggested fix: in setup_fail2ban_iplimit() (x-ui.sh:2270), record on the RPM branches whether firewalld was installed and active before the transaction, and if the transaction introduced it, leave it disabled — the 3x-ipl action is iptables-only (x-ui.sh:2551) and never needs it. If leaving it enabled is preferred, the minimum is a loud warning naming the panel port, since the breakage is deferred to the next boot and reads as "the panel died". Whichever way it goes, install_firewall() being ufw/apt-only means there is no in-menu remediation path on the RHEL family today.

@MHSanaei flagging this one: a 3x-ui install or upgrade on a CentOS 7 host with no firewalld takes the panel, the subscription port and every inbound offline at the next reboot, with no firewall-related output at install time.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5695935671 --> @github-actions[bot] commented on GitHub (Sep 16, 2026): Confirmed — this is a real bug, and your root-cause analysis matches the source line for line. The install/upgrade path does run the fail2ban package transaction unattended on EL7, and there is no firewalld handling anywhere in the repository, so nothing detects or compensates for a firewall arriving as a dependency. ## What I verified in the source **The transaction is unattended, on both install and upgrade.** * `install.sh:1828` calls `setup_fail2ban` at the end of a fresh install; it shells out to the CLI at `install.sh:1405` — `if /usr/bin/x-ui setup-fail2ban; then`. * `update.sh:1266` does the same on every upgrade, which is the path `x-ui update` and the panel self-updater both take. * `x-ui.sh:3593` maps that subcommand to `setup_fail2ban_iplimit`. **The EL7 branch is exactly as you quoted** (`x-ui.sh:2317`): ```bash centos) if [[ "${VERSION_ID}" =~ ^7 ]]; then yum makecache -y && yum install epel-release -y yum -y install fail2ban nftables else dnf makecache -y && dnf -y install fail2ban nftables fi ;; ``` It is reached only when fail2ban is absent — `x-ui.sh:2279`: `if ! command -v fail2ban-client &> /dev/null; then` — which is why hosts that already had fail2ban (or already had firewalld) never see this. **Nothing in the repository knows firewalld exists.** A grep for `firewalld` across all `*.sh`, `*.go` and `*.md` returns zero hits. `install_firewall()` (`x-ui.sh:1080`) is ufw-only and `apt-get`-only: ```bash if ! command -v ufw &> /dev/null; then echo "ufw firewall is not installed. Installing now..." apt-get update apt-get install -y ufw ``` so it cannot even run on EL7, and every other entry in `firewall_menu` (`x-ui.sh:1031`-`1078`) calls `ufw` directly. The docs page for this is ufw/nftables-only too (`docs/content/docs/en/reference/ports-firewall.mdx:3`). **Your point that the IP Limit jail does not need firewalld is correct.** The jail pins its own action (`x-ui.sh:2523`, `action=3x-ipl`), and that action is raw iptables (`x-ui.sh:2551`, `before = iptables-allports.conf`; `x-ui.sh:2564`, `actionban = <iptables> -I f2b-<name> 1 -s <ip> ...`). Disabling firewalld therefore does not break IP Limit. **When it became unattended.** `0d764f1b` — *"feat(iplimit): auto-install fail2ban on install and update"* (2026-06-22), first shipped in **v3.4.0**. Before that commit the same `yum` transaction existed but only ran when an operator chose the IP Limit menu item. `71ac9204` (2026-04-22) added `nftables` to that command, but per your `yum history` the firewalld chain comes from `fail2ban` itself, not from `nftables`. Still present on the default branch at the tip; v3.8.5 is the latest release, so there is nothing newer to upgrade into. ## What I could not verify I have no access to EPEL package metadata from here, so the `fail2ban` → `fail2ban-firewalld` → `firewalld` dependency edge and the systemd-preset enablement rest on your `yum history info` and `rpm -q --whatrequires firewalld` output rather than on anything in this repo. Both of those are self-consistent and I have no reason to doubt them. I could not read the `firewall-cmd` output you pasted as anything other than text, which is all that was needed. ## Workaround for anyone hitting this Check first, on any EL7 host that ran a 3x-ui install or upgrade and has **not yet rebooted** — this is the window where the host still looks healthy: ```bash rpm -q firewalld && systemctl is-enabled firewalld ``` If that prints `enabled`, either drop the firewall you did not ask for (IP Limit keeps working, per the jail lines above): ```bash systemctl disable --now firewalld ``` or keep it and open your own ports before rebooting — substitute your panel port, your subscription port and every inbound port: ```bash firewall-cmd --permanent --add-port=44328/tcp firewall-cmd --permanent --add-port=2096/tcp firewall-cmd --permanent --add-port=30000/tcp firewall-cmd --reload ``` Verdict: Confirmed bug Severity: High Confidence: High for the panel-side chain (every line cited above); the EPEL dependency edge is reporter-supplied, see "What I could not verify" Root cause: `setup_fail2ban_iplimit()` in `x-ui.sh:2270`, the `centos)` EL7 branch at `x-ui.sh:2317`, runs `yum -y install fail2ban nftables` unattended from `install.sh:1828` / `update.sh:1266`, and no code path in the repository inspects, disables or configures a firewall the transaction may have introduced. Triggers when `ID=centos` and `VERSION_ID` starts with 7 and `fail2ban-client` is absent (`x-ui.sh:2279`) and firewalld was not already installed. Made unattended by `0d764f1b` (v3.4.0); the same command was previously menu-driven. Already fixed: Still present on the default branch — `x-ui.sh:2317` is unchanged at the tip, and v3.8.5 is the latest release Duplicate of: None. `gh search issues "firewalld"` and a search for firewall/reboot/unreachable return no other report of this Evidence: `install.sh:1405` `if /usr/bin/x-ui setup-fail2ban; then`; `install.sh:1828` `setup_fail2ban`; `update.sh:1266` `setup_fail2ban`; `x-ui.sh:2279` `if ! command -v fail2ban-client &> /dev/null; then`; `x-ui.sh:2320` `yum -y install fail2ban nftables`; `x-ui.sh:1083` `apt-get install -y ufw` inside `install_firewall()`; `x-ui.sh:2551` `before = iptables-allports.conf`; `x-ui.sh:2564` `actionban = <iptables> -I f2b-<name> 1 -s <ip> -p tcp -m multiport ! --dports <exemptports> -j <blocktype>`; commit `0d764f1b`; zero `firewalld` hits repo-wide Not determined: Whether the RHEL-family branch at `x-ui.sh:2309` (`dnf -y install fail2ban nftables`, used for fedora/rhel/almalinux/rocky/ol/amzn and CentOS 8+) pulls the same `fail2ban-firewalld` dependency — if it does, the fix belongs in both branches rather than only the EL7 one. It would matter less there because those images usually ship firewalld enabled already, so the transaction changes nothing. `dnf repoquery --requires --resolve fail2ban` on an EL8/EL9 host settles it. Suggested fix: in `setup_fail2ban_iplimit()` (`x-ui.sh:2270`), record on the RPM branches whether firewalld was installed and active *before* the transaction, and if the transaction introduced it, leave it disabled — the `3x-ipl` action is iptables-only (`x-ui.sh:2551`) and never needs it. If leaving it enabled is preferred, the minimum is a loud warning naming the panel port, since the breakage is deferred to the next boot and reads as "the panel died". Whichever way it goes, `install_firewall()` being ufw/apt-only means there is no in-menu remediation path on the RHEL family today. @MHSanaei flagging this one: a 3x-ui install or upgrade on a CentOS 7 host with no firewalld takes the panel, the subscription port and every inbound offline at the next reboot, with no firewall-related output at install time. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@Drswith commented on GitHub (Sep 16, 2026):

Follow-up: I independently verified the two items you flagged, and there is one correction to the impact estimate. Patch attached at the end.


1. The EPEL dependency edge — independently reproduced

You noted this edge rested on my rpm output rather than on anything reproducible here. Reproduced from scratch in a clean EL7 container (no firewalld, no fail2ban), running the exact command from x-ui.sh:2320:

$ rpm -q firewalld fail2ban
package firewalld is not installed
package fail2ban is not installed

$ yum -y install fail2ban nftables
...
Complete!

$ rpm -q firewalld
firewalld-0.6.3-13.el7_9.noarch

$ rpm -qR fail2ban | grep firewall
fail2ban-firewalld = 0.9.7-1.el7

$ rpm -qR fail2ban-firewalld | grep firewall
firewalld

2. Not determined -> the RHEL-family branch is affected too

The same edge exists on EL9:

$ dnf repoquery --requires --resolve fail2ban
fail2ban-firewalld-0:1.1.0-6.el9.noarch
fail2ban-sendmail-0:1.1.0-6.el9.noarch
fail2ban-server-0:1.1.0-6.el9.noarch

$ dnf repoquery --requires --resolve fail2ban-firewalld
fail2ban-server-0:1.1.0-6.el9.noarch
firewalld-0:1.3.4-19.el9_8.noarch

So the branch at x-ui.sh:2315 (dnf -y install fail2ban nftables, used by fedora/rhel/almalinux/rocky/ol/amzn and CentOS 8+) carries the same dependency. Note that the base rockylinux:9 image does not ship firewalld, so "those images usually ship firewalld enabled already" does not hold for minimal or container images.

3. Why it stays silent until a reboot — mechanism confirmed

firewalld's %post only enables the unit; it never starts it:

$ rpm -q --scripts firewalld | sed -n '/postinstall/,/preuninstall/p'
postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then
        # Initial installation
        systemctl preset firewalld.service >/dev/null 2>&1 || :
fi

And on EL7 that preset resolves to enable:

$ grep -rn firewall /usr/lib/systemd/system-preset/
/usr/lib/systemd/system-preset/90-default.preset:31:enable firewalld.service

(99-default-disable.preset contains disable *, but preset is first-match-wins and 90-default.preset sorts earlier.)

The zone that then applies has no port entries at all:

$ cat /usr/lib/firewalld/zones/public.xml
<zone>
  <short>Public</short>
  ...
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
</zone>

which is why the panel port, the subscription port and every inbound port are rejected after the first boot, while SSH keeps working.

4. Patch

Adds a disable_pulled_in_firewalld helper, records whether firewalld existed before the transaction, and calls the helper after the install. The detection and the call both sit outside the case "${release}" block, so every OS branch is covered — no separate EL9 change is needed.

fix-el7-firewalld.patch (applies to x-ui.sh)
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -2266,7 +2266,39 @@
             ;;
     esac
 }
+
+
+# RHEL-family note: EPEL's `fail2ban` hard-requires `fail2ban-firewalld`,
+# which hard-requires `firewalld`. On EL7 `firewalld` is the only reverse
+# dependency of `fail2ban-firewalld`, so there is no way to install fail2ban
+# there without also installing firewalld. The RPM only *enables* the unit
+# (systemd preset) without starting it, so nothing breaks at install time --
+# but on the next boot firewalld comes up with its default `public` zone
+# (ssh + dhcpv6-client only) and rejects the panel port and every inbound
+# port, which presents as "the panel is down" even though it is running fine.
+#
+# The 3x-ipl jail uses plain iptables (`before = iptables-allports.conf`), so
+# firewalld is not required for IP Limit. If it was not installed before this
+# transaction, disable it again and leave the host as the operator had it.
+disable_pulled_in_firewalld() {
+    local preinstalled="${1:-1}"
 
+    command -v firewall-cmd &> /dev/null || return 0
+
+    # Never reconfigure an active firewall: it may be the operator's own setup.
+    if systemctl is-active --quiet firewalld 2> /dev/null; then
+        echo -e "${yellow}firewalld is active -- make sure the panel port and every inbound port are open,${plain}"
+        echo -e "${yellow}otherwise clients will not be able to connect.${plain}\n"
+        return 0
+    fi
+
+    [[ "${preinstalled}" -eq 0 ]] || return 0
+
+    systemctl disable --now firewalld &> /dev/null || true
+    echo -e "${yellow}firewalld was pulled in as a dependency of fail2ban and has been disabled.${plain}"
+    echo -e "${yellow}The 3x-ipl jail uses iptables, so IP Limit keeps working without it.${plain}\n"
+}
+
 setup_fail2ban_iplimit() {
     # Honor the same toggle the panel uses (isFail2BanEnabled): enabled when the
     # var is unset or exactly "true"; any other explicit value means the operator
@@ -2278,6 +2310,10 @@
 
     if ! command -v fail2ban-client &> /dev/null; then
         echo -e "${green}Fail2ban is not installed. Installing now...!${plain}\n"
+        # Remember whether firewalld existed before this transaction: on the
+        # RHEL family the install below can drag it in as a dependency.
+        local firewalld_preinstalled=0
+        rpm -q firewalld &> /dev/null && firewalld_preinstalled=1
 
         # Install fail2ban together with nftables. Recent fail2ban packages
         # default to `banaction = nftables-multiport` in /etc/fail2ban/jail.conf,
@@ -2340,6 +2376,7 @@
         fi
 
         echo -e "${green}Fail2ban installed successfully!${plain}\n"
+        disable_pulled_in_firewalld "${firewalld_preinstalled}"
     else
         echo -e "${yellow}Fail2ban is already installed.${plain}\n"
     fi

5. Testing

Applied to x-ui.sh and run as /usr/bin/x-ui setup-fail2ban on a clean EL7 container — real yum transaction, real RPM state, real script:

$ rpm -q firewalld fail2ban
package firewalld is not installed
package fail2ban is not installed

$ /usr/bin/x-ui setup-fail2ban
...
Fail2ban installed successfully!
firewalld was pulled in as a dependency of fail2ban and has been disabled.
The 3x-ipl jail uses iptables, so IP Limit keeps working without it.
Configuring IP Limit...
Ip Limit jail files created with a bantime of 30 minutes.
IP Limit installed and configured successfully!

systemctl invocations observed (recorded with a stub, since containers have no systemd):

is-active --quiet firewalld      <- firewalld detected as not running
disable --now firewalld          <- action taken
is-active --quiet fail2ban       <- existing flow untouched
start fail2ban
enable fail2ban

The helper's branches were exercised separately: firewalld absent before the transaction -> disabled; firewalld present before -> no action; firewalld present and active -> warning only, never reconfigures an operator's running firewall; no argument (default) -> no action.


Happy to open this as a PR if the approach looks right. The one open design question is whether the check should stay precise (act only when firewalld was genuinely absent before the transaction, which is what the patch does) or be widened to also rescue hosts that already hit this (act whenever firewalld is enabled but not running).

<!-- gh-comment-id:5696531087 --> @Drswith commented on GitHub (Sep 16, 2026): Follow-up: I independently verified the two items you flagged, and there is one correction to the impact estimate. Patch attached at the end. --- ## 1. The EPEL dependency edge — independently reproduced You noted this edge rested on my `rpm` output rather than on anything reproducible here. Reproduced from scratch in a clean EL7 container (no `firewalld`, no `fail2ban`), running the exact command from `x-ui.sh:2320`: ```console $ rpm -q firewalld fail2ban package firewalld is not installed package fail2ban is not installed $ yum -y install fail2ban nftables ... Complete! $ rpm -q firewalld firewalld-0.6.3-13.el7_9.noarch $ rpm -qR fail2ban | grep firewall fail2ban-firewalld = 0.9.7-1.el7 $ rpm -qR fail2ban-firewalld | grep firewall firewalld ``` ## 2. `Not determined` -> the RHEL-family branch is affected too The same edge exists on EL9: ```console $ dnf repoquery --requires --resolve fail2ban fail2ban-firewalld-0:1.1.0-6.el9.noarch fail2ban-sendmail-0:1.1.0-6.el9.noarch fail2ban-server-0:1.1.0-6.el9.noarch $ dnf repoquery --requires --resolve fail2ban-firewalld fail2ban-server-0:1.1.0-6.el9.noarch firewalld-0:1.3.4-19.el9_8.noarch ``` So the branch at `x-ui.sh:2315` (`dnf -y install fail2ban nftables`, used by fedora/rhel/almalinux/rocky/ol/amzn and CentOS 8+) carries the same dependency. Note that the base `rockylinux:9` image does **not** ship firewalld, so "those images usually ship firewalld enabled already" does not hold for minimal or container images. ## 3. Why it stays silent until a reboot — mechanism confirmed `firewalld`'s `%post` only *enables* the unit; it never starts it: ```console $ rpm -q --scripts firewalld | sed -n '/postinstall/,/preuninstall/p' postinstall scriptlet (using /bin/sh): if [ $1 -eq 1 ] ; then # Initial installation systemctl preset firewalld.service >/dev/null 2>&1 || : fi ``` And on EL7 that `preset` resolves to *enable*: ```console $ grep -rn firewall /usr/lib/systemd/system-preset/ /usr/lib/systemd/system-preset/90-default.preset:31:enable firewalld.service ``` (`99-default-disable.preset` contains `disable *`, but preset is first-match-wins and `90-default.preset` sorts earlier.) The zone that then applies has no port entries at all: ```console $ cat /usr/lib/firewalld/zones/public.xml <zone> <short>Public</short> ... <service name="ssh"/> <service name="dhcpv6-client"/> </zone> ``` which is why the panel port, the subscription port and every inbound port are rejected after the first boot, while SSH keeps working. ## 4. Patch Adds a `disable_pulled_in_firewalld` helper, records whether `firewalld` existed before the transaction, and calls the helper after the install. The detection and the call both sit **outside** the `case "${release}"` block, so every OS branch is covered — no separate EL9 change is needed. <details> <summary><code>fix-el7-firewalld.patch</code> (applies to <code>x-ui.sh</code>)</summary> ```diff --- a/x-ui.sh +++ b/x-ui.sh @@ -2266,7 +2266,39 @@ ;; esac } + + +# RHEL-family note: EPEL's `fail2ban` hard-requires `fail2ban-firewalld`, +# which hard-requires `firewalld`. On EL7 `firewalld` is the only reverse +# dependency of `fail2ban-firewalld`, so there is no way to install fail2ban +# there without also installing firewalld. The RPM only *enables* the unit +# (systemd preset) without starting it, so nothing breaks at install time -- +# but on the next boot firewalld comes up with its default `public` zone +# (ssh + dhcpv6-client only) and rejects the panel port and every inbound +# port, which presents as "the panel is down" even though it is running fine. +# +# The 3x-ipl jail uses plain iptables (`before = iptables-allports.conf`), so +# firewalld is not required for IP Limit. If it was not installed before this +# transaction, disable it again and leave the host as the operator had it. +disable_pulled_in_firewalld() { + local preinstalled="${1:-1}" + command -v firewall-cmd &> /dev/null || return 0 + + # Never reconfigure an active firewall: it may be the operator's own setup. + if systemctl is-active --quiet firewalld 2> /dev/null; then + echo -e "${yellow}firewalld is active -- make sure the panel port and every inbound port are open,${plain}" + echo -e "${yellow}otherwise clients will not be able to connect.${plain}\n" + return 0 + fi + + [[ "${preinstalled}" -eq 0 ]] || return 0 + + systemctl disable --now firewalld &> /dev/null || true + echo -e "${yellow}firewalld was pulled in as a dependency of fail2ban and has been disabled.${plain}" + echo -e "${yellow}The 3x-ipl jail uses iptables, so IP Limit keeps working without it.${plain}\n" +} + setup_fail2ban_iplimit() { # Honor the same toggle the panel uses (isFail2BanEnabled): enabled when the # var is unset or exactly "true"; any other explicit value means the operator @@ -2278,6 +2310,10 @@ if ! command -v fail2ban-client &> /dev/null; then echo -e "${green}Fail2ban is not installed. Installing now...!${plain}\n" + # Remember whether firewalld existed before this transaction: on the + # RHEL family the install below can drag it in as a dependency. + local firewalld_preinstalled=0 + rpm -q firewalld &> /dev/null && firewalld_preinstalled=1 # Install fail2ban together with nftables. Recent fail2ban packages # default to `banaction = nftables-multiport` in /etc/fail2ban/jail.conf, @@ -2340,6 +2376,7 @@ fi echo -e "${green}Fail2ban installed successfully!${plain}\n" + disable_pulled_in_firewalld "${firewalld_preinstalled}" else echo -e "${yellow}Fail2ban is already installed.${plain}\n" fi ``` </details> ## 5. Testing Applied to `x-ui.sh` and run as `/usr/bin/x-ui setup-fail2ban` on a clean EL7 container — real `yum` transaction, real RPM state, real script: ```console $ rpm -q firewalld fail2ban package firewalld is not installed package fail2ban is not installed $ /usr/bin/x-ui setup-fail2ban ... Fail2ban installed successfully! firewalld was pulled in as a dependency of fail2ban and has been disabled. The 3x-ipl jail uses iptables, so IP Limit keeps working without it. Configuring IP Limit... Ip Limit jail files created with a bantime of 30 minutes. IP Limit installed and configured successfully! ``` `systemctl` invocations observed (recorded with a stub, since containers have no systemd): ```console is-active --quiet firewalld <- firewalld detected as not running disable --now firewalld <- action taken is-active --quiet fail2ban <- existing flow untouched start fail2ban enable fail2ban ``` The helper's branches were exercised separately: firewalld absent before the transaction -> disabled; firewalld present before -> no action; firewalld present *and active* -> warning only, never reconfigures an operator's running firewall; no argument (default) -> no action. --- Happy to open this as a PR if the approach looks right. The one open design question is whether the check should stay precise (act only when `firewalld` was genuinely absent before the transaction, which is what the patch does) or be widened to also rescue hosts that already hit this (act whenever `firewalld` is enabled but not running).
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#4404
No description provided.