Ejemplo n.º 1
0
    def set_admin_path(self, get):
        get.admin_path = get.admin_path.strip()
        if get.admin_path == '': get.admin_path = '/'
        if get.admin_path != '/':
            if len(get.admin_path) < 6:
                return public.returnMsg(
                    False, 'SECURITY_ENTRANCE_ADDRESS_NOT_LESS_THAN')
            if get.admin_path in admin_path_checks:
                return public.returnMsg(False,
                                        'SECURITY_ENTRANCE_ADDRESS_EXIST')
            if not re.match("^/[\w\./-_]+$", get.admin_path):
                return public.returnMsg(False,
                                        'SECURITY_ENTRANCE_ADDRESS_INCORRECT')
            if get.admin_path[0] != '/':
                return public.returnMsg(False,
                                        'SECURITY_ENTRANCE_ADDRESS_INCORRECT')
        else:
            get.domain = public.readFile('data/domain.conf')
            if not get.domain: get.domain = ''
            get.limitip = public.readFile('data/limitip.conf')
            if not get.limitip: get.limitip = ''
            if not get.domain.strip() and not get.limitip.strip():
                return public.returnMsg(
                    False, 'SECURITY_ENTRANCE_ADDRESS_TRUEN_OFF_WARN')

        admin_path_file = 'data/admin_path.pl'
        admin_path = '/'
        if os.path.exists(admin_path_file):
            admin_path = public.readFile(admin_path_file).strip()
        if get.admin_path != admin_path:
            public.writeFile(admin_path_file, get.admin_path)
            public.restart_panel()
        return public.returnMsg(True, 'EDIT_SUCCESS')
Ejemplo n.º 2
0
    def set_admin_path(self, get):
        get.admin_path = get.admin_path.strip()
        if get.admin_path == '': get.admin_path = '/'
        if get.admin_path != '/':
            if len(get.admin_path) < 6:
                return public.returnMsg(False, '安全入口地址长度不能小于6位!')
            if get.admin_path in admin_path_checks:
                return public.returnMsg(False, '该入口已被面板占用,请使用其它入口!')
            if not re.match("^/[\w\./-_]+$", get.admin_path):
                return public.returnMsg(False, '入口地址格式不正确,示例: /my_panel')
            if get.admin_path[0] != '/':
                return public.returnMsg(False, '入口地址格式不正确,示例: /my_panel')
        else:
            get.domain = public.readFile('data/domain.conf')
            if not get.domain: get.domain = ''
            get.limitip = public.readFile('data/limitip.conf')
            if not get.limitip: get.limitip = ''
            if not get.domain.strip() and not get.limitip.strip():
                return public.returnMsg(
                    False,
                    '警告,关闭安全入口等于直接暴露你的后台地址在外网,十分危险,至少开启以下一种安全方式才能关闭:<a style="color:red;"><br>1、绑定访问域名<br>2、绑定授权IP</a>'
                )

        admin_path_file = 'data/admin_path.pl'
        admin_path = '/'
        if os.path.exists(admin_path_file):
            admin_path = public.readFile(admin_path_file).strip()
        if get.admin_path != admin_path:
            public.writeFile(admin_path_file, get.admin_path)
            public.restart_panel()
        return public.returnMsg(True, '修改成功!')
Ejemplo n.º 3
0
 def BtcoInstall(self, get):
     v = public.version()
     if v[-2] == '.':
         if v < '6.9.1':
             public.returnMsg(False, '抱歉,面板当前版本不支持BTCO,请升级面板至最新版')
         else:
             if v < '6.9.15':
                 public.returnMsg(False, '抱歉,面板当前版本不支持BTCO,请升级面板至最新版')
     if not public.GetConfigValue('btco'):
         initobj = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
         for initLine in initobj:
             for btcoin in ['<!--BTCO-->']:
                 if btcoin.upper() in initLine.upper():
                     self.BtcoIns.append(btcoin)
             if len(self.BtcoIns) != 0:
                 initobj.close()
                 public.SetConfigValue('btco', True)
                 return public.returnMsg(True, '您已安装过了.')
         # BTCO 强制跳转写入
         BtcoAdd = '<!--BTCO-->\n   <script> var a=document.location.toString().split("//");navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)&&("/"==a[1].substring(a[1].indexOf("/"))?window.location.href="/btco/index.html' + '":"/config"==a[1].substring(a[1].indexOf("/"))&&(window.location.href="/btco/index.html#/config' + '")); </script> \n   <!--BTCO-->'
         initCoutent = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
         BtcoAddIn = initCoutent.read().split("</head>")
         initCoutent.close()
         BtcoAddin = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'w')
         BtcoAddin.write(BtcoAddIn[0] + BtcoAdd + "</head>" + BtcoAddIn[1])
         BtcoAddin.close()
         public.restart_panel()
         public.SetConfigValue('btco', True)
         return public.returnMsg(True, '安装成功,感谢支持.')
     elif public.GetConfigValue('btco'):
         return public.returnMsg(True, '您已安装过了.')
     return public.returnMsg(False, '安装失败')
