[PR #5184] [MERGED] fix: properly configure fail2ban backend and dependencies on Ubuntu 22.04+ (#5159) #5810

Closed
opened 2026-11-02 04:04:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5184
Author: @rqzbeh
Created: 6/10/2026
Status: ✅ Merged
Merged: 6/10/2026
Merged by: @MHSanaei

Base: main ← Head: fix/fail2ban-sshd-log


📝 Commits (2)

  • 3dbba46 fix: properly configure fail2ban backend and dependencies on Ubuntu 22.04+ (#5159)
  • c322e86 Merge branch 'main' into fix/fail2ban-sshd-log

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 x-ui.sh (+3 -3)

📄 Description

Fixes #5159

Summary

When installing Fail2ban via the \x-ui.sh\ script on Ubuntu 22.04+, the \ ail2ban-server\ can crash during startup with the error:
\ERROR Failed during configuration: Have not found any log file for sshd jail\

This happens because Ubuntu 22.04+ (like Debian 12+) logs SSH attempts strictly to the systemd journal, rather than flat files like /var/log/auth.log. Fail2ban ships with an \sshd\ jail enabled by default that assumes a flat file backend (\uto). When it fails to find the file, it crashes. This PR updates the script to correctly switch the fail2ban backend to \systemd\ globally on Ubuntu 22.04+, mirroring the existing logic for Debian 12+.

Additionally, this PR fixes a benign script bug where the installer attempted to run \python3 -m pip install pyasynchat --break-system-packages\ on Ubuntu 22.04 because of an incorrect OS version comparison. The \os_version\ variable resolves to \2204\ rather than \22, so the script's check of -ge 24\ was matching incorrectly. This has been corrected to -ge 2400\ so the command only runs on Ubuntu 24.04+.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • \go build ./...\ and the test suite pass locally.
  • For frontend changes:
    pm run lint,
    pm run typecheck, and
    pm run build\ pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 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/5184 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 6/10/2026 **Status:** ✅ Merged **Merged:** 6/10/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/fail2ban-sshd-log` --- ### 📝 Commits (2) - [`3dbba46`](https://github.com/MHSanaei/3x-ui/commit/3dbba463a1866b73d7aabc8c4ae84af538fb931b) fix: properly configure fail2ban backend and dependencies on Ubuntu 22.04+ (#5159) - [`c322e86`](https://github.com/MHSanaei/3x-ui/commit/c322e860456dccc560a11cbbc9929145eac13c22) Merge branch 'main' into fix/fail2ban-sshd-log ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `x-ui.sh` (+3 -3) </details> ### 📄 Description Fixes #5159 ## Summary When installing Fail2ban via the \x-ui.sh\ script on Ubuntu 22.04+, the \ ail2ban-server\ can crash during startup with the error: \ERROR Failed during configuration: Have not found any log file for sshd jail\ This happens because Ubuntu 22.04+ (like Debian 12+) logs SSH attempts strictly to the systemd journal, rather than flat files like \/var/log/auth.log\. Fail2ban ships with an \sshd\ jail enabled by default that assumes a flat file backend (\uto\). When it fails to find the file, it crashes. This PR updates the script to correctly switch the fail2ban backend to \systemd\ globally on Ubuntu 22.04+, mirroring the existing logic for Debian 12+. Additionally, this PR fixes a benign script bug where the installer attempted to run \python3 -m pip install pyasynchat --break-system-packages\ on Ubuntu 22.04 because of an incorrect OS version comparison. The \os_version\ variable resolves to \2204\ rather than \22\, so the script's check of \-ge 24\ was matching incorrectly. This has been corrected to \-ge 2400\ so the command only runs on Ubuntu 24.04+. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [ ] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [x] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [ ] I added or updated tests for the new behavior (when applicable). - [ ] \go build ./...\ and the test suite pass locally. - [ ] For frontend changes: \ pm run lint\, \ pm run typecheck\, and \ pm run build\ pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:13 +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#5810
No description provided.