mirror of https://github.com/Aidaho12/haproxy-wi
parent
3fd324f0b3
commit
7b024f18f1
|
@ -4,7 +4,7 @@ import funct
|
||||||
import sql
|
import sql
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('add.html')
|
template = env.get_template('add.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
serv = form.getvalue('serv')
|
serv = form.getvalue('serv')
|
||||||
|
|
|
@ -172,9 +172,6 @@ def update_db_v_31(**kwargs):
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server_enable', '0', 'logs', 'If exist syslog server for HAproxy logs, enable this option');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server_enable', '0', 'logs', 'If exist syslog server for HAproxy logs, enable this option');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server', '0', 'logs', 'IP address syslog server');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server', '0', 'logs', 'IP address syslog server');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('log_time_storage', '14', 'logs', 'Time of storage of logs of user activity, in days');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('log_time_storage', '14', 'logs', 'Time of storage of logs of user activity, in days');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('restart_command', 'systemctl restart haproxy', 'haproxy', 'Command for restart HAproxy service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('status_command', 'systemctl status haproxy', 'haproxy', 'Command for status check HAproxy service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_user', 'admin', 'haproxy', 'Username for Stats web page HAproxy');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_user', 'admin', 'haproxy', 'Username for Stats web page HAproxy');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_password', 'password', 'haproxy', 'Password for Stats web page HAproxy');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_password', 'password', 'haproxy', 'Password for Stats web page HAproxy');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_port', '8085', 'haproxy', 'Port Stats web page HAproxy');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('stats_port', '8085', 'haproxy', 'Port Stats web page HAproxy');")
|
||||||
|
@ -264,25 +261,6 @@ def update_db_v_3_4_7(**kwargs):
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
def update_db_v_3_4_9_5(**kwargs):
|
|
||||||
con, cur = get_cur()
|
|
||||||
sql = """INSERT INTO settings (param, value, section, `desc`) values('reload_command', 'systemctl reload haproxy', 'haproxy', 'Command for reload HAproxy service'); """
|
|
||||||
try:
|
|
||||||
cur.execute(sql)
|
|
||||||
con.commit()
|
|
||||||
except sqltool.Error as e:
|
|
||||||
if kwargs.get('silent') != 1:
|
|
||||||
if e.args[0] == 'duplicate column name: param' or e == "1060 (42S21): Duplicate column name 'param' ":
|
|
||||||
print('DB was update to 3.4.9.5')
|
|
||||||
else:
|
|
||||||
print("Updating... go to version 3.8.1")
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
cur.close()
|
|
||||||
con.close()
|
|
||||||
|
|
||||||
|
|
||||||
def update_db_v_3_5_3(**kwargs):
|
def update_db_v_3_5_3(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); """
|
sql = """CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`)); """
|
||||||
|
@ -392,9 +370,6 @@ def update_db_v_4(**kwargs):
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_password', 'password', 'nginx', 'Password for Stats web page Nginx');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_password', 'password', 'nginx', 'Password for Stats web page Nginx');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_port', '8086', 'nginx', 'Stats port for web page Nginx');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_port', '8086', 'nginx', 'Stats port for web page Nginx');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_page', 'stats', 'nginx', 'URI Stats for web page Nginx');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_stats_page', 'stats', 'nginx', 'URI Stats for web page Nginx');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_restart_command', 'systemctl restart nginx', 'nginx', 'Command for restart Nginx service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_reload_command', 'systemctl reload nginx', 'nginx', 'Command for reload Nginx service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_status_command', 'systemctl status nginx', 'nginx', 'Command for status check Nginx service');")
|
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_dir', '/etc/nginx/conf.d/', 'nginx', 'Path to Nginx dir');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_dir', '/etc/nginx/conf.d/', 'nginx', 'Path to Nginx dir');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_config_path', '/etc/nginx/conf.d/default.conf', 'nginx', 'Path to Nginx config');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('nginx_config_path', '/etc/nginx/conf.d/default.conf', 'nginx', 'Path to Nginx config');")
|
||||||
for i in sql:
|
for i in sql:
|
||||||
|
@ -473,7 +448,6 @@ def update_all():
|
||||||
if funct.check_ver() is None:
|
if funct.check_ver() is None:
|
||||||
update_db_v_3_4_5_22()
|
update_db_v_3_4_5_22()
|
||||||
update_db_v_3_4_7()
|
update_db_v_3_4_7()
|
||||||
update_db_v_3_4_9_5()
|
|
||||||
update_db_v_3_5_3()
|
update_db_v_3_5_3()
|
||||||
update_db_v_3_8_1()
|
update_db_v_3_8_1()
|
||||||
update_db_v_3_12()
|
update_db_v_3_12()
|
||||||
|
@ -491,7 +465,6 @@ def update_all_silent():
|
||||||
if funct.check_ver() is None:
|
if funct.check_ver() is None:
|
||||||
update_db_v_3_4_5_22()
|
update_db_v_3_4_5_22()
|
||||||
update_db_v_3_4_7(silent=1)
|
update_db_v_3_4_7(silent=1)
|
||||||
update_db_v_3_4_9_5(silent=1)
|
|
||||||
update_db_v_3_5_3(silent=1)
|
update_db_v_3_5_3(silent=1)
|
||||||
update_db_v_3_8_1(silent=1)
|
update_db_v_3_8_1(silent=1)
|
||||||
update_db_v_3_12(silent=1)
|
update_db_v_3_12(silent=1)
|
||||||
|
|
|
@ -583,18 +583,18 @@ def upload_and_restart(serv, cfg, **kwargs):
|
||||||
if kwargs.get("just_save") == "save":
|
if kwargs.get("just_save") == "save":
|
||||||
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q"]
|
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q"]
|
||||||
elif kwargs.get("just_save") == "reload":
|
elif kwargs.get("just_save") == "reload":
|
||||||
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q && sudo " + sql.get_setting('nginx_reload_command') ]
|
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q && sudo systemctl reload nginx" ]
|
||||||
else:
|
else:
|
||||||
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q && sudo " + sql.get_setting('nginx_restart_command') ]
|
commands = [ "sudo mv -f " + tmp_file + " " + config_path + " && sudo nginx -t -q && sudo systemctl restart nginx" ]
|
||||||
else:
|
else:
|
||||||
if kwargs.get("just_save") == "test":
|
if kwargs.get("just_save") == "test":
|
||||||
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo rm -f " + tmp_file ]
|
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo rm -f " + tmp_file ]
|
||||||
elif kwargs.get("just_save") == "save":
|
elif kwargs.get("just_save") == "save":
|
||||||
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path ]
|
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path ]
|
||||||
elif kwargs.get("just_save") == "reload":
|
elif kwargs.get("just_save") == "reload":
|
||||||
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path + " && sudo " + sql.get_setting('reload_command') ]
|
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path + " && sudo systemctl reload haproxy" ]
|
||||||
else:
|
else:
|
||||||
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path + " && sudo " + sql.get_setting('restart_command') ]
|
commands = [ "sudo haproxy -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + config_path + " && sudo systemctl restart haproxy" ]
|
||||||
if sql.get_setting('firewall_enable') == "1":
|
if sql.get_setting('firewall_enable') == "1":
|
||||||
commands.extend(open_port_firewalld(cfg))
|
commands.extend(open_port_firewalld(cfg))
|
||||||
error += str(upload(serv, tmp_file, cfg, dir='fullpath'))
|
error += str(upload(serv, tmp_file, cfg, dir='fullpath'))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import funct
|
import funct
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('ha.html')
|
template = env.get_template('ha.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import funct, sql
|
import funct, sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('hapservers.html')
|
template = env.get_template('hapservers.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
@ -25,6 +25,9 @@ if service == 'nginx':
|
||||||
stderr = ''
|
stderr = ''
|
||||||
servers = sql.get_dick_permit(virt=1, nginx=1)
|
servers = sql.get_dick_permit(virt=1, nginx=1)
|
||||||
service = 'nginx'
|
service = 'nginx'
|
||||||
|
if serv:
|
||||||
|
servers = sql.select_servers(server=serv)
|
||||||
|
autorefresh = 1
|
||||||
else:
|
else:
|
||||||
title = "HAProxy servers overview"
|
title = "HAProxy servers overview"
|
||||||
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
|
cmd = "ps ax |grep -e 'keep_alive.py' |grep -v grep |wc -l"
|
||||||
|
|
|
@ -11,7 +11,7 @@ import create_db
|
||||||
import datetime
|
import datetime
|
||||||
import uuid
|
import uuid
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('login.html')
|
template = env.get_template('login.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import funct
|
import funct
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('logs.html')
|
template = env.get_template('logs.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import sql
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('metrics.html')
|
template = env.get_template('metrics.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -137,7 +137,7 @@ if form.getvalue('action_waf') is not None and serv is not None:
|
||||||
|
|
||||||
if act == "overviewHapserverBackends":
|
if act == "overviewHapserverBackends":
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||||
template = env.get_template('haproxyservers_backends.html')
|
template = env.get_template('haproxyservers_backends.html')
|
||||||
|
|
||||||
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
hap_configs_dir = funct.get_config_var('configs', 'haproxy_save_configs_dir')
|
||||||
|
@ -208,7 +208,7 @@ if act == "overview":
|
||||||
async def get_runner_overview():
|
async def get_runner_overview():
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'),extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True,extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
||||||
|
|
||||||
servers = []
|
servers = []
|
||||||
template = env.get_template('overview.html')
|
template = env.get_template('overview.html')
|
||||||
|
@ -246,7 +246,7 @@ if act == "overviewwaf":
|
||||||
async def get_runner_overviewWaf():
|
async def get_runner_overviewWaf():
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'),extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True,extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
||||||
template = env.get_template('overivewWaf.html')
|
template = env.get_template('overivewWaf.html')
|
||||||
|
|
||||||
servers = []
|
servers = []
|
||||||
|
@ -288,7 +288,7 @@ if act == "overviewServers":
|
||||||
async def get_runner_overviewServers(**kwargs):
|
async def get_runner_overviewServers(**kwargs):
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'),extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True,extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'])
|
||||||
template = env.get_template('overviewServers.html')
|
template = env.get_template('overviewServers.html')
|
||||||
|
|
||||||
servers = []
|
servers = []
|
||||||
|
@ -884,7 +884,7 @@ if form.getvalue('backup') or form.getvalue('deljob') or form.getvalue('backupup
|
||||||
funct.logging('backup ', ' has created a new backup job for server '+server , haproxywi=1, login=1)
|
funct.logging('backup ', ' has created a new backup job for server '+server , haproxywi=1, login=1)
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||||
template = env.get_template('new_backup.html')
|
template = env.get_template('new_backup.html')
|
||||||
template = template.render(backups=sql.select_backups(server=server, rserver=rserver), sshs=sql.select_ssh())
|
template = template.render(backups=sql.select_backups(server=server, rserver=rserver), sshs=sql.select_ssh())
|
||||||
print(template)
|
print(template)
|
||||||
|
@ -924,7 +924,7 @@ if form.getvalue('metrics_waf'):
|
||||||
if form.getvalue('table_metrics'):
|
if form.getvalue('table_metrics'):
|
||||||
import http.cookies
|
import http.cookies
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||||
template = env.get_template('table_metrics.html')
|
template = env.get_template('table_metrics.html')
|
||||||
|
|
||||||
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
||||||
|
@ -1045,7 +1045,7 @@ if form.getvalue('bwlists_save'):
|
||||||
print('<div class="alert alert-success" style="margin:10px; margin-left:14px">Edited '+color+' list was uploaded to '+server[1]+'</div>')
|
print('<div class="alert alert-success" style="margin:10px; margin-left:14px">Edited '+color+' list was uploaded to '+server[1]+'</div>')
|
||||||
funct.logging(server[1], 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1)
|
funct.logging(server[1], 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1)
|
||||||
if form.getvalue('bwlists_restart') == 'restart':
|
if form.getvalue('bwlists_restart') == 'restart':
|
||||||
funct.ssh_command(server[2], ["sudo " + sql.get_setting('restart_command')])
|
funct.ssh_command(server[2], ["sudo systemctl restart haproxy"])
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('get_lists'):
|
if form.getvalue('get_lists'):
|
||||||
|
@ -1290,7 +1290,7 @@ if form.getvalue('new_ssh'):
|
||||||
else:
|
else:
|
||||||
if sql.insert_new_ssh(name, enable, group, username, password):
|
if sql.insert_new_ssh(name, enable, group, username, password):
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||||
template = env.get_template('/new_ssh.html')
|
template = env.get_template('/new_ssh.html')
|
||||||
output_from_parsed_template = template.render(groups = sql.select_groups(), sshs = sql.select_ssh(name=name),page=page)
|
output_from_parsed_template = template.render(groups = sql.select_groups(), sshs = sql.select_ssh(name=name),page=page)
|
||||||
print(output_from_parsed_template)
|
print(output_from_parsed_template)
|
||||||
|
@ -1385,7 +1385,7 @@ if form.getvalue('newtelegram'):
|
||||||
else:
|
else:
|
||||||
if sql.insert_new_telegram(token, channel, group):
|
if sql.insert_new_telegram(token, channel, group):
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/ajax'))
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
||||||
template = env.get_template('/new_telegram.html')
|
template = env.get_template('/new_telegram.html')
|
||||||
output_from_parsed_template = template.render(groups = sql.select_groups(), telegrams = sql.select_telegram(token=token),page=page)
|
output_from_parsed_template = template.render(groups = sql.select_groups(), telegrams = sql.select_telegram(token=token),page=page)
|
||||||
print(output_from_parsed_template)
|
print(output_from_parsed_template)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import funct, sql
|
import funct, sql
|
||||||
import create_db
|
import create_db
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('ovw.html')
|
template = env.get_template('ovw.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import funct
|
import funct
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('runtimeapi.html')
|
template = env.get_template('runtimeapi.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(extensions=["jinja2.ext.do"],loader=FileSystemLoader('templates/'))
|
env = Environment(extensions=["jinja2.ext.do"],loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('servers.html')
|
template = env.get_template('servers.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ def main():
|
||||||
funct.logging("localhost", " "+alert, keep_alive=1)
|
funct.logging("localhost", " "+alert, keep_alive=1)
|
||||||
|
|
||||||
start_command = []
|
start_command = []
|
||||||
start_command.append('sudo '+sql.get_setting('restart_command'))
|
start_command.append('sudo systemct restart haproxy')
|
||||||
funct.ssh_command(serv[0], start_command)
|
funct.ssh_command(serv[0], start_command)
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('admin.html')
|
template = env.get_template('admin.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import funct, sql
|
import funct, sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('delver.html')
|
template = env.get_template('delver.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -4,7 +4,7 @@ import datetime
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('logs.html')
|
template = env.get_template('logs.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import funct
|
import funct
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('viewstats.html')
|
template = env.get_template('viewstats.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
serv = form.getvalue('serv')
|
serv = form.getvalue('serv')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('waf.html')
|
template = env.get_template('waf.html')
|
||||||
|
|
||||||
print('Content-type: text/html\n')
|
print('Content-type: text/html\n')
|
||||||
|
|
|
@ -246,7 +246,7 @@ function confirmAjaxAction(action, service, id) {
|
||||||
height: "auto",
|
height: "auto",
|
||||||
width: 400,
|
width: 400,
|
||||||
modal: true,
|
modal: true,
|
||||||
title: "Are you sure you want "+ action + " " + id + "?",
|
title: "Are you sure you want to "+ action + " " + id + "?",
|
||||||
buttons: {
|
buttons: {
|
||||||
"Sure": function() {
|
"Sure": function() {
|
||||||
$( this ).dialog( "close" );
|
$( this ).dialog( "close" );
|
||||||
|
|
Loading…
Reference in New Issue