当前位置:论坛首页 > Linux面板 > 求助

【待反馈】进入“安全”界面提示,出错了,面板运行时...

发表在 Linux面板2022-5-9 19:42 [复制链接] 7 4968

系统centos7.0
bt版本 [url=]7.9.0[/url]
[url=] Snipaste_2022-05-09_19-40-34.jpg [/url]
使用道具 举报 只看该作者 回复
发表于 2022-5-9 19:44:27 | 显示全部楼层
已经尝试过修复,重启面板等操作
使用道具 举报 回复 支持 反对
发表于 2022-5-9 20:32:51 | 显示全部楼层
将原firewalls.py 里面的

    #取SSH信息
    def GetSshInfo(self,get):
        port = public.get_ssh_port()

        pid_file = '/run/sshd.pid'
        if os.path.exists(pid_file):

            pid = int(public.readFile(pid_file))
            status = public.pid_exists(pid)
        else:
            import system
            panelsys = system.system()

            version = panelsys.GetSystemVersion()
            if os.path.exists('/usr/bin/apt-get'):
                if os.path.exists('/etc/init.d/sshd'):
                    status = public.ExecShell("service sshd status | grep -P '(dead|stop)'|grep -v grep")
                else:
                    status = public.ExecShell("service ssh status | grep -P '(dead|stop)'|grep -v grep")
            else:
                if version.find(' 7.') != -1 or version.find(' 8.') != -1 or version.find('Fedora') != -1:
                    status = public.ExecShell("systemctl status sshd.service | grep 'dead'|grep -v grep")
                else:
                    status = public.ExecShell("/etc/init.d/sshd status | grep -e 'stopped' -e '已停'|grep -v grep")

            if len(status[0]) > 3:
                status = False
            else:
                status = True
        isPing = True
        try:
            file = '/etc/sysctl.conf'
            conf = public.readFile(file)
            rep = r"#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
            tmp = re.search(rep,conf).groups(0)[0]
            if tmp == '1': isPing = False
        except:
            isPing = True

        data = {}
        data['port'] = port
        data['status'] = status
        data['ping'] = isPing
        data['firewall_status'] = self.CheckFirewallStatus()
        return data


更换为

    #取SSH信息
    def GetSshInfo(self,get):
        file = '/etc/ssh/sshd_config'
        conf = public.readFile(file)
        rep = "#*Port\s+([0-9]+)\s*\n"
        port = re.search(rep,conf).groups(0)[0]
        import system
        panelsys = system.system();

        version = panelsys.GetSystemVersion();
        if os.path.exists('/usr/bin/apt-get'):
             status = public.ExecShell("service ssh status | grep -P '(dead|stop)'")
        else:
            if version.find(' 7.') != -1:
                status = public.ExecShell("systemctl status sshd.service | grep 'dead'")
            else:
                status = public.ExecShell("/etc/init.d/sshd status | grep -e 'stopped' -e '已停'")

        if len(status[0]) > 3:
            status = False
        else:
            status = True
        isPing = True
        try:
            file = '/etc/sysctl.conf'
            conf = public.readFile(file)
            rep = "#*net\.ipv4\.icmp_echo_ignore_all\s*=\s*([0-9]+)"
            tmp = re.search(rep,conf).groups(0)[0]
            if tmp == '1': isPing = False
        except:
            isPing = True



        data = {}
        data['port'] = port
        data['status'] = status
        data['ping'] = isPing
        return data


之后不再报错了,但是“安全”面板里面也不能进行操作,无法添加端口,也不能启用SSH(灰色)
使用道具 举报 回复 支持 反对
发表于 2022-5-9 21:02:40 | 显示全部楼层
yaobus 发表于 2022-5-9 20:32
将原firewalls.py 里面的

    #取SSH信息

您好,修改过SSH相关的配置吗?
使用道具 举报 回复 支持 反对
发表于 2022-5-12 12:04:58 | 显示全部楼层
大炮运维V587 发表于 2022-5-9 21:02
您好,修改过SSH相关的配置吗?

没有修改
使用道具 举报 回复 支持 反对
发表于 2022-5-13 09:59:09 | 显示全部楼层

错误信息是无法获取到你的服务器中的SSH信息,所以你看下你的SSH是否能正常使用?
使用道具 举报 回复 支持 反对
发表于 2022-5-15 10:56:34 | 显示全部楼层
大炮运维V587 发表于 2022-5-13 09:59
错误信息是无法获取到你的服务器中的SSH信息,所以你看下你的SSH是否能正常使用? ...

SSH可以正常使用,端口也没改
使用道具 举报 回复 支持 反对
发表于 2022-5-15 17:58:09 | 显示全部楼层
yaobus 发表于 2022-5-15 10:56
SSH可以正常使用,端口也没改



您好,
将您的服务器ssh信息,面板登录资料按照下面的格式发到这个邮箱:help@bt.cn
我排查看下是什么问题


格式(必须复制帖子链接,不然不知道邮件来源):
  1. 帖子标题(遇到什么问题):
  2. 帖子链接:https://www.bt.cn/bbs/thread-xxxxxxxx
  3. SSH账号密码及端口(Windows服务器请发送远程连接):


  4. 宝塔面板登录链接地址及账号密码:
复制代码

可能需要排队,将在3个工作日内处理,请耐心等待
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表