Added IP Limit Management to x-ui menu

This commit is contained in:
somebodywashere 2023-06-17 12:48:20 +00:00
parent b3088adb4e
commit 1e4e0e1a2d

19
x-ui.sh
View file

@ -518,9 +518,9 @@ install_acme() {
} }
ssl_cert_issue_main() { ssl_cert_issue_main() {
echo "${green}1.${plain} Get SSL" echo -e "${green}1.${plain} Get SSL"
echo "${green}2.${plain} Revoke" echo -e "${green}2.${plain} Revoke"
echo "${green}3.${plain} Force Renew" echo -e "${green}3.${plain} Force Renew"
read -p "Choose an option: " choice read -p "Choose an option: " choice
case "$choice" in case "$choice" in
1) ssl_cert_issue ;; 1) ssl_cert_issue ;;
@ -672,15 +672,17 @@ run_speedtest() {
} }
iplimit_main() { iplimit_main() {
echo "${green}1.${plain} Install Fail2ban and configure IP Limit" echo -e "${green}1.${plain} Install Fail2ban and configure IP Limit"
echo "${green}2.${plain} Uninstall" echo -e "${green}2.${plain} Uninstall"
echo "${green}3.${plain} Check logs" echo -e "${green}3.${plain} Check logs"
read -p "Choose an option: " choice read -p "Choose an option: " choice
case "$choice" in case "$choice" in
1) install_iplimit ;; 1) install_iplimit ;;
2) 2)
read -p "Remove Fail2ban aswell? (Default:n) [y/n]: " temp read -p "Remove Fail2ban aswell? (Default:n) [y/n]: " temp
if [[ "${temp}" == "y" || "${temp}" == "Y" ]]; then if [[ "${temp}" == "y" || "${temp}" == "Y" ]]; then
sudo systemctl disable fail2ban
sudo systemctl stop fail2ban
rm -f /etc/fail2ban/filter.d/3x-ipl.conf rm -f /etc/fail2ban/filter.d/3x-ipl.conf
rm -f /etc/fail2ban/action.d/3x-ipl.conf rm -f /etc/fail2ban/action.d/3x-ipl.conf
sudo apt-get remove fail2ban -y sudo apt-get remove fail2ban -y
@ -688,6 +690,7 @@ iplimit_main() {
rm -f /etc/fail2ban/filter.d/3x-ipl.conf rm -f /etc/fail2ban/filter.d/3x-ipl.conf
rm -f /etc/fail2ban/action.d/3x-ipl.conf rm -f /etc/fail2ban/action.d/3x-ipl.conf
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo systemctl restart fail2ban
fi fi
;; ;;
3) 3)
@ -752,8 +755,10 @@ actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
[Init] [Init]
EOF EOF
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
echo -e "${green}IP Limit installed and configured successfully." echo -e "${green}IP Limit installed and configured successfully."
echo -e "${green}To check logs of bans run."
before_show_menu before_show_menu
} }