mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #580] [MERGED] Removed ipLimit from the panel, changed the code to work with fail2ban #4775
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4775
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/580
Author: @somebodywashere
Created: 6/9/2023
Status: ✅ Merged
Merged: 6/15/2023
Merged by: @MHSanaei
Base:
main← Head:main📝 Commits (9)
61a2e6dLogging for fail2ban serviceeb27951Logging for fail2ban servicef84897efixed shouldCleanLog29d854elast fixeb1bf11reduced ip limit detection frequency to 30 sec (less logging, more precise)411cf30fixed check delayb1cd912Merge branch 'MHSanaei:main' into main26d1212Merge branch 'MHSanaei:main' into main289a336added 5 seconds delay before cleaning logs📊 Changes
2 files changed (+28 additions, -126 deletions)
View changed files
📝
web/job/check_client_ip_job.go(+26 -124)📝
web/web.go(+2 -2)📄 Description
Hello! A wasted a couple of days trying to make stable and reliable Device limit with the base code (thorught cmd module you used).
But I made a decision to drop it completly from the panel because it still not that reliable, stable, pretty heave for machine and not configurable at all for end user.
So I just made logging of ips that get added to disAllowedIIps and configured fail2ban. It works like a charm now for me (tested 1 full day).
I did not fully removed whole code, because I noticed that disAllowed Ips somehow interact with XrayBlockedIPS.
fail2ban is pretty lightweight service that could be configured to use with UFW (I'm actually doing it) and perfectly suits for limiting devices aswell.
In my mind I think IP Limit should be optional and added to the main menu to configure (like WARP). Made a quick draft of commands to work:
sudo apt-get install fail2ban -ysudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.localsudo echo $'\n[3x-ipl]\nenabled=true\nfilter=3x-ipl\naction=iptables-allports\nlogpath=/var/log/daemon.log\nmaxretry=3\nfindtime=150\nbantime=300' >> /etc/fail2ban/jail.localsudo echo $'[Definition]\nfailregex = [LIMIT_IP].+SRC= <HOST>\nignoreregex =' >> /etc/fail2ban/filter.d/3x-ipl.confMy config for jail:
[3x-ipl]
enabled=true
filter=3x-ipl
action=iptables-allports
logpath=/var/log/daemon.log
maxretry=3
findtime=150
bantime=300
Still deciding of what will fit the best. Also you can integrate a few "presets" of configs like above.

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