summaryrefslogtreecommitdiffstats
path: root/openssl-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-05-27 17:20:55 +0000
committerTed Trask <ttrask01@yahoo.com>2008-05-27 17:20:55 +0000
commit2c7efb258612b0039becb4d535b0e118c400d79d (patch)
treeaa3c3d512cf7070377f7c70f4fe98d21daf4953f /openssl-controller.lua
parent7b91c2748fc30eb718bafef995f514d5f805d716 (diff)
downloadacf-openssl-2c7efb258612b0039becb4d535b0e118c400d79d.tar.bz2
acf-openssl-2c7efb258612b0039becb4d535b0e118c400d79d.tar.xz
Modified acf to allow file upload (arbitrary 32k limit).
Cleaned up openssl and added ability to upload/generate CA certificate. git-svn-id: svn://svn.alpinelinux.org/acf/openssl/trunk@1184 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openssl-controller.lua')
-rw-r--r--openssl-controller.lua43
1 files changed, 35 insertions, 8 deletions
diff --git a/openssl-controller.lua b/openssl-controller.lua
index af92ec5..ff9fb91 100644
--- a/openssl-controller.lua
+++ b/openssl-controller.lua
@@ -5,19 +5,21 @@ require("getopts")
default_action = "status"
+local sslstatus
+
mvc={}
mvc.pre_exec = function(self)
- if self.conf.action ~= "status" and self.conf.action ~= "editconfigfile" then
- local verify = self.model.verifyopenssl()
- if verify.value == false then
- redirect(self)
- end
+ sslstatus = self.model.getstatus()
+ if (sslstatus.value.version.errtxt and self.conf.action ~= "status")
+ or (sslstatus.value.conffile.errtxt and self.conf.action ~= "status" and self.conf.action ~= "editconfigfile")
+ or ((sslstatus.value.cacert.errtxt or sslstatus.value.cakey.errtxt) and self.conf.action ~= "status" and self.conf.action ~= "editconfigfile" and self.conf.action ~= "putcacert" and self.conf.action ~= "generatecacert") then
+ redirect(self)
end
end
-- Show openssl status
status = function(self)
- return self.model.getstatus()
+ return sslstatus
end
-- View all pending and approved requests and revoked certificates
@@ -143,15 +145,40 @@ getrevoked = function(self)
end
-- Put the CA cert
--- FIXME this won't work because haserl doesn't support file upload. Untested
putcacert = function(self)
local retval = self.model.putca(self.clientdata.ca, self.clientdata.password, self.clientdata.Upload)
+ if self.clientdata.Upload then
+ if not retval.errtxt then
+ redirect(self)
+ end
+ end
retval.type = "form"
- retval.option = "Upload"
retval.label = "Upload CA Certificate"
+ retval.option = "Upload"
+
return retval
end
+-- Generate a self-signed CA
+generatecacert = function(self)
+ local request
+ if self.clientdata.Generate then
+ -- Try to submit the request
+ request = self.model.generateca(self.clientdata)
+ if not request.errtxt then
+ redirect(self)
+ end
+ else
+ request = self.model.getnewcarequest()
+ end
+
+ request.type = "form"
+ request.label = "Generate CA Certificate"
+ request.option = "Generate"
+
+ return request
+end
+
editconfigfile = function(self)
local saved = false
if self.clientdata.Save then