Ejemplo n.º 4
0
    def setPanel(self, get):
        if not public.IsRestart():
            return public.returnMsg(False, 'EXEC_ERR_TASK')

        if get.domain:
            reg = "^([\w\-\*]{1,100}\.){1,4}(\w{1,10}|\w{1,10}\.\w{1,10})$"
            if not re.match(reg, get.domain):
                return public.returnMsg(False, 'SITE_ADD_ERR_DOMAIN')
        isReWeb = False
        oldPort = public.GetHost(True)
        newPort = get.port
        if oldPort != get.port:
            get.port = str(int(get.port))
            if self.IsOpen(get.port):
                return public.returnMsg(False, 'PORT_CHECK_EXISTS', (
                    get,
                    port,
                ))
            if int(get.port) >= 65535 or int(get.port) < 100:
                return public.returnMsg(False, 'PORT_CHECK_RANGE')
            public.writeFile('data/port.pl', get.port)
            import firewalls
            get.ps = public.getMsg('PORT_CHECK_PS')
            fw = firewalls.firewalls()
            fw.AddAcceptPort(get)
            get.port = oldPort
            get.id = public.M('firewall').where("port=?",
                                                (oldPort, )).getField('id')
            fw.DelAcceptPort(get)
            isReWeb = True

        if get.webname != session['title']:
            session['title'] = get.webname
            public.SetConfigValue('title', get.webname)

        limitip = public.readFile('data/limitip.conf')
        if get.limitip != limitip:
            public.writeFile('data/limitip.conf', get.limitip)

        public.writeFile('data/domain.conf', get.domain.strip())
        public.writeFile('data/iplist.txt', get.address)

        public.M('config').where("id=?", ('1', )).save(
            'backup_path,sites_path', (get.backup_path, get.sites_path))
        session['config']['backup_path'] = get.backup_path
        session['config']['sites_path'] = get.sites_path
        mhost = public.GetHost()
        if get.domain.strip(): mhost = get.domain
        data = {
            'uri': request.path,
            'host': mhost + ':' + newPort,
            'status': True,
            'isReWeb': isReWeb,
            'msg': public.getMsg('PANEL_SAVE')
        }
        public.WriteLog('TYPE_PANEL', 'PANEL_SAVE',
                        (newPort, get.domain, get.backup_path, get.sites_path,
                         get.address, get.limitip))
        if isReWeb: public.restart_panel()
        return data
Ejemplo n.º 5
0
 def set_ipv6_status(self, get):
     ipv6_file = 'data/ipv6.pl'
     if self.get_ipv6_listen(get):
         os.remove(ipv6_file)
         public.WriteLog('面板设置', '关闭面板IPv6兼容!')
     else:
         public.writeFile(ipv6_file, 'True')
         public.WriteLog('面板设置', '开启面板IPv6兼容!')
     public.restart_panel()
     return public.returnMsg(True, '设置成功!')
Ejemplo n.º 6
0
 def set_ipv6_status(self, get):
     ipv6_file = 'data/ipv6.pl'
     if self.get_ipv6_listen(get):
         os.remove(ipv6_file)
         public.WriteLog('TYPE_CONFIG', 'P_STOP_IPV6!')
     else:
         public.writeFile(ipv6_file, 'True')
         public.WriteLog('TYPE_CONFIG', 'P_START_IPV6!')
     public.restart_panel()
     return public.returnMsg(True, 'SET_SUCCESS')
