diff --git a/app/add.py b/app/add.py index 7b361ed..5056c92 100644 --- a/app/add.py +++ b/app/add.py @@ -182,18 +182,18 @@ if form.getvalue('mode') is not None: filter = "" if compression == "1" or cache == "2": filter = " filter compression\n" - if compression == "1": - compression_s = " compression algo gzip\n compression type text/html text/plain text/css\n" if cache == "2": cache_s = " http-request cache-use "+end_name+"\n http-response cache-store "+end_name+"\n" cache_set = "cache "+end_name+"\n total-max-size 4\n max-age 240\n" + if compression == "1": + compression_s = " compression algo gzip\n compression type text/html text/plain text/css\n" waf = "" if form.getvalue('waf') is not None: waf = " filter spoe engine modsecurity config "+haproxy_dir+"/waf.conf\n" waf += " http-request deny if { var(txn.modsec.code) -m int gt 0 }\n" - config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + filter + compression_s + cache_s + waf + backend + servers_split + "\n" + cache_set + config_add = "\n" + name + "\n" + bind + mode + maxconn + balance + options_split + cache_s + filter + compression_s + waf + backend + servers_split + "\n" + cache_set + "\n" if form.getvalue('new_userlist') is not None: name = "userlist "+form.getvalue('new_userlist')+ "\n" @@ -231,7 +231,7 @@ try: with open(cfg, "a") as conf: conf.write(config_add) except IOError: - print("Can't read import config file") + print("error: Can't read import config file") funct.logging(serv, "add.py add new %s" % name) print('
') @@ -243,7 +243,7 @@ try: stderr = funct.upload_and_restart(serv, cfg, just_save="save") if stderr: - print('
%s
X
' % stderr) + print('
%s
X
' % stderr) else: print('' % (name, config_add, serv)) diff --git a/app/create_db.py b/app/create_db.py index 86f1578..8b5f3d4 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -610,7 +610,7 @@ def update_db_v_4_4_2(**kwargs): def update_ver(**kwargs): con, cur = get_cur() - sql = """update version set version = '4.4.0.0'; """ + sql = """update version set version = '4.4.1.0'; """ try: cur.execute(sql) con.commit() diff --git a/app/funct.py b/app/funct.py index 1102441..d434465 100644 --- a/app/funct.py +++ b/app/funct.py @@ -864,7 +864,10 @@ def haproxy_wi_log(**kwargs): def show_ip(stdout): for line in stdout: - print(line) + if "Permission denied" in line: + print('error: '+line) + else: + print(line) def server_status(stdout): diff --git a/app/hapservers.py b/app/hapservers.py index e29e789..317bb3f 100644 --- a/app/hapservers.py +++ b/app/hapservers.py @@ -49,7 +49,7 @@ for s in servers: servers_with_status.append(s[2]) servers_with_status.append(s[11]) if service == 'nginx': - cmd = [ "/usr/sbin/nginx -v && systemctl status nginx |grep -e 'Active\|Tasks' |awk '{print $2, $9$10$11$12$13}'" ] + cmd = [ "/usr/sbin/nginx -v && systemctl status nginx |grep -e 'Active' |awk '{print $2, $9$10$11$12$13}' && ps ax |grep nginx:|grep -v grep |wc -l" ] out = funct.ssh_command(s[2], cmd) h = () out1 = [] diff --git a/app/options.py b/app/options.py index cd710f3..5509a87 100644 --- a/app/options.py +++ b/app/options.py @@ -1852,16 +1852,16 @@ if form.getvalue('newsmon') is not None: try: port = int(port) except: - print('error: port must number') + print('SMON error: port must number') sys.exit() if port > 65535 or port < 0: - print('error: port must be 0-65535') + print('SMON error: port must be 0-65535') sys.exit() if port == 80 and http == 'https': - print('error: Cannot be HTTPS with 80 port') + print('SMON error: Cannot be HTTPS with 80 port') sys.exit() if port == 443 and http == 'http': - print('error: Cannot be HTTP with 443 port') + print('SMON error: Cannot be HTTP with 443 port') sys.exit() if sql.insert_smon(server, port, enable, http, uri, body, group, desc, telegram, user_group): @@ -1870,7 +1870,7 @@ if form.getvalue('newsmon') is not None: template = env.get_template('ajax/show_new_smon.html') template = template.render(smon=sql.select_smon(user_group,ip=server,port=port,proto=http,uri=uri,body=body), telegrams=sql.get_user_telegram_by_group(user_group)) print(template) - funct.logging('SMON','Has been add a new server '+server+' to SMON ', haproxywi=1, login=1) + funct.logging('SMON', ' Has been add a new server '+server+' to SMON ', haproxywi=1, login=1) if form.getvalue('smondel') is not None: @@ -1882,7 +1882,7 @@ if form.getvalue('smondel') is not None: if sql.delete_smon(id, user_group): print('Ok') - funct.logging('SMON','Has been delete server from SMON ', haproxywi=1, login=1) + funct.logging('SMON', ' Has been delete server from SMON ', haproxywi=1, login=1) if form.getvalue('showsmon') is not None: @@ -1913,21 +1913,21 @@ if form.getvalue('updateSmonIp') is not None: try: port = int(port) except: - print('error: port must number') + print('SMON error: port must number') sys.exit() if port > 65535 or port < 0: - print('error: port must be 0-65535') + print('SMON error: port must be 0-65535') sys.exit() if port == 80 and http == 'https': - print('error: Cannot be https with 80 port') + print('SMON error: Cannot be https with 80 port') sys.exit() if port == 443 and http == 'http': - print('error: Cannot be HTTP with 443 port') + print('SMON error: Cannot be HTTP with 443 port') sys.exit() if sql.update_smon(id, ip, port, body, telegram, group, desc, en): print("Ok") - funct.logging('SMON','Has been update the server '+ip+' to SMON ', haproxywi=1, login=1) + funct.logging('SMON', ' Has been update the server '+ip+' to SMON ', haproxywi=1, login=1) if form.getvalue('showBytes') is not None: diff --git a/app/templates/base.html b/app/templates/base.html index 9ed83cf..06ea3a1 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -80,6 +80,7 @@
  • Configs
  • Stats
  • Versions
  • +
  • SSL
  • diff --git a/app/templates/hapservers.html b/app/templates/hapservers.html index de9a540..860be5b 100644 --- a/app/templates/hapservers.html +++ b/app/templates/hapservers.html @@ -49,7 +49,11 @@ }); }); -
    +{% if serv %} +
    +{% else %} +
    +{% endif %} {% if servers|length == 0 %} {% include 'include/getstarted.html' %} {% endif %} @@ -67,6 +71,7 @@ {% endfor %} {% endif %} showOverviewServer('{{s.1}}', '{{s.2}}', '{{s.0}}', '{{service}}'); + showBytes('{{ s.2 }}') } showMetrics(); @@ -126,11 +131,17 @@ {% endif %}
    -
    + {% if service == 'nginx' %} +
    + {% else %} +
    + {% endif %} {{s.3}}
    {% if service == 'nginx' %} - Version: {{s.5.0.2}} Process_num: {{s.5.0.5}} {% if s.5.0.3 == 'active' %} Uptime: {% else %} Downtime: {% endif %} {{s.5.0.4}} + Version: {{s.5.0.2}} Process_num: {{s.5.0.5}} {% if s.5.0.3 == 'active' %} +
    + Uptime: {% else %} Downtime: {% endif %} {{s.5.0.4}} {% else %} {% if s.5.0 is defined %} {{s.5.0.0}} {{s.5.0.1}} {{s.5.0.2}} @@ -187,28 +198,29 @@
    {% if serv %} - + {% if service == 'haproxy' %} +
    + {% endif %}
    - -
    -
    +
    +
    {% if service == 'haproxy' %} Backends: {% else %} Virtual hosts: {% endif %} -
    +
    {% endif %} {% endfor %}
    {% if serv and service == 'haproxy' %} -
    +
    {% for s in servers %} -
    +
    diff --git a/app/templates/include/add_proxy.html b/app/templates/include/add_proxy.html index fa149f3..ce26a9c 100644 --- a/app/templates/include/add_proxy.html +++ b/app/templates/include/add_proxy.html @@ -6,6 +6,11 @@

    {{ add }} was success added

    {{ conf_add }}
    + {% endif %}
    diff --git a/inc/add.js b/inc/add.js index 3e55992..1c6c3ae 100644 --- a/inc/add.js +++ b/inc/add.js @@ -660,7 +660,54 @@ $( function() { $( "#serv3" ).on('selectmenuchange',function() { change_select_acceleration("3"); }); - + $('#compression').on( "click", function() { + if ($('#compression').is(':checked')) { + $("#cache").checkboxradio( "disable" ); + $("#cache").prop('checked', false); + } else { + change_select_acceleration(""); + } + }); + $('#compression2').on( "click", function() { + if ($('#compression2').is(':checked')) { + $("#cache2").checkboxradio( "disable" ); + $("#cache2").prop('checked', false); + } else { + change_select_acceleration('2'); + } + }); + $('#compression3').on( "click", function() { + if ($('#compression3').is(':checked')) { + $("#cache3").checkboxradio( "disable" ); + $("#cache3").prop('checked', false); + } else { + change_select_acceleration('3'); + } + }); + $('#cache').on( "click", function() { + if ($('#cache').is(':checked')) { + $("#compression").checkboxradio( "disable" ); + $("#compression").prop('checked', false); + } else { + $("#compression").checkboxradio( "enable" ); + } + }); + $('#cache2').on( "click", function() { + if ($('#cache2').is(':checked')) { + $("#compression2").checkboxradio( "disable" ); + $("#compression2").prop('checked', false); + } else { + $("#compression2").checkboxradio( "enable" ); + } + }); + $('#cache3').on( "click", function() { + if ($('#cache3').is(':checked')) { + $("#compression3").checkboxradio( "disable" ); + $("#compression3").prop('checked', false); + } else { + $("#compression3").checkboxradio( "enable" ); + } + }); $( "#add1" ).on( "click", function() { $('.menu li ul li').each(function () { $(this).find('a').css('padding-left', '20px') @@ -896,6 +943,8 @@ function resetProxySettings() { $('[id^=https-hide]').hide(); $('[name=mode').val('http'); $('select').selectmenu('refresh'); + $("#path-cert-listen" ).attr('required',false); + $("#path-cert-frontend" ).attr('required',false); replace_text("#optionsInput", ssl_offloading_var); replace_text("#optionsInput1", ssl_offloading_var); replace_text("#optionsInput2", ssl_offloading_var); @@ -914,7 +963,8 @@ function createSsl(TabId, proxy) { $( "#tabs" ).tabs( "option", "active", TabId ); $( "#https-hide-"+proxy).show("fast"); $('#https-'+proxy).prop( "checked", true ); - $('#https-'+proxy).checkboxradio("refresh") + $('#https-'+proxy).checkboxradio("refresh"); + $("#path-cert-"+proxy ).attr('required',true); history.pushState('Add'+proxy, 'Add'+proxy, 'add.py#'+proxy) } function createHttps(TabId, proxy) { @@ -1083,8 +1133,10 @@ function change_select_acceleration(id) { token: $('#token').val() }, type: "POST", - success: function( data ) { - if(parseFloat(data) < parseFloat('1.8')) { + success: function( data ) { + data = data.replace(/\s+/g,' '); + console.log('"'+data+'"'); + if(parseFloat(data) < parseFloat('1.8') || data == ' ') { $("#cache"+id).checkboxradio( "disable" ); } else { $("#cache"+id).checkboxradio( "enable" ); diff --git a/inc/script.js b/inc/script.js index 673e10f..92ef021 100644 --- a/inc/script.js +++ b/inc/script.js @@ -91,6 +91,15 @@ $( function() { $(this).parent().find('a').css('padding-left', '20px'); $(this).find('a').css('padding-left', '30px'); $(this).find('a').css('border-left', '4px solid #5D9CEB'); + } else if(cur_url[0] == 'add.py' && cur_url[1].split('&')[0] == 'service=nginx#ssl' && link2 == 'add.py?service=nginx#ssl'){ + $(this).parent().css('display', 'contents'); + $(this).parent().css('font-size', '13px'); + $(this).parent().css('top', '0'); + $(this).parent().css('left', '0'); + $(this).parent().children().css('margin-left', '-20px'); + $(this).parent().find('a').css('padding-left', '20px'); + $(this).find('a').css('padding-left', '30px'); + $(this).find('a').css('border-left', '4px solid #5D9CEB'); } }); }); diff --git a/inc/style.css b/inc/style.css index c6c7fcb..e3c6be0 100644 --- a/inc/style.css +++ b/inc/style.css @@ -822,7 +822,7 @@ label { } .ajax-server { margin: 25px; - margin-left: 440px; + margin-left: 757px; margin-bottom: 0; width: 778px; display: none;