Fail2ban无法启动服务,centos9
为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:bt 8.0.1Fail2ban 1.7系统版本:centos9
问题描述:Fail2ban 服务无法启动
相关截图(日志、错误):+ PATH=/www/server/panel/pyenv/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin
+ export PATH
+ py_v=/usr/bin/python
+ '[' -d /www/server/panel/pyenv ']'
+ py_v=/www/server/panel/pyenv/bin/python
+ mkdir /var/run/fail2ban
mkdir: 无法创建目录 “/var/run/fail2ban”: 文件已存在
+ plugin_path=/www/server/panel/plugin/fail2ban
+ action=install
+ '[' install == install ']'
+ Install_fail2ban
+ mkdir -p /www/server/panel/plugin/fail2ban/cdn
+ cd /tmp
+ '[' -f /usr/bin/yum ']'
+ yum install git -y
+ yum install rsyslog -y
+ new_install
+ cp /www/server/panel/plugin/fail2ban/fail2ban.tar.gz /tmp/fail2ban.tar.gz
+ cd /tmp
+ tar -zxf fail2ban.tar.gz
+ cp /tmp/fail2ban/files/debian-initd /etc/init.d/fail2ban
+ cd /tmp/fail2ban
+ /www/server/panel/pyenv/bin/python setup.py install
error in fail2ban setup command: use_2to3 is invalid.
+ rm -rf /tmp/fail2ban
+ rm -f /usr/bin/fail2ban-client
+ rm -f /usr/bin/fail2ban-server
+ '[' /www/server/panel/pyenv/bin/python '!=' /usr/bin/python ']'
+ ln -s /www/server/panel/pyenv/bin/fail2ban-server /usr/bin/fail2ban-server
+ ln -s /www/server/panel/pyenv/bin/fail2ban-client /usr/bin/fail2ban-client
+ '[' '!' -f /usr/bin/fail2ban-client ']'
+ new_install
+ cp /www/server/panel/plugin/fail2ban/fail2ban.tar.gz /tmp/fail2ban.tar.gz
+ cd /tmp
+ tar -zxf fail2ban.tar.gz
+ cp /tmp/fail2ban/files/debian-initd /etc/init.d/fail2ban
+ cd /tmp/fail2ban
+ /www/server/panel/pyenv/bin/python setup.py install
error in fail2ban setup command: use_2to3 is invalid.
+ rm -rf /tmp/fail2ban
+ rm -f /usr/bin/fail2ban-client
+ rm -f /usr/bin/fail2ban-server
+ '[' /www/server/panel/pyenv/bin/python '!=' /usr/bin/python ']'
+ ln -s /www/server/panel/pyenv/bin/fail2ban-server /usr/bin/fail2ban-server
+ ln -s /www/server/panel/pyenv/bin/fail2ban-client /usr/bin/fail2ban-client
+ sed -i 's/pidfile\s=.*/pidfile = \/www\/server\/panel\/plugin\/fail2ban\/fail2ban\.pid/g' /etc/fail2ban/fail2ban.con
f
sed:无法读取 /etc/fail2ban/fail2ban.conf:没有那个文件或目录
+ sed -i 's/socket\s=\s\/.*/socket = \/www\/server\/panel\/plugin\/fail2ban\/fail2ban\.sock/g' /etc/fail2ban/fail2ban.
conf
sed:无法读取 /etc/fail2ban/fail2ban.conf:没有那个文件或目录
+ '[' '!' -f /etc/fail2ban/jail.local ']'
+ cp /www/server/panel/plugin/fail2ban/jail.local /etc/fail2ban/jail.local
cp: 无法创建普通文件'/etc/fail2ban/jail.local': 没有那个文件或目录
++ grep -v '#' /etc/ssh/sshd_config
++ awk '{print $2}'
++ tr '\n' ,
++ grep Port
+ sshport=2969,
+ sshport=2969
+ '[' 2969 = '' ']'
+ sed -i 's/port = 22/port = 2969/g' /etc/fail2ban/jail.local
sed:无法读取 /etc/fail2ban/jail.local:没有那个文件或目录
+ ftpport=21
+ '[' -f /www/server/pure-ftpd/etc/pure-ftpd.conf ']'
+ jsonconf='{"sshd": {"maxretry": 5, "findtime": 300, "act": "true", "port": "2969", "dir": "", "bantime": 86400},"ftp
d": {"maxretry": 5, "findtime": 300, "act": "true", "port": 21, "dir": "", "bantime": 86400}}'
+ '[' '!' -f /www/server/panel/plugin/fail2ban/config.json ']'
+ '[' -f /var/log/auth.log ']'
+ '[' '!' -f /etc/redhat-release ']'
+ grep -v '#' /etc/rsyslog.conf
+ grep messages
+ '[' 0 -ne 0 ']'
+ '[' '!' -f /var/log/messages ']'
+ systemctl restart rsyslog
+ systemctl unmask fail2ban
+ systemctl daemon-reload
+ systemctl restart fail2ban
+ systemctl enable fail2ban
+ echo Successify
+ echo 1
看日志像是没有权限,用以下的方法尝试手动安装也不行wget -O /tmp/fail2ban.tar.gz http://download.bt.cn/install/plugin/fail2ban/fail2ban.tar.gz -T 5
cd /tmp
tar -zxf fail2ban.tar.gz
cp /tmp/fail2ban/files/debian-initd /etc/init.d/fail2ban
cd /tmp/fail2ban
/www/server/panel/pyenv/bin/pythonsetup.py install执行的拷贝`/etc/init.d/fail2ban` 时也提示没有
清空 /etc/fail2ban下 jail.local 内的所有内容保存并退出,然后尝试重新启动,成功启动
测试环境 centos9 calonye 发表于 2023-11-15 14:11
清空 /etc/fail2ban下 jail.local 内的所有内容保存并退出,然后尝试重新启动,成功启动
测试环境 centos ...
牛,debian也有用 bash /www/server/panel/plugin/fail2ban/install.sh install
补充命令修复 本帖最后由 用户01 于 2024-6-5 11:08 编辑
calonye 发表于 2023-11-15 14:11
清空 /etc/fail2ban下 jail.local 内的所有内容保存并退出,然后尝试重新启动,成功启动
测试环境 centos ...
Mark,这个方法有用。
补充一个清空 jail.local 的命令:
echo "" > /etc/fail2ban/jail.local 用户01 发表于 2024-6-5 11:06
Mark,这个方法有用。
补充一个清空 jail.local 的命令:
现在情况怎么了,··听说不兼容新版本之类的~ calonye 发表于 2023-11-15 14:11
清空 /etc/fail2ban下 jail.local 内的所有内容保存并退出,然后尝试重新启动,成功启动
测试环境 centos ...
可以,opencloudos 9也可以启动起来了,感谢大佬
页:
[1]