Ejemplo n.º 7
0
 def get_error(self, error):
     if error.find("Max checks allowed") >= 0:
         return "CA无法验证您的域名,请检查域名解析是否正确,或等待5-10分钟后重试."
     elif error.find("Max retries exceeded with") >= 0 or error.find(
             'status_code=0 ') != -1:
         return "CA服务器连接超时,请稍候重试."
     elif error.find("The domain name belongs") >= 0:
         return "域名不属于此DNS服务商,请确保域名填写正确."
     elif error.find('login token ID is invalid') >= 0:
         return 'DNS服务器连接失败,请检查密钥是否正确.'
     elif "too many certificates already issued for exact set of domains" in error:
         return '签发失败,该域名%s超出了每周的重复签发次数限制!' % re.findall(
             "exact set of domains: (.+):", error)
     elif "Error creating new account :: too many registrations for this IP" in error:
         return '签发失败,当前服务器IP已达到每3小时最多创建10个帐户的限制.'
     elif "DNS problem: NXDOMAIN looking up A for" in error:
         return '验证失败,没有解析域名,或解析未生效!'
     elif "Invalid response from" in error:
         return '验证失败,域名解析错误或验证URL无法被访问!'
     elif error.find('TLS Web Server Authentication') != -1:
         public.restart_panel()
         return "连接CA服务器失败,请稍候重试."
     elif error.find('Name does not end in a public suffix') != -1:
         return "不支持的域名%s,请检查域名是否正确!" % re.findall(
             "Cannot issue for \"(.+)\":", error)
     elif error.find('No valid IP addresses found for') != -1:
         return "域名%s没有找到解析记录,请检查域名是否解析生效!" % re.findall(
             "No valid IP addresses found for (.+)", error)
     elif error.find('No TXT record found at') != -1:
         return "没有在域名%s中找到有效的TXT解析记录,请检查是否正确解析TXT记录,如果是DNSAPI方式申请的,请10分钟后重试!" % re.findall(
             "No TXT record found at (.+)", error)
     elif error.find('Incorrect TXT record') != -1:
         return "在%s上发现错误的TXT记录:%s,请检查TXT解析是否正确,如果是DNSAPI方式申请的,请10分钟后重试!" % (
             re.findall("found at (.+)", error),
             re.findall("Incorrect TXT record \"(.+)\"", error))
     elif error.find('Domain not under you or your user') != -1:
         return "这个dnspod账户下面不存在这个域名,添加解析失败!"
     elif error.find('SERVFAIL looking up TXT for') != -1:
         return "没有在域名%s中找到有效的TXT解析记录,请检查是否正确解析TXT记录,如果是DNSAPI方式申请的,请10分钟后重试!" % re.findall(
             "looking up TXT for (.+)", error)
     elif error.find('Timeout during connect') != -1:
         return "连接超时,CA服务器无法访问您的网站!"
     elif error.find("DNS problem: SERVFAIL looking up CAA for") != -1:
         return "域名%s当前被要求验证CAA记录,请手动解析CAA记录,或1小时后重新尝试申请!" % re.findall(
             "looking up CAA for (.+)", error)
     elif error.find("Read timed out.") != -1:
         return "验证超时,请检查域名是否正确解析,若已正确解析,可能服务器与Let'sEncrypt连接异常,请稍候再重试!"
     elif error.find("Error creating new order") != -1:
         return "订单创建失败,请稍候重试!"
     elif error.find("Too Many Requests") != -1:
         return "1小时内超过5次验证失败,暂时禁止申请,请稍候重试!"
     elif error.find('HTTP Error 400: Bad Request') != -1:
         return "CA服务器拒绝访问,请稍候重试!"
     else:
         return error
