v6.3.12.0

Changelog: https://roxy-wi.org/changelog#6_3_12
pull/364/head
Aidaho 2023-05-22 20:03:42 +03:00
parent 4bbd195fbe
commit 964a22510f
4 changed files with 78 additions and 8 deletions

View File

@ -270,6 +270,16 @@ def get_ssl_cert(server_ip: str, cert_id: int) -> None:
print(f'error: Cannot connect to the server {e.args[0]}')
def get_ssl_raw_cert(server_ip: str, cert_id: int) -> None:
cert_path = sql.get_setting('cert_path')
commands = [f"cat {cert_path}/{cert_id}"]
try:
server_mod.ssh_command(server_ip, commands, ip="1")
except Exception as e:
print(f'error: Cannot connect to the server {e.args[0]}')
def get_ssl_certs(server_ip: str) -> None:
cert_path = sql.get_setting('cert_path')
commands = [f"sudo ls -1t {cert_path} |grep -E 'pem|crt|key'"]

View File

@ -71,6 +71,10 @@ if form.getvalue('getcert') is not None and serv is not None:
cert_id = common.checkAjaxInput(form.getvalue('getcert'))
add_mod.get_ssl_cert(serv, cert_id)
if form.getvalue('getcert_raw') is not None and serv is not None:
cert_id = common.checkAjaxInput(form.getvalue('getcert_raw'))
add_mod.get_ssl_raw_cert(serv, cert_id)
if form.getvalue('delcert') is not None and serv is not None:
cert_id = common.checkAjaxInput(form.getvalue('delcert'))
add_mod.del_ssl_cert(serv, cert_id)

View File

@ -1482,6 +1482,9 @@ function updateSavedServer(id) {
} );
}
function view_ssl(id) {
var delete_word = $('#translate').attr('data-delete');
var cancel_word = $('#translate').attr('data-cancel');
var raw_word = $('#translate').attr('data-raw');
if(!checkIsServerFiled('#serv5')) return false;
$.ajax( {
url: "options.py",
@ -1502,15 +1505,67 @@ function view_ssl(id) {
width: 670,
modal: true,
title: "Certificate from "+$('#serv5').val()+", name: "+id,
buttons: {
Close: function() {
$( this ).dialog( "close" );
},
Delete: function () {
$( this ).dialog( "close" );
confirmDeleting("SSL cert", id, $( this ), "");
buttons: [{
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}
}, {
text: raw_word,
click: function () {
showRawSSL(id);
}
}, {
text: delete_word,
click: function () {
$(this).dialog("close");
confirmDeleting("SSL cert", id, $(this), "");
}
}]
});
}
}
} );
}
function showRawSSL(id) {
var delete_word = $('#translate').attr('data-delete');
var cancel_word = $('#translate').attr('data-cancel');
$.ajax( {
url: "options.py",
data: {
serv: $('#serv5').val(),
getcert_raw: id,
token: $('#token').val()
},
type: "POST",
success: function( data ) {
if (data.indexOf('error: ') != '-1') {
toastr.error(data);
} else {
$('#dialog-confirm-body').text(data);
$( "#dialog-confirm-cert" ).dialog({
resizable: false,
height: "auto",
width: 670,
modal: true,
title: "Certificate from "+$('#serv5').val()+", name: "+id,
buttons: [{
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}, {
text: "Human readable",
click: function () {
view_ssl(id);
}
}, {
text: delete_word,
click: function () {
$(this).dialog("close");
confirmDeleting("SSL cert", id, $(this), "");
}
}]
});
}
}

File diff suppressed because one or more lines are too long