diff options
Diffstat (limited to 'openssl-model.lua')
-rw-r--r-- | openssl-model.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/openssl-model.lua b/openssl-model.lua new file mode 100644 index 0000000..bbb5f60 --- /dev/null +++ b/openssl-model.lua @@ -0,0 +1,36 @@ +module(..., package.seeall) + +local configfile = "/etc/ssl/openssl.cnf" + +-- list of request entries that can be edited +local distinguished_names = { "countryName", "stateOrProvinceName", "localityName", "organizationName", "organizationalUnitName", "commonName", "emailAddress" } + +local validate_distinguished_names = function(clientdata) + local config = getopts.getoptsfromfile(configfile) + local distinguished_name = config.req.distinguished_name or "" + + for i, name in ipairs(distinguished_names) do + if config[distinguished_name][name.."_min"] then + end + end +end + +getdefaults = function() + local defaults = cfe({ type="group", value={} }) + local config = getopts.getoptsfromfile(configfile) + local distinguished_name = config.req.distinguished_name or "" + + for i, name in ipairs(distinguished_names) do + defaults.value[name] = cfe({ label=name, + value=config[distinguished_name][name .. "_default"] or "", + descr=config[distinguished_name][name] }) + end + + return defaults +end + +setdefaults = function(clientdata) + -- validate values + validate_distinguished_names(clientdata) + +end |