Ejemplo n.º 8
0
 def get_error(self, error):
     if error.find("Max checks allowed") >= 0:
         return "CA can't verify your domain name, please check if the domain name resolution is correct, or wait 5-10 minutes and try again."
     elif error.find("Max retries exceeded with") >= 0 or error.find(
             'status_code=0 ') != -1:
         return "The CA server connection timed out, please try again later."
     elif error.find("The domain name belongs") >= 0:
         return "The domain name does not belong to this DNS service provider. Please ensure that the domain name is filled in correctly."
     elif error.find('login token ID is invalid') >= 0:
         return 'The DNS server connection failed. Please check if the key is correct.'
     elif "too many certificates already issued for exact set of domains" in error:
         return 'The signing failed, the domain name %s exceeded the weekly number of repeated issuances!' % re.findall(
             "exact set of domains: (.+):", error)
     elif "Error creating new account :: too many registrations for this IP" in error:
         return 'The signing failed, the current server IP has reached the limit of creating up to 10 accounts every 3 hours..'
     elif "DNS problem: NXDOMAIN looking up A for" in error:
         return 'The verification failed, the domain name was not resolved, or the resolution did not take effect.!'
     elif "Invalid response from" in error:
         return 'Authentication failed, domain name resolution error or verification URL could not be accessed!'
     elif error.find('TLS Web Server Authentication') != -1:
         public.restart_panel()
         return "Failed to connect to CA server, please try again later."
     elif error.find('Name does not end in a public suffix') != -1:
         return "Unsupported domain name %s, please check if the domain name is correct!" % re.findall(
             "Cannot issue for \"(.+)\":", error)
     elif error.find('No valid IP addresses found for') != -1:
         return "The domain name %s did not find a resolution record. Please check if the domain name is resolved.!" % re.findall(
             "No valid IP addresses found for (.+)", error)
     elif error.find('No TXT record found at') != -1:
         return "If a valid TXT resolution record is not found in the domain name %s, please check if the TXT record is correctly parsed. If it is applied by DNSAPI, please try again in 10 minutes.!" % re.findall(
             "No TXT record found at (.+)", error)
     elif error.find('Incorrect TXT record') != -1:
         return "Found the wrong TXT record on %s: %s, please check if the TXT resolution is correct. If it is applied by DNSAPI, please try again in 10 minutes.!" % (
             re.findall("found at (.+)", error),
             re.findall("Incorrect TXT record \"(.+)\"", error))
     elif error.find('Domain not under you or your user') != -1:
         return "This domain name does not exist under this dnspod account. Adding parsing failed.!"
     elif error.find('SERVFAIL looking up TXT for') != -1:
         return "If a valid TXT resolution record is not found in the domain name %s, please check if the TXT record is correctly parsed. If it is applied by DNSAPI, please try again in 10 minutes.!" % re.findall(
             "looking up TXT for (.+)", error)
     elif error.find('Timeout during connect') != -1:
         return "Connection timed out, CA server could not access your website!"
     elif error.find("DNS problem: SERVFAIL looking up CAA for") != -1:
         return "The domain name %s is currently required to verify the CAA record. Please manually resolve the CAA record, or try again after 1 hour.!" % re.findall(
             "looking up CAA for (.+)", error)
     elif error.find("Read timed out.") != -1:
         return "Verification timeout, please check whether the domain name is correctly resolved. If dns is resolved, the connection between the server and Let'sEncrypt may be abnormal. Please try again later!"
     elif error.find("Error creating new order") != -1:
         return "Order creation failed, please try again later!"
     elif error.find("Too Many Requests") != -1:
         return "More than 5 verification failures in 1 hour, application is temporarily banned, please try again later!"
     elif error.find('HTTP Error 400: Bad Request') != -1:
         return "CA server denied access, please try again later!"
     else:
         return error
Ejemplo n.º 9
0
 def set_debug(self, get):
     debug_path = 'data/debug.pl'
     if os.path.exists(debug_path):
         t_str = '关闭'
         os.remove(debug_path)
     else:
         t_str = '开启'
         public.writeFile(debug_path, 'True')
     public.WriteLog('面板配置', '%s开发者模式(debug)' % t_str)
     public.restart_panel()
     return public.returnMsg(True, '设置成功!')
Ejemplo n.º 10
0
 def set_debug(self, get):
     debug_path = 'data/debug.pl'
     if os.path.exists(debug_path):
         t_str = 'Close'
         os.remove(debug_path)
     else:
         t_str = 'Open'
         public.writeFile(debug_path, 'True')
     public.WriteLog('TYPE_PANEL', '%s Developer mode(debug)' % t_str)
     public.restart_panel()
     return public.returnMsg(True, 'Successful setup!')
