mirror of https://github.com/Aidaho12/haproxy-wi
parent
523f64a029
commit
822b741787
156
cgi-bin/add.py
156
cgi-bin/add.py
|
@ -48,13 +48,35 @@ if form.getvalue('mode') is not None:
|
||||||
name = "backend " + form.getvalue('backend')
|
name = "backend " + form.getvalue('backend')
|
||||||
backend = ""
|
backend = ""
|
||||||
|
|
||||||
|
if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp":
|
||||||
|
ssl = "ssl crt " + form.getvalue('cert')
|
||||||
|
if form.getvalue('ssl-check') == "ssl-check":
|
||||||
|
ssl_check = " ssl verify none"
|
||||||
|
else:
|
||||||
|
ssl_check = " ssl verify"
|
||||||
|
else:
|
||||||
|
ssl_check = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not ip and form.getvalue('port') is not None:
|
if not ip and form.getvalue('port') is not None:
|
||||||
bind = " bind *:"+ port + "\n"
|
bind = " bind *:"+ port + " " + ssl + "\n"
|
||||||
elif port is not None:
|
elif port is not None:
|
||||||
bind = " bind " + ip + ":" + port + "\n"
|
bind = " bind " + ip + ":" + port + " " + ssl + "\n"
|
||||||
else:
|
else:
|
||||||
bind = ""
|
bind = ""
|
||||||
|
|
||||||
|
if form.getvalue('default-check') == "1":
|
||||||
|
if form.getvalue('check-servers') == "1":
|
||||||
|
check = " check inter " + form.getvalue('inter') + " rise " + form.getvalue('rise') + " fall " + form.getvalue('fall') + ssl_check
|
||||||
|
else:
|
||||||
|
check = ""
|
||||||
|
else:
|
||||||
|
if form.getvalue('check-servers') != "1":
|
||||||
|
check = ""
|
||||||
|
else:
|
||||||
|
check = " check" + ssl_check
|
||||||
|
|
||||||
if form.getvalue('option') is not None:
|
if form.getvalue('option') is not None:
|
||||||
options = form.getvalue('option')
|
options = form.getvalue('option')
|
||||||
i = options.split("\n")
|
i = options.split("\n")
|
||||||
|
@ -69,7 +91,8 @@ if form.getvalue('mode') is not None:
|
||||||
i = servers.split("\n")
|
i = servers.split("\n")
|
||||||
servers_split = ""
|
servers_split = ""
|
||||||
for j in i:
|
for j in i:
|
||||||
servers_split += " " + j + "\n"
|
j = j.strip('\t\n\r')
|
||||||
|
servers_split += " server " + j + check + "\n"
|
||||||
else:
|
else:
|
||||||
servers_split = ""
|
servers_split = ""
|
||||||
|
|
||||||
|
@ -85,7 +108,6 @@ if form.getvalue('mode') is not None:
|
||||||
try:
|
try:
|
||||||
with open(cfg, "a") as conf:
|
with open(cfg, "a") as conf:
|
||||||
conf.write(config_add)
|
conf.write(config_add)
|
||||||
#print('<meta http-equiv="refresh" content="50; url=add.py?add=%s&conf=%s">' % (name, config_add))
|
|
||||||
except IOError:
|
except IOError:
|
||||||
print("Can't read import config file")
|
print("Can't read import config file")
|
||||||
|
|
||||||
|
@ -104,14 +126,14 @@ if form.getvalue('add') is not None:
|
||||||
|
|
||||||
print('<div id="tabs">'
|
print('<div id="tabs">'
|
||||||
'<ul>'
|
'<ul>'
|
||||||
'<li><a href="#listner">Listner</a></li>'
|
'<li><a href="#listen">Listen</a></li>'
|
||||||
'<li><a href="#frontend">Frontend</a></li>'
|
'<li><a href="#frontend">Frontend</a></li>'
|
||||||
'<li><a href="#backend">Backend</a></li>'
|
'<li><a href="#backend">Backend</a></li>'
|
||||||
'</ul>'
|
'</ul>'
|
||||||
'<div id="listner">'
|
'<div id="listen">'
|
||||||
'<form name="add-listner" action="add.py">'
|
'<form name="add-listner" action="add.py">'
|
||||||
'<table>'
|
'<table>'
|
||||||
'<caption><h2>Add listner</h2></caption>'
|
'<caption><h2>Add listen</h2></caption>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Select server: </td>'
|
'<td class="addName">Select server: </td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
|
@ -128,24 +150,33 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Name:</td>'
|
'<td class="addName">Name:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<input type="text" name="listner" id="name" required title="Name Listner" placeholder="web_80">'
|
'<input type="text" name="listner" id="name" required title="Name Listner" placeholder="web_80" class="form-control">'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">IP and Port:</td>'
|
'<td class="addName">IP and Port:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<input type="text" name="ip" id="ip" title="" size="15" placeholder="172.28.0.1"><b>:</b>'
|
'<input type="text" name="ip" id="ip" title="" size="15" placeholder="172.28.0.1" class="form-control"><b>:</b>'
|
||||||
'<input type="text" name="port" required title="Port for bind listner" size="5" placeholder="8080">'
|
'<input type="number" name="port" required title="Port for bind listner" size="5" placeholder="8080" class="form-control">'
|
||||||
'<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.</div>'
|
'<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Mode: </td>'
|
'<td class="addName">Mode: </td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<select required name="mode">'
|
'<select required name="mode" id="listen-mode-select">'
|
||||||
'<option value="http" selected>http</option>'
|
'<option value="http" selected>http</option>'
|
||||||
'<option value="tcp">tcp</option>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
|
'<span id="https-listen-span">'
|
||||||
|
'<label for="https-listen" style="margin-top: 5px;">ssl?</label>'
|
||||||
|
'<input type="checkbox" id="https-listen" name="ssl" value="https">'
|
||||||
|
'</span>'
|
||||||
|
'<div id="https-hide-listen" style="display: none;">'
|
||||||
|
'<br /><span class="tooltip tooltipTop">Enter path to pem file:</span><br />'
|
||||||
|
'<input type="text" name="cert" placeholder="/etc/ssl/cert/some_cert.pem" class="form-control" size="39" id="path-cert-listen"><br />'
|
||||||
|
'<label for="ssl-check-listen" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check-listen" name="ssl-check" value="ssl-check" checked>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
|
@ -163,25 +194,54 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
|
'<label for="options-listen-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-listen-show">'
|
||||||
|
'<div id="options-listen-show-div" style="display: none;">'
|
||||||
'<div class="tooltip">'
|
'<div class="tooltip">'
|
||||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
'<span style="padding-right: 10px;" class="form-control">Start typing options: </span>'
|
||||||
'<input type="text" id="options" >'
|
'<input type="text" id="options" class="form-control">'
|
||||||
'<span style="padding-left: 10px;">'
|
'<span style="padding-left: 10px;">'
|
||||||
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
||||||
'</span>'
|
'</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'<textarea name="option" title="Options thru" id="optionsInput" cols=80 placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
'<textarea name="option" title="Options thru" id="optionsInput" cols=80 placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Servers:</td>'
|
'<td class="addName">Servers:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<textarea name="servers" required title="Backend servers" cols=80 placeholder="server server.local 172.28.0.1:8080 check"></textarea>'
|
'<textarea name="servers" required title="Backend servers" cols=80 placeholder="hostname ip:port"></textarea>'
|
||||||
|
'<div>'
|
||||||
|
'<label for="controlgroup-listen-show" style="margin-top: 5px;">Cusmot check params</label>'
|
||||||
|
'<input type="checkbox" id="controlgroup-listen-show" name="default-check" value="1">'
|
||||||
|
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="controlgroup" id="controlgroup-listen" style="display: none;">'
|
||||||
|
'<label for="check-servers-listen">Check</label><input type="checkbox" id="check-servers-listen" name="check-servers" checked value="1">'
|
||||||
|
'<select name="inter" id="inter-listen">'
|
||||||
|
'<option value="inter" disabled selected>inter</option>'
|
||||||
|
'<option value="1000">1000</option>'
|
||||||
|
'<option value="2000">2000</option>'
|
||||||
|
'<option value="3000">3000</option>'
|
||||||
|
'</select>'
|
||||||
|
'<select name="rise" id="rise-listen">'
|
||||||
|
'<option value="rise" disabled selected>rise</option>'
|
||||||
|
'<option value="1">1</option>'
|
||||||
|
'<option value="2">2</option>'
|
||||||
|
'<option value="3">3</option>'
|
||||||
|
'</select>'
|
||||||
|
'<select name="fall" id="fall-listen">'
|
||||||
|
'<option value="fall" disabled selected>fall</option>'
|
||||||
|
'<option value="4">4</option>'
|
||||||
|
'<option value="5">5</option>'
|
||||||
|
'<option value="6">6</option>'
|
||||||
|
'</select>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addButton">')
|
'<td class="addButton">')
|
||||||
funct.mode_admin("Add Listner")
|
funct.mode_admin("Add Listen")
|
||||||
print('</td>'
|
print('</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'</form>'
|
'</form>'
|
||||||
|
@ -209,14 +269,14 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Name:</td>'
|
'<td class="addName">Name:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<input type="text" name="frontend" id="frontend" required title="Name frontend" placeholder="web_80" >'
|
'<input type="text" name="frontend" id="frontend" required title="Name frontend" placeholder="web_80" class="form-control">'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">IP and Port:</td>'
|
'<td class="addName">IP and Port:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<input type="text" name="ip" id="ip1" size="15" placeholder="172.28.0.1"><b>:</b>'
|
'<input type="text" name="ip" id="ip1" size="15" placeholder="172.28.0.1" class="form-control"><b>:</b>'
|
||||||
'<input type="text" name="port" required title="Port for bind listner" size="5" placeholder="8080">'
|
'<input type="number" name="port" required title="Port for bind listner" size="5" placeholder="8080" class="form-control">'
|
||||||
'<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.</div>'
|
'<div class="tooltip tooltipTop">IP for bind listner, <b>if empty will be assignet on all IPs</b>. Start typing ip, or press down.</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
|
@ -227,26 +287,37 @@ print('</select>'
|
||||||
'<option value="http" selected>http</option>'
|
'<option value="http" selected>http</option>'
|
||||||
'<option value="tcp">tcp</option>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
|
'<span id="https-frontend-span">'
|
||||||
|
'<label for="https-frontend" style="margin-top: 5px;">ssl?</label>'
|
||||||
|
'<input type="checkbox" id="https-frontend" name="ssl" value="https">'
|
||||||
|
'</span>'
|
||||||
|
'<div id="https-hide-frontend" style="display: none;">'
|
||||||
|
'<br /><span class="tooltip tooltipTop">Enter path to pem file:</span><br />'
|
||||||
|
'<input type="text" name="cert" placeholder="/etc/ssl/cert/some_cert.pem" class="form-control" size="39" id="path-cert-frontend">'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
|
'<label for="options-frontend-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-frontend-show">'
|
||||||
|
'<div id="options-frontend-show-div" style="display: none;">'
|
||||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||||
'<input type="text" id="options1" >'
|
'<input type="text" id="options1" class="form-control">'
|
||||||
'<span style="padding-left: 10px;">'
|
'<span style="padding-left: 10px;">'
|
||||||
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
||||||
'</span>'
|
'</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'<textarea name="option" title="Options thru" cols=80 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
'<textarea name="option" title="Options thru" cols=80 id="optionsInput1" placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Default backend</td>'
|
'<td class="addName">Default backend</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<div style="font-size: 12px; padding-bottom: 10px;">Start typing backend, or press down</div>'
|
'<div style="font-size: 12px; padding-bottom: 10px;">Start typing backend, or press down</div>'
|
||||||
'<input name="backend" id="backends" required size="30" placeholder="some_backend">'
|
'<input name="backend" id="backends" required size="30" placeholder="some_backend" class="form-control">'
|
||||||
'<span style="font-size: 12px; padding-left: 10px;"> .</span>'
|
'<span style="font-size: 12px; padding-left: 10px;"> .</span>'
|
||||||
'<p style="font-size: 12px"><b>Note:</b> If backend don\'t exist, you must <a href="#" style="color: #23527c" title="Create backend" id="redirectBackend">create backend first</a>.</p>'
|
'<p style="font-size: 12px"><b>Note:</b> If backend don\'t exist, you must <a href="#" style="color: #23527c" title="Create backend" id="redirectBackend">create backend first</a>.</p>'
|
||||||
'</td>'
|
'</td>'
|
||||||
|
@ -282,7 +353,7 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Name:</td>'
|
'<td class="addName">Name:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<input type="text" name="backend" id="backend" required title="Name backend" placeholder="web_80" >'
|
'<input type="text" name="backend" id="backend" required title="Name backend" placeholder="web_80" class="form-control">'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
|
@ -292,6 +363,15 @@ print('</select>'
|
||||||
'<option value="http" selected>http</option>'
|
'<option value="http" selected>http</option>'
|
||||||
'<option value="tcp">tcp</option>'
|
'<option value="tcp">tcp</option>'
|
||||||
'</select>'
|
'</select>'
|
||||||
|
'<span id="https-backend-span">'
|
||||||
|
'<label for="https-backend" style="margin-top: 5px;">Ssl enabled on frontend?</label>'
|
||||||
|
'<input type="checkbox" id="https-backend" name="ssl" value="https">'
|
||||||
|
'</span>'
|
||||||
|
'<div id="https-hide-backend" style="display: none;">'
|
||||||
|
'<br /><span class="tooltip tooltipTop">Enter path to pem file.</span><br />'
|
||||||
|
'<input type="text" name="cert" placeholder="/etc/ssl/cert/some_cert.pem" class="form-control" size="39" id="path-cert-backend"><br />'
|
||||||
|
'<label for="ssl-check" style="margin-top: 5px;">Disable ssl verify on servers?</label><input type="checkbox" id="ssl-check" name="ssl-check" value="ssl-check" checked>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
|
@ -309,20 +389,50 @@ print('</select>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Optinons:</td>'
|
'<td class="addName">Optinons:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
|
'<label for="options-backend-show" style="margin-top: 5px;">Optinons</label><input type="checkbox" id="options-backend-show">'
|
||||||
|
'<div id="options-backend-show-div" style="display: none;">'
|
||||||
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
'<div style="font-size: 12px; padding-bottom: 10px;">'
|
||||||
'<span style="padding-right: 10px;">Start typing options: </span>'
|
'<span style="padding-right: 10px;">Start typing options: </span>'
|
||||||
'<input type="text" id="options2" >'
|
'<input type="text" id="options2" class="form-control">'
|
||||||
'<span style="padding-left: 10px;">'
|
'<span style="padding-left: 10px;">'
|
||||||
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
'or press down. <a href="http://cbonte.github.io/haproxy-dconv/1.7/configuration.html" target="_blanck" style="color: #23527c" title="HAproxy docs">Read more about options</a>'
|
||||||
'</span>'
|
'</span>'
|
||||||
'</div>'
|
'</div>'
|
||||||
'<textarea name="option" title="Options thru" cols=80 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
'<textarea name="option" title="Options thru" cols=80 id="optionsInput2" placeholder="acl test hdr_beg(host) -i some_host"></textarea>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
'<td class="addName">Servers:</td>'
|
'<td class="addName">Servers:</td>'
|
||||||
'<td class="addOption">'
|
'<td class="addOption">'
|
||||||
'<textarea name="servers" title="Backend servers" required cols=80 placeholder="server server.local 172.28.0.1:8080 check"></textarea>'
|
'<textarea name="servers" title="Backend servers" required cols=80 placeholder="hostname ip:port"></textarea>'
|
||||||
|
'<div>'
|
||||||
|
'<label for="controlgroup-backend-show" style="margin-top: 5px;">Cusmot check params</label>'
|
||||||
|
'<input type="checkbox" id="controlgroup-backend-show" name="default-check">'
|
||||||
|
'<span class="tooltip tooltipTop"> Default params: inter 2000 rise 2 fall 5</span>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="controlgroup" id="controlgroup-backend" style="display: none;">'
|
||||||
|
'<label for="check-servers-backend">Check</label>'
|
||||||
|
'<input type="checkbox" id="check-servers-backend" name="check-servers" checked value="1">'
|
||||||
|
'<select name="inter" id="inter-backend">'
|
||||||
|
'<option value="inter" disabled selected>inter</option>'
|
||||||
|
'<option value="1000">1000</option>'
|
||||||
|
'<option value="2000">2000</option>'
|
||||||
|
'<option value="3000">3000</option>'
|
||||||
|
'</select>'
|
||||||
|
'<select name="rise" id="rise-backend">'
|
||||||
|
'<option value="rise" disabled selected>rise</option>'
|
||||||
|
'<option value="1">1</option>'
|
||||||
|
'<option value="2">2</option>'
|
||||||
|
'<option value="3">3</option>'
|
||||||
|
'</select>'
|
||||||
|
'<select name="fall" id="fall-backend">'
|
||||||
|
'<option value="fall" disabled selected>fall</option>'
|
||||||
|
'<option value="4">4</option>'
|
||||||
|
'<option value="5">5</option>'
|
||||||
|
'<option value="6">6</option>'
|
||||||
|
'</select>'
|
||||||
|
'</div>'
|
||||||
'</td>'
|
'</td>'
|
||||||
'</tr>'
|
'</tr>'
|
||||||
'<tr>'
|
'<tr>'
|
||||||
|
|
|
@ -209,6 +209,7 @@ def show_config(cfg):
|
||||||
print('</div><span class="param">' + line + '</span><div>')
|
print('</div><span class="param">' + line + '</span><div>')
|
||||||
continue
|
continue
|
||||||
if "acl" in line or "option" in line or "server" in line:
|
if "acl" in line or "option" in line or "server" in line:
|
||||||
|
if "timeout" not in line and "default-server" not in line and "#use_backend" not in line:
|
||||||
print('<span class="paramInSec"><span class="numRow">')
|
print('<span class="paramInSec"><span class="numRow">')
|
||||||
print(i)
|
print(i)
|
||||||
print('</span>' + line + '</span><br />')
|
print('</span>' + line + '</span><br />')
|
||||||
|
@ -323,11 +324,11 @@ def ssh_command(serv, commands, **kwargs):
|
||||||
|
|
||||||
if kwargs.get("ip") == "1":
|
if kwargs.get("ip") == "1":
|
||||||
show_ip(stdout)
|
show_ip(stdout)
|
||||||
if kwargs.get("compare") == "1":
|
elif kwargs.get("compare") == "1":
|
||||||
compare(stdout)
|
compare(stdout)
|
||||||
if kwargs.get("show_log") == "1":
|
elif kwargs.get("show_log") == "1":
|
||||||
show_log(stdout)
|
show_log(stdout)
|
||||||
if kwargs.get("server_status") == "1":
|
elif kwargs.get("server_status") == "1":
|
||||||
server_status(stdout)
|
server_status(stdout)
|
||||||
else:
|
else:
|
||||||
print('<div style="margin: -10px;">'+stdout.read().decode(encoding='UTF-8')+'</div>')
|
print('<div style="margin: -10px;">'+stdout.read().decode(encoding='UTF-8')+'</div>')
|
||||||
|
|
|
@ -25,6 +25,7 @@ config.read(path_config)
|
||||||
time_zone = config.get('main', 'time_zone')
|
time_zone = config.get('main', 'time_zone')
|
||||||
hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir')
|
hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir')
|
||||||
haproxy_config_path = config.get('haproxy', 'haproxy_config_path')
|
haproxy_config_path = config.get('haproxy', 'haproxy_config_path')
|
||||||
|
stats_port= config.get('haproxy', 'stats_port')
|
||||||
fullpath = config.get('main', 'fullpath')
|
fullpath = config.get('main', 'fullpath')
|
||||||
|
|
||||||
if serv is not None:
|
if serv is not None:
|
||||||
|
@ -32,7 +33,7 @@ if serv is not None:
|
||||||
now_utc = datetime.now(timezone(time_zone))
|
now_utc = datetime.now(timezone(time_zone))
|
||||||
cfg = hap_configs_dir + serv + "-" + now_utc.strftime(fmt) + ".cfg"
|
cfg = hap_configs_dir + serv + "-" + now_utc.strftime(fmt) + ".cfg"
|
||||||
|
|
||||||
funct.chooseServer("map.py#map", "Show HAproxy map", "n")
|
funct.chooseServer("map.py", "Show HAproxy map", "n")
|
||||||
|
|
||||||
def is_neighbors(G, neighbor):
|
def is_neighbors(G, neighbor):
|
||||||
for line in nx.generate_edgelist(G, data=False):
|
for line in nx.generate_edgelist(G, data=False):
|
||||||
|
@ -64,16 +65,18 @@ if form.getvalue('serv') is not None and form.getvalue('open') is not None :
|
||||||
node = line
|
node = line
|
||||||
i = i - 500
|
i = i - 500
|
||||||
G.add_node(node,pos=(k,i),label_pos=(k,i+150))
|
G.add_node(node,pos=(k,i),label_pos=(k,i+150))
|
||||||
if "bind" in line and "stats" not in node:
|
|
||||||
|
if "bind" in line:
|
||||||
bind = line.split(":")
|
bind = line.split(":")
|
||||||
|
if stats_port not in bind[1]:
|
||||||
bind[1] = bind[1].strip(' ')
|
bind[1] = bind[1].strip(' ')
|
||||||
bind = bind[1].split("crt")
|
bind = bind[1].split("crt")
|
||||||
node = node.strip(' \t\n\r')
|
node = node.strip(' \t\n\r')
|
||||||
node = node + ":" + bind[0]
|
node = node + ":" + bind[0]
|
||||||
G.add_node(node,pos=(k,i),label_pos=(k,i+150))
|
G.add_node(node,pos=(k,i),label_pos=(k,i+150))
|
||||||
|
|
||||||
if "server " in line or "use_backend" in line or "default_backend" in line:
|
if "server " in line or "use_backend" in line or "default_backend" in line and "stats" not in line:
|
||||||
if "timeout" not in line and "default-server" not in line and "#use_backend" not in line:
|
if "timeout" not in line and "default-server" not in line and "#use_backend" not in line and "stats" not in line:
|
||||||
i = i - 300
|
i = i - 300
|
||||||
j = j + 1
|
j = j + 1
|
||||||
if "check" in line:
|
if "check" in line:
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<a href="cgi-bin/configver.py" title="Upload old config">Upload old config</a> <br />
|
<a href="cgi-bin/configver.py" title="Upload old config">Upload old config</a> <br />
|
||||||
<a href="cgi-bin/delver.py" title="Upload old config">Delete old config</a> <br />
|
<a href="cgi-bin/delver.py" title="Upload old config">Delete old config</a> <br />
|
||||||
<div class="copyright">
|
<div class="copyright">
|
||||||
HAproxy Web Interface v1.7
|
HAproxy Web Interface v1.8
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
127
script.js
127
script.js
|
@ -7,14 +7,139 @@ $( function() {
|
||||||
//$( document ).tooltip();
|
//$( document ).tooltip();
|
||||||
$( "input[type=submit], button" ).button();
|
$( "input[type=submit], button" ).button();
|
||||||
$( "input[type=checkbox]" ).checkboxradio();
|
$( "input[type=checkbox]" ).checkboxradio();
|
||||||
|
$( ".controlgroup" ).controlgroup();
|
||||||
$( ".configShow" ).accordion({
|
$( ".configShow" ).accordion({
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
heightStyle: "content",
|
heightStyle: "content",
|
||||||
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
|
icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" }
|
||||||
});
|
});
|
||||||
|
$( "dropdown_selector" ).change(function() {
|
||||||
|
var $option = $(this).find('option:selected');
|
||||||
|
if ($option == "tcp") {
|
||||||
|
$("#https-listen").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#listen-mode-select" ).on('selectmenuchange',function() {
|
||||||
|
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
||||||
|
$( "#https-listen-span" ).hide("fast");
|
||||||
|
$( "#https-hide-listen" ).hide("fast");
|
||||||
|
$( "#https-listen" ).prop("checked", false);
|
||||||
|
} else {
|
||||||
|
$( "#https-listen-span" ).show("fast");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#frontend-mode-select" ).on('selectmenuchange',function() {
|
||||||
|
if ($( "#frontend-mode-select option:selected" ).val() == "tcp") {
|
||||||
|
$( "#https-frontend-span" ).hide("fast");
|
||||||
|
$( "#https-hide-frontend" ).hide("fast");
|
||||||
|
} else {
|
||||||
|
$( "#https-frontend-span" ).show("fast");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#backend-mode-select" ).on('selectmenuchange',function() {
|
||||||
|
if ($( "#backend-mode-select option:selected" ).val() == "tcp") {
|
||||||
|
$( "#https-backend-span" ).hide("fast");
|
||||||
|
$( "#https-hide-backend" ).hide("fast");
|
||||||
|
} else {
|
||||||
|
$( "#https-backend-span" ).show("fast");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#https-listen" ).click( function(){
|
||||||
|
if ($('#https-listen').is(':checked')) {
|
||||||
|
$( "#https-hide-listen" ).show( "fast" );
|
||||||
|
$( "#path-cert-listen" ).attr('required',true);
|
||||||
|
} else {
|
||||||
|
$( "#https-hide-listen" ).hide( "fast" );
|
||||||
|
$( "#path-cert-listen" ).prop('required',false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#https-frontend" ).click( function(){
|
||||||
|
if ($('#https-frontend').is(':checked')) {
|
||||||
|
$( "#https-hide-frontend" ).show( "fast" );
|
||||||
|
$( "#path-cert-frontend" ).attr('required',true);
|
||||||
|
} else {
|
||||||
|
$( "#https-hide-frontend" ).hide( "fast" );
|
||||||
|
$( "#path-cert-frontend" ).prop('required',false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#https-backend" ).click( function(){
|
||||||
|
if ($('#https-backend').is(':checked')) {
|
||||||
|
$( "#https-hide-backend" ).show( "fast" );
|
||||||
|
$( "#path-cert-backend" ).attr('required',true);
|
||||||
|
} else {
|
||||||
|
$( "#https-hide-backend" ).hide( "fast" );
|
||||||
|
$( "#path-cert-backend" ).prop('required',false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#options-listen-show" ).click( function(){
|
||||||
|
if ($('#options-listen-show').is(':checked')) {
|
||||||
|
$( "#options-listen-show-div" ).show( "fast" );
|
||||||
|
} else {
|
||||||
|
$( "#options-listen-show-div" ).hide( "fast" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#options-frontend-show" ).click( function(){
|
||||||
|
if ($('#options-frontend-show').is(':checked')) {
|
||||||
|
$( "#options-frontend-show-div" ).show( "fast" );
|
||||||
|
} else {
|
||||||
|
$( "#options-frontend-show-div" ).hide( "fast" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#options-backend-show" ).click( function(){
|
||||||
|
if ($('#options-backend-show').is(':checked')) {
|
||||||
|
$( "#options-backend-show-div" ).show( "fast" );
|
||||||
|
} else {
|
||||||
|
$( "#options-backend-show-div" ).hide( "fast" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#controlgroup-listen-show" ).click( function(){
|
||||||
|
if ($('#controlgroup-listen-show').is(':checked')) {
|
||||||
|
$( "#controlgroup-listen" ).show( "fast" );
|
||||||
|
if ($('#check-servers-listen').is(':checked')) {
|
||||||
|
$( "#rise-listen" ).attr('required',true);
|
||||||
|
$( "#fall-listen" ).attr('required',true);
|
||||||
|
$( "#inter-listen" ).attr('required',true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$( "#controlgroup-listen" ).hide( "fast" );
|
||||||
|
}
|
||||||
|
$( "#check-servers-listen" ).click( function(){
|
||||||
|
if ($('#check-servers-listen').is(':checked')) {
|
||||||
|
$( "#rise-listen" ).attr('required',true);
|
||||||
|
$( "#fall-listen" ).attr('required',true);
|
||||||
|
$( "#inter-listen" ).attr('required',true);
|
||||||
|
} else {
|
||||||
|
$( "#rise-listen" ).attr('required',false);
|
||||||
|
$( "#fall-listen" ).attr('required',false);
|
||||||
|
$( "#inter-listen" ).attr('required',false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
$( "#controlgroup-backend-show" ).click( function(){
|
||||||
|
if ($('#controlgroup-backend-show').is(':checked')) {
|
||||||
|
$( "#controlgroup-backend" ).show( "fast" );
|
||||||
|
if ($('#check-servers-backend').is(':checked')) {
|
||||||
|
$( "#rise-backend" ).attr('required',true);
|
||||||
|
$( "#fall-backend" ).attr('required',true);
|
||||||
|
$( "#inter-backend" ).attr('required',true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$( "#controlgroup-backend" ).hide( "fast" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#check-servers-backend" ).click( function(){
|
||||||
|
if ($('#check-servers-backend').is(':checked')) {
|
||||||
|
$( "#rise-backend" ).attr('required',true);
|
||||||
|
$( "#fall-backend" ).attr('required',true);
|
||||||
|
$( "#inter-backend" ).attr('required',true);
|
||||||
|
} else {
|
||||||
|
$( "#rise-backend" ).attr('required',false);
|
||||||
|
$( "#fall-backend" ).attr('required',false);
|
||||||
|
$( "#inter-backend" ).attr('required',false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$( function() {
|
|
||||||
var availableTags = [
|
var availableTags = [
|
||||||
"acl", "http-request", "http-response", "set-uri", "set-url", "set-header", "add-header", "del-header", "replace-header", "path_beg", "url_beg()", "urlp_sub()", "tcpka", "tcplog", "forwardfor", "option"
|
"acl", "http-request", "http-response", "set-uri", "set-url", "set-header", "add-header", "del-header", "replace-header", "path_beg", "url_beg()", "urlp_sub()", "tcpka", "tcplog", "forwardfor", "option"
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue