summaryrefslogtreecommitdiffstats
path: root/ipsectools-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'ipsectools-model.lua')
-rw-r--r--ipsectools-model.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipsectools-model.lua b/ipsectools-model.lua
index 5497bd0..433a261 100644
--- a/ipsectools-model.lua
+++ b/ipsectools-model.lua
@@ -244,3 +244,17 @@ function upload_cert(newcert)
return 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 then
+ local cmd = path .. "openssl x509 -in "..baseurl..certname.." -noout -text"
+ local f = io.popen(cmd)
+ cmdresult = f:read("*a")
+ f:close()
+ end
+ end
+ return cfe({ type="table", value={name=certname, value=cmdresult}, label="Certificate" })
+end