Ejemplo n.º 11
0
    def get_error(self,error):

        if error.find("Max checks allowed") >= 0 :
            return "CA无法验证您的域名,请检查域名解析是否正确,或等待5-10分钟后重试."
        elif error.find("Max retries exceeded with") >= 0:
            return "CA服务器连接超时,请稍候重试."
        elif error.find("The domain name belongs") >= 0:
            return "域名不属于此DNS服务商,请确保域名填写正确."
        elif error.find('login token ID is invalid') >=0:
            return 'DNS服务器连接失败,请检查密钥是否正确.'
        elif "too many certificates already issued for exact set of domains" in error or "Error creating new account :: too many registrations for this IP" in error:
            return '<h2>签发失败,您1小时内超过5次验证失败,请等待1小时再重试!</h2>'
        elif "DNS problem: NXDOMAIN looking up A for" in error or "No valid IP addresses found for" in error or "Invalid response from" in error:
            return '<h2>签发失败,域名解析错误,或解析未生效,或域名未备案!</h2>'
        elif error.find('TLS Web Server Authentication') != -1:
            public.restart_panel()
            return "连接CA服务器失败,请稍候重试."
        else:
            return error;
Ejemplo n.º 12
0
    def get_error(self,error):

        if error.find("Max checks allowed") >= 0 :
            return "CA can't verify your domain name, please check if the domain name resolution is correct, or wait 5-10 minutes and try again."
        elif error.find("Max retries exceeded with") >= 0:
            return "The CA server connection timed out, please try again later."
        elif error.find("The domain name belongs") >= 0:
            return "The domain name does not belong to this DNS service provider. Please ensure that the domain name is filled in correctly."
        elif error.find('login token ID is invalid') >=0:
            return 'The DNS server connection failed. Please check if the key is correct.'
        elif "too many certificates already issued for exact set of domains" in error or "Error creating new account :: too many registrations for this IP" in error:
            return '<h2>You have failed more than 5 verifications in 1 hour. Please wait 1 hour and try again.</h2>'
        elif "DNS problem: NXDOMAIN looking up A for" in error or "No valid IP addresses found for" in error or "Invalid response from" in error:
            return '<h2>The signing failed, the domain name resolution error, or the resolution is not valid, or the domain name is not filed!</h2>'
        elif error.find('TLS Web Server Authentication') != -1:
            public.restart_panel()
            return "Failed to connect to the CA server, please try again later."
        else:
            return error;
Ejemplo n.º 13
0
 def BtcoRemove(self, get):
     if not public.GetConfigValue('btco'):
         return public.returnMsg(False, '未安装怎么移除?')
     initobj = open(
         '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
     for initLine in initobj:
         for btcoin in ['<!--BTCO-->']:
             if btcoin.upper() in initLine.upper():
                 self.BtcoIns.append(btcoin)
     if len(self.BtcoIns) > 0:
         initCoutent = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
         BtcoAddOn = initCoutent.read().split("<!--BTCO-->")
         initCoutent.close()
         BtcoAddOnd = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'w')
         BtcoAddOnd.write(BtcoAddOn[0] + BtcoAddOn[2])
         BtcoAddOnd.close()
         public.restart_panel()
         public.SetConfigValue('btco', False)
         return public.returnMsg(True, '移除成功!')
     public.SetConfigValue('btco', False)
     return public.returnMsg(True, '移除成功')
Ejemplo n.º 14
0
 def BtcoInstall(self, get):
     v = public.version()
     if v[-2] == '.':
         if v < '6.9.1':
             public.returnMsg(False, '抱歉,面板当前版本不支持BTCO,请升级面板至最新版')
         else:
             if v < '6.9.15':
                 public.returnMsg(False, '抱歉,面板当前版本不支持BTCO,请升级面板至最新版')
     if not public.GetConfigValue('btco'):
         initobj = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
         for initLine in initobj:
             for btcoin in ['<!--BTCO-->']:
                 if btcoin.upper() in initLine.upper():
                     self.BtcoIns.append(btcoin)
             if len(self.BtcoIns) != 0:
                 initobj.close()
                 public.SetConfigValue('btco', True)
                 public.SetConfigValue('btco_init', True)
                 return public.returnMsg(True, '您已安装过了。')
         # BTCO 强制跳转写入
         BtcoAdd = '<!--BTCO-->\n   <script> if(navigator.userAgent.match(/mobile/i)){let a=document.location.toString().split("//"),urlArr=["/","/config"],thisUrl=urlArr.indexOf(a[1].substring(a[1].indexOf("/")));if(thisUrl>-1)window.location.href="/btco/index.html#"+urlArr[thisUrl]} </script> \n   <!--BTCO-->'
         initCoutent = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'r')
         BtcoAddIn = initCoutent.read().split("</head>")
         initCoutent.close()
         BtcoAddin = open(
             '/www/server/panel/BTPanel/templates/default/layout.html', 'w')
         BtcoAddin.write(BtcoAddIn[0] + BtcoAdd + "</head>" + BtcoAddIn[1])
         BtcoAddin.close()
         public.restart_panel()
         public.SetConfigValue('btco', True)
         public.SetConfigValue('btco_init', True)
         return public.returnMsg(True, '安装成功,感谢支持.')
     elif public.GetConfigValue('btco'):
         return public.returnMsg(True, '您已安装过了.')
     return public.returnMsg(False, '安装失败')
