-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added IP Limit Management to x-ui menu, Tweaked IP Limit to check every 20s #615
Conversation
somebodywashere
commented
Jun 17, 2023
•
edited
edited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your excellent work. there are a few changes that need to be made:
Thanks for your deep review, will fix all of this nuances. |
Updated everything. Please check because I didn't have time to test yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I just tested it, and i found a few bugs that need to be fixed.
I also checked the status of fail2ban using the command systemctl status fail2ban
,
and it returned an error message stating:
ERROR Failed during configuration: Have not found any log file for 3x-ipl jail
Should we change the logpath in the /etc/fail2ban/jail.local
file, or something else causing the issue?
Small fixes Co-authored-by: Hamidreza <70919649+hamid-gh98@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Co-authored-by: Ho3ein <ho3ein.sanaei@gmail.com>
Few changes and additions to IP Limit Management
x-ui.sh
Outdated
echo -e "${green}All users Unbanned successfully.${plain}" ;; | ||
4) | ||
if test -f "/var/log/3xipl-banned.log"; then | ||
cat /var/log/3xipl-banned.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cat /var/log/3xipl-banned.log | |
cat /var/log/3xipl-banned.log | |
echo -e "${green}Done.${plain}\n" | |
iplimit_main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't add anything else to keep it the same like when you check logs of x-ui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, no problem
#Check if [3x-ipl] exists in jail.local (just making sure there's no double config for jail) | ||
if grep -qw '3x-ipl' /etc/fail2ban/jail.local || grep -qw '3x-ipl' /etc/fail2ban/jail.conf; then | ||
echo -e "${red}Found conflicts in /etc/fail2ban/jail.conf or jail.local file!\nPlease manually remove anything related 3x-ipl in that files and try again.\nInstallation of IP Limit failed.${plain}\n" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to check if the 3x-ipl
jail exists in both jail.conf
and jail.local
files and remove it if found. also, overwrite the 3x-ipl
jail config in the jail.d/3x-ipl.conf
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I did it in the code, didn't I?🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't find a good way to remove it from the file. There shouldn't be anyone with our 3x-ipl jail inside jail.local besides me, you and Ho3ein. If someone add something with the same name to the jail.local or jail.conf they also can remove it manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it was in one your previous commits, but its not there now.
here you just show the message and exit with error and then write the jail.d/3x-ipl.conf
so i think its better to remove the jail from that files instead of throwing error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't find a good way to remove it from the file. There shouldn't be anyone with our 3x-ipl jail inside jail.local besides me, you and Ho3ein. If someone add something with the same name to the jail.local or jail.conf they also can remove it manually
ok. thank you again. good job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we are not installing it now in jail.local so no problem here. Code is somewhat redundant but we can keep it. It's only 3 rows
Return to iplimit_main on unban Co-authored-by: Hamidreza <70919649+hamid-gh98@users.noreply.github.com>
Optimised launching of fail2ban
how we can use it ?? i cant add on x-ui |
|
بسیار تشکر |