mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-20 05:52:24 +00:00
Fail2ban banned log command added (#991)
This commit is contained in:
parent
a808170efb
commit
4ab5bf04eb
2 changed files with 19 additions and 10 deletions
|
@ -171,6 +171,7 @@ install_x-ui() {
|
||||||
echo -e "x-ui enable - Enable x-ui on system startup"
|
echo -e "x-ui enable - Enable x-ui on system startup"
|
||||||
echo -e "x-ui disable - Disable x-ui on system startup"
|
echo -e "x-ui disable - Disable x-ui on system startup"
|
||||||
echo -e "x-ui log - Check x-ui logs"
|
echo -e "x-ui log - Check x-ui logs"
|
||||||
|
echo -e "x-ui banlog - Check Fail2ban ban logs"
|
||||||
echo -e "x-ui update - Update x-ui"
|
echo -e "x-ui update - Update x-ui"
|
||||||
echo -e "x-ui install - Install x-ui"
|
echo -e "x-ui install - Install x-ui"
|
||||||
echo -e "x-ui uninstall - Uninstall x-ui"
|
echo -e "x-ui uninstall - Uninstall x-ui"
|
||||||
|
|
28
x-ui.sh
28
x-ui.sh
|
@ -298,6 +298,18 @@ show_log() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_banlog() {
|
||||||
|
if test -f "${iplimit_banned_log_path}"; then
|
||||||
|
if [[ -s "${iplimit_banned_log_path}" ]]; then
|
||||||
|
cat ${iplimit_banned_log_path}
|
||||||
|
else
|
||||||
|
echo -e "${red}Log file is empty.${plain}\n"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${red}Log file not found. Please Install Fail2ban and IP Limit first.${plain}\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
enable_bbr() {
|
enable_bbr() {
|
||||||
if grep -q "net.core.default_qdisc=fq" /etc/sysctl.conf && grep -q "net.ipv4.tcp_congestion_control=bbr" /etc/sysctl.conf; then
|
if grep -q "net.core.default_qdisc=fq" /etc/sysctl.conf && grep -q "net.ipv4.tcp_congestion_control=bbr" /etc/sysctl.conf; then
|
||||||
echo -e "${green}BBR is already enabled!${plain}"
|
echo -e "${green}BBR is already enabled!${plain}"
|
||||||
|
@ -892,16 +904,8 @@ iplimit_main() {
|
||||||
fi
|
fi
|
||||||
iplimit_main ;;
|
iplimit_main ;;
|
||||||
4)
|
4)
|
||||||
if test -f "${iplimit_banned_log_path}"; then
|
show_banlog
|
||||||
if [[ -s "${iplimit_banned_log_path}" ]]; then
|
;;
|
||||||
cat ${iplimit_banned_log_path}
|
|
||||||
else
|
|
||||||
echo -e "${red}Log file is empty.${plain}\n"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${red}Log file not found. Please Install Fail2ban and IP Limit first.${plain}\n"
|
|
||||||
iplimit_main
|
|
||||||
fi ;;
|
|
||||||
5)
|
5)
|
||||||
service fail2ban status
|
service fail2ban status
|
||||||
;;
|
;;
|
||||||
|
@ -1012,6 +1016,7 @@ show_usage() {
|
||||||
echo -e "x-ui enable - Enable x-ui on system startup"
|
echo -e "x-ui enable - Enable x-ui on system startup"
|
||||||
echo -e "x-ui disable - Disable x-ui on system startup"
|
echo -e "x-ui disable - Disable x-ui on system startup"
|
||||||
echo -e "x-ui log - Check x-ui logs"
|
echo -e "x-ui log - Check x-ui logs"
|
||||||
|
echo -e "x-ui banlog - Check Fail2ban ban logs"
|
||||||
echo -e "x-ui update - Update x-ui "
|
echo -e "x-ui update - Update x-ui "
|
||||||
echo -e "x-ui install - Install x-ui "
|
echo -e "x-ui install - Install x-ui "
|
||||||
echo -e "x-ui uninstall - Uninstall x-ui "
|
echo -e "x-ui uninstall - Uninstall x-ui "
|
||||||
|
@ -1153,6 +1158,9 @@ if [[ $# > 0 ]]; then
|
||||||
"log")
|
"log")
|
||||||
check_install 0 && show_log 0
|
check_install 0 && show_log 0
|
||||||
;;
|
;;
|
||||||
|
"banlog")
|
||||||
|
check_install 0 && show_banlog 0
|
||||||
|
;;
|
||||||
"update")
|
"update")
|
||||||
check_install 0 && update 0
|
check_install 0 && update 0
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue