From 47fe7ba683f9282048328b37811f870f824d1cb4 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 25 Nov 2009 10:42:29 +0000 Subject: Allow to view any certs in /etc/openvpn, cleaned up view some. --- openvpn-model.lua | 18 +++++++++--------- openvpn-viewconfig-html.lsp | 8 +------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/openvpn-model.lua b/openvpn-model.lua index 70de3c8..177cf6b 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -298,16 +298,16 @@ function upload_cert(newcert) end view_cert = function(certname) - local list = list_certs() local cmdresult = "Invalid cert name" - for i,cert in ipairs(list.value) do - if cert == certname or certname == (baseurl .. cert) then - local cmd = path .. "openssl x509 -in "..baseurl..format.escapespecialcharacters(cert).." -noout -text" - local f = io.popen(cmd) - cmdresult = f:read("*a") - f:close() - cmdresult = cmdresult .. "Content:\n" .. (fs.read_file(baseurl..cert) or "") - end + if not string.find(certname, "/") then + certname = baseurl..certname + end + if validator.is_valid_filename(certname, baseurl) then + local cmd = path .. "openssl x509 -in "..format.escapespecialcharacters(certname).." -noout -text" + local f = io.popen(cmd) + cmdresult = f:read("*a") + f:close() + cmdresult = cmdresult .. "Content:\n" .. (fs.read_file(certname) or "") end return cfe({ type="table", value={name=certname, value=cmdresult}, label="Certificate" }) end diff --git a/openvpn-viewconfig-html.lsp b/openvpn-viewconfig-html.lsp index b644195..3152f1d 100644 --- a/openvpn-viewconfig-html.lsp +++ b/openvpn-viewconfig-html.lsp @@ -36,16 +36,10 @@
<%= html.html_escape(view.value["max-clients"]) %>
Connected clients
-
<% if ( view.value.client_count > 0 ) then %><%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/statusinfo?name=" .. view.value.name , label=view.value.client_count } %><% else %><%= html.html_escape(view.value.client_count) %><% end %>
+
<%= html.html_escape(view.value.client_count) %>
<% end %> -

Startup options

-
-
Process status
-
<%= html.html_escape(view.value.status_isrunning) %>
-
- <% if view.value.dh or view.value.ca or view.value.cert or view.value.key or view.value.tls or view.value.crl then %>

Certificate files

-- cgit v1.2.3