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