update fail2ban v1.0.2 for debian

This commit is contained in:
MHSanaei 2024-01-20 16:38:54 +03:30
parent 7f13adbd05
commit 38378fe36f
2 changed files with 29 additions and 20 deletions

View file

@ -81,10 +81,13 @@ fi
install_base() { install_base() {
case "${release}" in case "${release}" in
centos|fedora|almalinux|rocky) centos | almalinux | rocky)
yum -y update && yum install -y -q wget curl tar yum -y update && yum install -y -q wget curl tar
;; ;;
arch|manjaro) fedora)
dnf -y update && dnf install -y -q wget curl tar
;;
arch | manjaro)
pacman -Syu && pacman -Syu --noconfirm wget curl tar pacman -Syu && pacman -Syu --noconfirm wget curl tar
;; ;;
*) *)
@ -93,7 +96,6 @@ install_base() {
esac esac
} }
# This function will be called when user installed x-ui out of security # This function will be called when user installed x-ui out of security
config_after_install() { config_after_install() {
echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}" echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}"
@ -167,7 +169,6 @@ install_x-ui() {
# Check the system's architecture and rename the file accordingly # Check the system's architecture and rename the file accordingly
if [[ $(arch3xui) == "armv5" || $(arch3xui) == "armv6" || $(arch3xui) == "armv7" ]]; then if [[ $(arch3xui) == "armv5" || $(arch3xui) == "armv6" || $(arch3xui) == "armv7" ]]; then
mv bin/xray-linux-$(arch3xui) bin/xray-linux-arm mv bin/xray-linux-$(arch3xui) bin/xray-linux-arm
chmod +x bin/xray-linux-arm chmod +x bin/xray-linux-arm
fi fi
@ -201,7 +202,6 @@ install_x-ui() {
echo -e "----------------------------------------------" echo -e "----------------------------------------------"
} }
echo -e "${green}Running...${plain}" echo -e "${green}Running...${plain}"
install_base install_base
install_x-ui $1 install_x-ui $1

19
x-ui.sh
View file

@ -982,12 +982,16 @@ iplimit_main() {
install_iplimit() { install_iplimit() {
if ! command -v fail2ban-client &>/dev/null; then if ! command -v fail2ban-client &>/dev/null; then
echo -e "${green}Fail2ban is not installed. Installing now...!${plain}\n" echo -e "${green}Fail2ban is not installed. Installing now...!${plain}\n"
# Check the OS and install necessary packages # Check the OS and install necessary packages
case "${release}" in case "${release}" in
ubuntu|debian) ubuntu|debian)
apt update && apt install fail2ban -y ;; wget -O fail2ban.deb https://github.com/fail2ban/fail2ban/releases/download/1.0.2/fail2ban_1.0.2-1.upstream1_all.deb
wget -O fail2ban.deb.asc https://github.com/fail2ban/fail2ban/releases/download/1.0.2/fail2ban_1.0.2-1.upstream1_all.deb.asc
dpkg -i fail2ban.deb ;;
centos|almalinux|rocky) centos|almalinux|rocky)
yum -y update && yum -y install fail2ban ;; yum update -y && yum install epel-release -y
yum -y install fail2ban ;;
fedora) fedora)
dnf -y update && dnf -y install fail2ban ;; dnf -y update && dnf -y install fail2ban ;;
*) *)
@ -1027,6 +1031,7 @@ install_iplimit() {
# Launching fail2ban # Launching fail2ban
if ! systemctl is-active --quiet fail2ban; then if ! systemctl is-active --quiet fail2ban; then
systemctl start fail2ban systemctl start fail2ban
systemctl enable fail2ban
else else
systemctl restart fail2ban systemctl restart fail2ban
fi fi
@ -1054,11 +1059,15 @@ remove_iplimit(){
systemctl stop fail2ban systemctl stop fail2ban
case "${release}" in case "${release}" in
ubuntu|debian) ubuntu|debian)
apt-get purge fail2ban -y;; apt-get remove -y fail2ban
apt-get purge -y fail2ban -y
apt-get autoremove -y;;
centos|almalinux|rocky) centos|almalinux|rocky)
yum remove fail2ban -y;; yum remove fail2ban -y
yum autoremove -y;;
fedora) fedora)
dnf remove fail2ban -y;; dnf remove fail2ban -y
dnf autoremove -y;;
*) *)
echo -e "${red}Unsupported operating system. Please uninstall Fail2ban manually.${plain}\n" echo -e "${red}Unsupported operating system. Please uninstall Fail2ban manually.${plain}\n"
exit 1 ;; exit 1 ;;