Ejemplo n.º 15
0
    def setPanel(self, get):
        if not public.IsRestart():
            return public.returnMsg(False, 'EXEC_ERR_TASK')
        isReWeb = False
        sess_out_path = 'data/session_timeout.pl'
        if 'session_timeout' in get:
            session_timeout = int(get.session_timeout)
            s_time_tmp = public.readFile(sess_out_path)
            if not s_time_tmp: s_time_tmp = '0'
            if int(s_time_tmp) != session_timeout:
                if session_timeout < 300:
                    return public.returnMsg(False, '超时时间不能小于300秒')
                public.writeFile(sess_out_path, str(session_timeout))
                isReWeb = True

        workers_p = 'data/workers.pl'
        if 'workers' in get:
            workers = int(get.workers)
            if int(public.readFile(workers_p)) != workers:
                if workers < 1 or workers > 1024:
                    return public.returnMsg(False, '面板线程数范围应该在1-1024之间')
                public.writeFile(workers_p, str(workers))
                isReWeb = True

        if get.domain:
            reg = "^([\w\-\*]{1,100}\.){1,4}(\w{1,10}|\w{1,10}\.\w{1,10})$"
            if not re.match(reg, get.domain):
                return public.returnMsg(False, 'SITE_ADD_ERR_DOMAIN')

        oldPort = public.GetHost(True)
        newPort = get.port
        if oldPort != get.port:
            get.port = str(int(get.port))
            if self.IsOpen(get.port):
                return public.returnMsg(False, 'PORT_CHECK_EXISTS',
                                        (get.port, ))
            if int(get.port) >= 65535 or int(get.port) < 100:
                return public.returnMsg(False, 'PORT_CHECK_RANGE')
            public.writeFile('data/port.pl', get.port)
            import firewalls
            get.ps = public.getMsg('PORT_CHECK_PS')
            fw = firewalls.firewalls()
            fw.AddAcceptPort(get)
            get.port = oldPort
            get.id = public.M('firewall').where("port=?",
                                                (oldPort, )).getField('id')
            fw.DelAcceptPort(get)
            isReWeb = True

        if get.webname != session['title']:
            session['title'] = get.webname
            public.SetConfigValue('title', get.webname)

        limitip = public.readFile('data/limitip.conf')
        if get.limitip != limitip:
            public.writeFile('data/limitip.conf', get.limitip)

        public.writeFile('data/domain.conf', get.domain.strip())
        public.writeFile('data/iplist.txt', get.address)

        public.M('config').where("id=?", ('1', )).save(
            'backup_path,sites_path', (get.backup_path, get.sites_path))
        session['config']['backup_path'] = os.path.join('/', get.backup_path)
        session['config']['sites_path'] = os.path.join('/', get.sites_path)
        mhost = public.GetHost()
        if get.domain.strip(): mhost = get.domain
        data = {
            'uri': request.path,
            'host': mhost + ':' + newPort,
            'status': True,
            'isReWeb': isReWeb,
            'msg': public.getMsg('PANEL_SAVE')
        }
        public.WriteLog('TYPE_PANEL', 'PANEL_SET_SUCCESS',
                        (newPort, get.domain, get.backup_path, get.sites_path,
                         get.address, get.limitip))
        if isReWeb: public.restart_panel()
        return data