Skip to content
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

Merged
merged 26 commits into from
Jun 24, 2023

Conversation

somebodywashere
Copy link
Collaborator

@somebodywashere somebodywashere commented Jun 17, 2023

image

Copy link
Contributor

@hamid-gh98 hamid-gh98 left a 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:

x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
@somebodywashere
Copy link
Collaborator Author

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.

@somebodywashere
Copy link
Collaborator Author

Updated everything. Please check because I didn't have time to test yet.

Copy link
Contributor

@hamid-gh98 hamid-gh98 left a 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?

image

x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@hamid-gh98 hamid-gh98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
web/job/check_client_ip_job.go Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
x-ui.sh Outdated Show resolved Hide resolved
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cat /var/log/3xipl-banned.log
cat /var/log/3xipl-banned.log
echo -e "${green}Done.${plain}\n"
iplimit_main

Copy link
Collaborator Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, no problem

Comment on lines +741 to +745
#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
Copy link
Contributor

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.

Copy link
Collaborator Author

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?🤔

Copy link
Collaborator Author

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

Copy link
Contributor

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.

Copy link
Contributor

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!

Copy link
Collaborator Author

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

@usamirali
Copy link

how we can use it ?? i cant add on x-ui
and 1 question my user all in port 443
this work for me ??

@hamid-gh98
Copy link
Contributor

how we can use it ?? i cant add on x-ui
and 1 question my user all in port 443
this work for me ??

  1. it's not merged yet, and it will be available on next release
  2. yes it will work on any port

@usamirali
Copy link

بسیار تشکر
برنامه ای برای سابلینک هم دارید ؟؟ که حجم و تاریخ رو به صورت یه کانفیگ فیک نشون بده

@MHSanaei MHSanaei merged commit 6e22aa5 into MHSanaei:main Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants