diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-11-25 10:42:29 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-11-25 10:42:29 +0000 |
commit | 47fe7ba683f9282048328b37811f870f824d1cb4 (patch) | |
tree | 2f79a743648a3c6fe9bf0320c86e7917e753a121 | |
parent | 86b4e4e9892f15e14aaccf95db38546622001738 (diff) | |
download | acf-openvpn-47fe7ba683f9282048328b37811f870f824d1cb4.tar.bz2 acf-openvpn-47fe7ba683f9282048328b37811f870f824d1cb4.tar.xz |
Allow to view any certs in /etc/openvpn, cleaned up view some.
-rw-r--r-- | openvpn-model.lua | 18 | ||||
-rw-r--r-- | 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 @@ <dd><%= html.html_escape(view.value["max-clients"]) %></dd> <dt>Connected clients</dt> -<dd><% 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 %></dd> +<dd><%= html.html_escape(view.value.client_count) %></dd> </dl> <% end %> -<h2>Startup options</h2> -<dl> -<dt>Process status</dt> -<dd><%= html.html_escape(view.value.status_isrunning) %></dd> -</dl> - <% 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 %> <h2>Certificate files</h2> <dl> |