mirror of https://github.com/Aidaho12/haproxy-wi
parent
e59f47eed9
commit
7c285fd892
|
@ -130,7 +130,7 @@ print('<div id="tabs">'
|
|||
'<li><a href="#listen">Listen</a></li>'
|
||||
'<li><a href="#frontend">Frontend</a></li>'
|
||||
'<li><a href="#backend">Backend</a></li>'
|
||||
'<li><a href="#ssl">Upload certs</a></li>'
|
||||
'<li><a href="#ssl">SSL certificates</a></li>'
|
||||
'</ul>'
|
||||
'<div id="listen">'
|
||||
'<form name="add-listner" action="add.py">'
|
||||
|
@ -448,12 +448,12 @@ print('</td>'
|
|||
'<div id="ssl">'
|
||||
'<table>'
|
||||
'<tr class="overviewHead">'
|
||||
'<td class="padding10 first-collumn">Upload ssl pem certs</td>'
|
||||
'<td class="padding10 first-collumn">Upload SSL certificates</td>'
|
||||
'<td>'
|
||||
'Name pem file'
|
||||
'Certificate name'
|
||||
'</td>'
|
||||
'<td>'
|
||||
'<span title="This pem key will be used to create https connection with haproxy">Key(?)</span>'
|
||||
'<span title="This pem file will be used to create https connection with haproxy">Paste certificate content here(?)</span>'
|
||||
'</td>'
|
||||
'</tr>'
|
||||
'<tr style="width: 50%;">'
|
||||
|
@ -464,14 +464,16 @@ print('</td>'
|
|||
for i in listhap:
|
||||
print('<option value="%s">%s</option>' % (i[2], i[1]))
|
||||
|
||||
print('</select></td>'
|
||||
'<td valign="top" style="padding-top: 27px;">'
|
||||
print('</select>'
|
||||
'</td>'
|
||||
'<td valign="top" style="padding-top: 27px;">'
|
||||
'<input type="text" id="ssl_name" class="form-control">'
|
||||
'</td>'
|
||||
'<td style="padding-top: 15px; padding-bottom: 15px;">'
|
||||
'<textarea id="ssl_cert" cols="50" rows="5"></textarea><br /><br />'
|
||||
'<a class="ui-button ui-widget ui-corner-all" id="ssl_key_upload" title="Upload ssl cert">Upload</a>'
|
||||
'</td>'
|
||||
'<a class="ui-button ui-widget ui-corner-all" id="ssl_key_upload" title="Upload ssl certificates">Upload</a>'
|
||||
'</td>'
|
||||
'</tr>'
|
||||
'</table>'
|
||||
'<div id="ajax-ssl"></div>'
|
||||
'</div>')
|
||||
|
|
|
@ -199,7 +199,7 @@ def links():
|
|||
'</li>')
|
||||
print('</ul>'
|
||||
'</nav>'
|
||||
'<div class="copyright-menu">HAproxy-WI v2.0.6</div>'
|
||||
'<div class="copyright-menu">HAproxy-WI v2.0.7</div>'
|
||||
'</div>')
|
||||
|
||||
def show_login_links():
|
||||
|
@ -213,7 +213,7 @@ def show_login_links():
|
|||
|
||||
def footer():
|
||||
print('</center></div>'
|
||||
'<center style="margin-left: 8%;">'
|
||||
'<center>'
|
||||
'<h3>'
|
||||
'<a class="ui-button ui-widget ui-corner-all" href="#top" title="Move up">UP</a>'
|
||||
'</h3><br />'
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
[main]
|
||||
#Path to files destination
|
||||
fullpath = /var/www/haproxy-wi/
|
||||
cgi_path = %(fullpath)s/cgi-bin/
|
||||
log_path = %(fullpath)s/log/
|
||||
fullpath = /var/www/haproxy-wi
|
||||
cgi_path = ${fullpath}/cgi-bin/
|
||||
log_path = ${fullpath}/log/
|
||||
cert_local_dir = ${cgi_path}/certs/
|
||||
time_zone = UTC
|
||||
|
||||
[configs]
|
||||
#Server for save configs from HAproxy servers
|
||||
haproxy_configs_server = localhost
|
||||
#Dir where configs will be save
|
||||
haproxy_save_configs_dir = /var/www/haproxy-wi/cgi-bin/hap_config/
|
||||
haproxy_save_configs_dir = ${main:fullpath}/cgi-bin/hap_config/
|
||||
|
||||
[mysql]
|
||||
#Enable MySQL DB. If default will be used Sqlite DB. Default disable
|
||||
|
@ -40,7 +41,7 @@ syslog_server =
|
|||
#Default bot send message disable
|
||||
enable = 0
|
||||
token =
|
||||
channel_name =
|
||||
channel_name =
|
||||
proxy =
|
||||
|
||||
[haproxy]
|
||||
|
|
|
@ -35,28 +35,35 @@ if form.getvalue('ssh_cert'):
|
|||
print('<div class="alert alert-danger">Can\'t save ssh keys file. Check ssh keys path in config</div>')
|
||||
else:
|
||||
print('<div class="alert alert-success">Ssh key was save into: %s </div>' % ssh_keys)
|
||||
|
||||
funct.logging("local", "users.py#ssh upload new ssl cert %s" % ssh_keys)
|
||||
|
||||
if serv and form.getvalue('ssl_cert'):
|
||||
cert_local_dir = config.get('main', 'cert_local_dir')
|
||||
cert_path = config.get('haproxy', 'cert_path')
|
||||
|
||||
if form.getvalue('ssl_name') is None:
|
||||
print('<div class="alert alert-danger">Please enter name pem file</div>')
|
||||
print('<div class="alert alert-danger">Please enter desired name</div>')
|
||||
else:
|
||||
name = form.getvalue('ssl_name') + '.pem'
|
||||
cert_path = config.get('haproxy', 'cert_path')
|
||||
|
||||
try:
|
||||
with open(name, "w") as ssl_cert:
|
||||
ssl_cert.write(form.getvalue('ssl_cert'))
|
||||
except IOError:
|
||||
print('<div class="alert alert-danger">Can\'t save ssh keys file. Check ssh keys path in config</div>')
|
||||
print('<div class="alert alert-danger">Can\'t save ssl keys file. Check ssh keys path in config</div>')
|
||||
else:
|
||||
print("Save ok")
|
||||
print('<div class="alert alert-success">SSL file was upload to %s into: %s </div>' % (serv, cert_path))
|
||||
|
||||
MASTERS = sql.is_master(serv)
|
||||
for master in MASTERS:
|
||||
if master[0] != None:
|
||||
funct.upload(master[0], cert_path, name)
|
||||
funct.upload(serv, cert_path, name)
|
||||
os.system("rm -f %s" % name)
|
||||
|
||||
|
||||
os.system("mv %s %s" % (name, cert_local_dir))
|
||||
funct.logging(serv, "add.py#ssl upload new ssl cert %s" % name)
|
||||
|
||||
if backend is not None:
|
||||
|
||||
cmd='echo "show backend" |nc %s 1999' % serv
|
||||
|
|
|
@ -25,7 +25,7 @@ print('<script src="/inc/users.js"></script>'
|
|||
'<li><a href="#groups">Groups</a></li>'
|
||||
'<li><a href="#servers">Servers</a></li>'
|
||||
'<li><a href="#roles">Roles</a></li>'
|
||||
'<li><a href="#cert">Ssh certs</a></li>'
|
||||
'<li><a href="#cert">Ssh key</a></li>'
|
||||
'</ul>'
|
||||
'<div id="users">'
|
||||
'<table class="overview" id="ajax-users">'
|
||||
|
@ -200,7 +200,7 @@ print('</table>'
|
|||
'<div id="cert">'
|
||||
'<table id="ssh">'
|
||||
'<tr class="overviewHead" style="width: 50%;">'
|
||||
'<td class="padding10 first-collumn">Upload ssh pem certs</td>'
|
||||
'<td class="padding10 first-collumn">Upload SSH Key</td>'
|
||||
'<td>'
|
||||
'<span title="Private key. Note: The public key must be pre-installed on all servers to which you plan to connect">Key(?)</span>'
|
||||
'</td>'
|
||||
|
@ -208,7 +208,7 @@ print('</table>'
|
|||
'</tr>'
|
||||
'<tr style="width: 50%;">'
|
||||
'<td class="first-collumn" valign="top" style="padding-top: 15px;">'
|
||||
'<b>Note:</b> Somthing about ssh keys'
|
||||
'<b>Note:</b> Paste pem file content here'
|
||||
'</td>'
|
||||
'<td style="padding-top: 15px;">'
|
||||
'<textarea id="ssh_cert" cols="50" rows="5"></textarea><br /><br />'
|
||||
|
|
|
@ -667,16 +667,17 @@ $( function() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('alert') != '-1') {
|
||||
$("#ajax-ssl").append(data);
|
||||
} else if (data == "Save ok ") {
|
||||
if (data.indexOf('danger') != '-1') {
|
||||
$("#ajax-ssl").html(data);
|
||||
} else if (data.indexOf('success') != '-1') {
|
||||
$('.alert-danger').remove();
|
||||
$("#ssl").addClass( "update", 1000 );
|
||||
setTimeout(function() {
|
||||
$( "#ssl").removeClass( "update" );
|
||||
}, 2500 );
|
||||
$("#ajax-ssl").html(data);
|
||||
} else {
|
||||
$("#ajax-ssl").append('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
||||
$("#ajax-ssl").html('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -534,16 +534,18 @@ a:focus {
|
|||
color: #a94442;
|
||||
background-color: #f2dede;
|
||||
border-color: #ebccd1;
|
||||
width: 330px;
|
||||
width: 400px;
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
margin-bottom: -50px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
.alert-success {
|
||||
color: #3c763d;
|
||||
background-color: #dff0d8;
|
||||
border-color: #d6e9c6;
|
||||
color: #3c763d;
|
||||
background-color: #dff0d8;
|
||||
border-color: #d6e9c6;
|
||||
width: 400px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
|
|
22
inc/users.js
22
inc/users.js
|
@ -312,16 +312,18 @@ function uploadSsh() {
|
|||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('alert-danger') != '-1') {
|
||||
$("#ajax-ssh").append(data);
|
||||
} else {
|
||||
$('.alert-danger').remove();
|
||||
$("#ssh").addClass( "update", 1000 );
|
||||
setTimeout(function() {
|
||||
$( "#ssh").removeClass( "update" );
|
||||
}, 2500 );
|
||||
$("#ajax-ssh").append(data);
|
||||
}
|
||||
if (data.indexOf('danger') != '-1') {
|
||||
$("#ajax-ssh").html(data);
|
||||
} else if (data.indexOf('success') != '-1') {
|
||||
$('.alert-danger').remove();
|
||||
$("#ssh").addClass( "update", 1000 );
|
||||
setTimeout(function() {
|
||||
$( "#ssh").removeClass( "update" );
|
||||
}, 2500 );
|
||||
$("#ajax-ssh").html(data);
|
||||
} else {
|
||||
$("#ajax-ssh").html('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
Loading…
Reference in New Issue