mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-27 02:24:40 +00:00
Compare commits
1 commit
86d1aba9a2
...
8a0dc9a901
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a0dc9a901 |
3 changed files with 66 additions and 223 deletions
25
install.sh
25
install.sh
|
|
@ -56,9 +56,6 @@ install_base() {
|
||||||
opensuse-tumbleweed)
|
opensuse-tumbleweed)
|
||||||
zypper refresh && zypper -q install -y wget curl tar timezone
|
zypper refresh && zypper -q install -y wget curl tar timezone
|
||||||
;;
|
;;
|
||||||
alpine)
|
|
||||||
apk update && apk add wget curl tar tzdata
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
apt-get update && apt-get install -y -q wget curl tar tzdata
|
apt-get update && apt-get install -y -q wget curl tar tzdata
|
||||||
;;
|
;;
|
||||||
|
|
@ -180,11 +177,7 @@ install_x-ui() {
|
||||||
|
|
||||||
# Stop x-ui service and remove old resources
|
# Stop x-ui service and remove old resources
|
||||||
if [[ -e /usr/local/x-ui/ ]]; then
|
if [[ -e /usr/local/x-ui/ ]]; then
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop x-ui
|
||||||
rc-service x-ui stop
|
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
fi
|
|
||||||
rm /usr/local/x-ui/ -rf
|
rm /usr/local/x-ui/ -rf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -208,18 +201,10 @@ install_x-ui() {
|
||||||
chmod +x /usr/bin/x-ui
|
chmod +x /usr/bin/x-ui
|
||||||
config_after_install
|
config_after_install
|
||||||
|
|
||||||
if [[ $release == "alpine" ]]; then
|
cp -f x-ui.service /etc/systemd/system/
|
||||||
wget -O /etc/init.d/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.rc
|
systemctl daemon-reload
|
||||||
chmod +x /etc/init.d/x-ui
|
systemctl enable x-ui
|
||||||
rc-update add x-ui
|
systemctl start x-ui
|
||||||
rc-service x-ui start
|
|
||||||
else
|
|
||||||
cp -f x-ui.service /etc/systemd/system/
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl enable x-ui
|
|
||||||
systemctl start x-ui
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..."
|
echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..."
|
||||||
echo -e ""
|
echo -e ""
|
||||||
echo -e "┌───────────────────────────────────────────────────────┐
|
echo -e "┌───────────────────────────────────────────────────────┐
|
||||||
|
|
|
||||||
13
x-ui.rc
13
x-ui.rc
|
|
@ -1,13 +0,0 @@
|
||||||
#!/sbin/openrc-run
|
|
||||||
|
|
||||||
command="/usr/local/x-ui/x-ui"
|
|
||||||
command_background=true
|
|
||||||
pidfile="/run/x-ui.pid"
|
|
||||||
description="x-ui Service"
|
|
||||||
procname="x-ui"
|
|
||||||
depend() {
|
|
||||||
need net
|
|
||||||
}
|
|
||||||
start_pre(){
|
|
||||||
cd /usr/local/x-ui
|
|
||||||
}
|
|
||||||
251
x-ui.sh
251
x-ui.sh
|
|
@ -153,19 +153,11 @@ uninstall() {
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
systemctl stop x-ui
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl disable x-ui
|
||||||
rc-service x-ui stop
|
rm /etc/systemd/system/x-ui.service -f
|
||||||
rc-update del x-ui
|
systemctl daemon-reload
|
||||||
rm /etc/init.d/x-ui -f
|
systemctl reset-failed
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
systemctl disable x-ui
|
|
||||||
rm /etc/systemd/system/x-ui.service -f
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl reset-failed
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm /etc/x-ui/ -rf
|
rm /etc/x-ui/ -rf
|
||||||
rm /usr/local/x-ui/ -rf
|
rm /usr/local/x-ui/ -rf
|
||||||
|
|
||||||
|
|
@ -294,11 +286,7 @@ start() {
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel is running, No need to start again, If you need to restart, please select restart"
|
LOGI "Panel is running, No need to start again, If you need to restart, please select restart"
|
||||||
else
|
else
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl start x-ui
|
||||||
rc-service x-ui start
|
|
||||||
else
|
|
||||||
systemctl start x-ui
|
|
||||||
fi
|
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
|
|
@ -319,11 +307,7 @@ stop() {
|
||||||
echo ""
|
echo ""
|
||||||
LOGI "Panel stopped, No need to stop again!"
|
LOGI "Panel stopped, No need to stop again!"
|
||||||
else
|
else
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop x-ui
|
||||||
rc-service x-ui stop
|
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
fi
|
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 1 ]]; then
|
if [[ $? == 1 ]]; then
|
||||||
|
|
@ -339,11 +323,7 @@ stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl restart x-ui
|
||||||
rc-service x-ui restart
|
|
||||||
else
|
|
||||||
systemctl restart x-ui
|
|
||||||
fi
|
|
||||||
sleep 2
|
sleep 2
|
||||||
check_status
|
check_status
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
|
|
@ -357,22 +337,14 @@ restart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl status x-ui -l
|
||||||
rc-service x-ui status
|
|
||||||
else
|
|
||||||
systemctl status x-ui -l
|
|
||||||
fi
|
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl enable x-ui
|
||||||
rc-update add x-ui
|
|
||||||
else
|
|
||||||
systemctl enable x-ui
|
|
||||||
fi
|
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui Set to boot automatically on startup successfully"
|
LOGI "x-ui Set to boot automatically on startup successfully"
|
||||||
else
|
else
|
||||||
|
|
@ -385,11 +357,7 @@ enable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl disable x-ui
|
||||||
rc-update del x-ui
|
|
||||||
else
|
|
||||||
systemctl disable x-ui
|
|
||||||
fi
|
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
LOGI "x-ui Autostart Cancelled successfully"
|
LOGI "x-ui Autostart Cancelled successfully"
|
||||||
else
|
else
|
||||||
|
|
@ -402,54 +370,32 @@ disable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
show_log() {
|
show_log() {
|
||||||
if [[ $release == "alpine" ]]; then
|
echo -e "${green}\t1.${plain} Debug Log"
|
||||||
echo -e "${green}\t1.${plain} Debug Log"
|
echo -e "${green}\t2.${plain} Clear All logs"
|
||||||
echo -e "${green}\t0.${plain} Back to Main Menu"
|
echo -e "${green}\t0.${plain} Back to Main Menu"
|
||||||
read -rp "Choose an option: " choice
|
read -rp "Choose an option: " choice
|
||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
0)
|
0)
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
grep -F 'x-ui[' /var/log/messages
|
journalctl -u x-ui -e --no-pager -f -p debug
|
||||||
if [[ $# == 0 ]]; then
|
if [[ $# == 0 ]]; then
|
||||||
before_show_menu
|
before_show_menu
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
2)
|
||||||
echo -e "${red}Invalid option. Please select a valid number.${plain}\n"
|
sudo journalctl --rotate
|
||||||
show_log
|
sudo journalctl --vacuum-time=1s
|
||||||
;;
|
echo "All Logs cleared."
|
||||||
esac
|
restart
|
||||||
else
|
;;
|
||||||
echo -e "${green}\t1.${plain} Debug Log"
|
*)
|
||||||
echo -e "${green}\t2.${plain} Clear All logs"
|
echo -e "${red}Invalid option. Please select a valid number.${plain}\n"
|
||||||
echo -e "${green}\t0.${plain} Back to Main Menu"
|
show_log
|
||||||
read -rp "Choose an option: " choice
|
;;
|
||||||
|
esac
|
||||||
case "$choice" in
|
|
||||||
0)
|
|
||||||
show_menu
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
journalctl -u x-ui -e --no-pager -f -p debug
|
|
||||||
if [[ $# == 0 ]]; then
|
|
||||||
before_show_menu
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
sudo journalctl --rotate
|
|
||||||
sudo journalctl --vacuum-time=1s
|
|
||||||
echo "All Logs cleared."
|
|
||||||
restart
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo -e "${red}Invalid option. Please select a valid number.${plain}\n"
|
|
||||||
show_log
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bbr_menu() {
|
bbr_menu() {
|
||||||
|
|
@ -518,9 +464,6 @@ enable_bbr() {
|
||||||
arch | manjaro | parch)
|
arch | manjaro | parch)
|
||||||
pacman -Sy --noconfirm ca-certificates
|
pacman -Sy --noconfirm ca-certificates
|
||||||
;;
|
;;
|
||||||
alpine)
|
|
||||||
apk add ca-certificates
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -557,42 +500,23 @@ update_shell() {
|
||||||
|
|
||||||
# 0: running, 1: not running, 2: not installed
|
# 0: running, 1: not running, 2: not installed
|
||||||
check_status() {
|
check_status() {
|
||||||
if [[ $release == "alpine" ]]; then
|
if [[ ! -f /etc/systemd/system/x-ui.service ]]; then
|
||||||
if [[ ! -f /etc/init.d/x-ui ]]; then
|
return 2
|
||||||
return 2
|
fi
|
||||||
fi
|
temp=$(systemctl status x-ui | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1)
|
||||||
if [[ $(rc-service x-ui status | grep -F 'status: started' -c) == 1 ]]; then
|
if [[ "${temp}" == "running" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [[ ! -f /etc/systemd/system/x-ui.service ]]; then
|
return 1
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
temp=$(systemctl status x-ui | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1)
|
|
||||||
if [[ "${temp}" == "running" ]]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_enabled() {
|
check_enabled() {
|
||||||
if [[ $release == "alpine" ]]; then
|
temp=$(systemctl is-enabled x-ui)
|
||||||
if [[ $(rc-update show | grep -F 'x-ui' | grep default -c) == 1 ]]; then
|
if [[ "${temp}" == "enabled" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
temp=$(systemctl is-enabled x-ui)
|
return 1
|
||||||
if [[ "${temp}" == "enabled" ]]; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -874,11 +798,7 @@ update_geo() {
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop x-ui
|
||||||
rc-service x-ui stop
|
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
fi
|
|
||||||
rm -f geoip.dat geosite.dat
|
rm -f geoip.dat geosite.dat
|
||||||
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||||
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
wget -N https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||||
|
|
@ -886,11 +806,7 @@ update_geo() {
|
||||||
restart
|
restart
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop x-ui
|
||||||
rc-service x-ui stop
|
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
fi
|
|
||||||
rm -f geoip_IR.dat geosite_IR.dat
|
rm -f geoip_IR.dat geosite_IR.dat
|
||||||
wget -O geoip_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
|
wget -O geoip_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
|
||||||
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
wget -O geosite_IR.dat -N https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
||||||
|
|
@ -898,11 +814,7 @@ update_geo() {
|
||||||
restart
|
restart
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop x-ui
|
||||||
rc-service x-ui stop
|
|
||||||
else
|
|
||||||
systemctl stop x-ui
|
|
||||||
fi
|
|
||||||
rm -f geoip_RU.dat geosite_RU.dat
|
rm -f geoip_RU.dat geosite_RU.dat
|
||||||
wget -O geoip_RU.dat -N https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat
|
wget -O geoip_RU.dat -N https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||||
wget -O geosite_RU.dat -N https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat
|
wget -O geosite_RU.dat -N https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||||
|
|
@ -1073,9 +985,6 @@ ssl_cert_issue() {
|
||||||
arch | manjaro | parch)
|
arch | manjaro | parch)
|
||||||
pacman -Sy --noconfirm socat
|
pacman -Sy --noconfirm socat
|
||||||
;;
|
;;
|
||||||
alpine)
|
|
||||||
apk add socat
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -1426,11 +1335,7 @@ iplimit_main() {
|
||||||
read -rp "Please enter new Ban Duration in Minutes [default 30]: " NUM
|
read -rp "Please enter new Ban Duration in Minutes [default 30]: " NUM
|
||||||
if [[ $NUM =~ ^[0-9]+$ ]]; then
|
if [[ $NUM =~ ^[0-9]+$ ]]; then
|
||||||
create_iplimit_jails ${NUM}
|
create_iplimit_jails ${NUM}
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl restart fail2ban
|
||||||
rc-service fail2ban restart
|
|
||||||
else
|
|
||||||
systemctl restart fail2ban
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo -e "${red}${NUM} is not a number! Please, try again.${plain}"
|
echo -e "${red}${NUM} is not a number! Please, try again.${plain}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -1483,11 +1388,7 @@ iplimit_main() {
|
||||||
iplimit_main
|
iplimit_main
|
||||||
;;
|
;;
|
||||||
9)
|
9)
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl restart fail2ban
|
||||||
rc-service fail2ban restart
|
|
||||||
else
|
|
||||||
systemctl restart fail2ban
|
|
||||||
fi
|
|
||||||
iplimit_main
|
iplimit_main
|
||||||
;;
|
;;
|
||||||
10)
|
10)
|
||||||
|
|
@ -1535,9 +1436,6 @@ install_iplimit() {
|
||||||
arch | manjaro | parch)
|
arch | manjaro | parch)
|
||||||
pacman -Syu --noconfirm fail2ban
|
pacman -Syu --noconfirm fail2ban
|
||||||
;;
|
;;
|
||||||
alpine)
|
|
||||||
apk add fail2ban
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
echo -e "${red}Unsupported operating system. Please check the script and install the necessary packages manually.${plain}\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -1574,21 +1472,12 @@ install_iplimit() {
|
||||||
create_iplimit_jails
|
create_iplimit_jails
|
||||||
|
|
||||||
# Launching fail2ban
|
# Launching fail2ban
|
||||||
if [[ $release == "alpine" ]]; then
|
if ! systemctl is-active --quiet fail2ban; then
|
||||||
if [[ $(rc-service fail2ban status | grep -F 'status: started' -c) == 0 ]]; then
|
systemctl start fail2ban
|
||||||
rc-service fail2ban start
|
|
||||||
else
|
|
||||||
rc-service fail2ban restart
|
|
||||||
fi
|
|
||||||
rc-update add fail2ban
|
|
||||||
else
|
else
|
||||||
if ! systemctl is-active --quiet fail2ban; then
|
systemctl restart fail2ban
|
||||||
systemctl start fail2ban
|
|
||||||
else
|
|
||||||
systemctl restart fail2ban
|
|
||||||
fi
|
|
||||||
systemctl enable fail2ban
|
|
||||||
fi
|
fi
|
||||||
|
systemctl enable fail2ban
|
||||||
|
|
||||||
echo -e "${green}IP Limit installed and configured successfully!${plain}\n"
|
echo -e "${green}IP Limit installed and configured successfully!${plain}\n"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
|
|
@ -1604,21 +1493,13 @@ remove_iplimit() {
|
||||||
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
|
||||||
rm -f /etc/fail2ban/jail.d/3x-ipl.conf
|
rm -f /etc/fail2ban/jail.d/3x-ipl.conf
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl restart fail2ban
|
||||||
rc-service fail2ban restart
|
|
||||||
else
|
|
||||||
systemctl restart fail2ban
|
|
||||||
fi
|
|
||||||
echo -e "${green}IP Limit removed successfully!${plain}\n"
|
echo -e "${green}IP Limit removed successfully!${plain}\n"
|
||||||
before_show_menu
|
before_show_menu
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
rm -rf /etc/fail2ban
|
rm -rf /etc/fail2ban
|
||||||
if [[ $release == "alpine" ]]; then
|
systemctl stop fail2ban
|
||||||
rc-service fail2ban stop
|
|
||||||
else
|
|
||||||
systemctl stop fail2ban
|
|
||||||
fi
|
|
||||||
case "${release}" in
|
case "${release}" in
|
||||||
ubuntu | debian | armbian)
|
ubuntu | debian | armbian)
|
||||||
apt-get remove -y fail2ban
|
apt-get remove -y fail2ban
|
||||||
|
|
@ -1636,9 +1517,6 @@ remove_iplimit() {
|
||||||
arch | manjaro | parch)
|
arch | manjaro | parch)
|
||||||
pacman -Rns --noconfirm fail2ban
|
pacman -Rns --noconfirm fail2ban
|
||||||
;;
|
;;
|
||||||
alpine)
|
|
||||||
apk del fail2ban
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
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
|
||||||
|
|
@ -1662,16 +1540,9 @@ show_banlog() {
|
||||||
|
|
||||||
echo -e "${green}Checking ban logs...${plain}\n"
|
echo -e "${green}Checking ban logs...${plain}\n"
|
||||||
|
|
||||||
if [[ $release == "alpine" ]]; then
|
if ! systemctl is-active --quiet fail2ban; then
|
||||||
if [[ $(rc-service fail2ban status | grep -F 'status: started' -c) == 0 ]]; then
|
echo -e "${red}Fail2ban service is not running!${plain}\n"
|
||||||
echo -e "${red}Fail2ban service is not running!${plain}\n"
|
return 1
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if ! systemctl is-active --quiet fail2ban; then
|
|
||||||
echo -e "${red}Fail2ban service is not running!${plain}\n"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$system_log" ]]; then
|
if [[ -f "$system_log" ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue