diff options
Diffstat (limited to 'openvpn-model.lua')
-rw-r--r-- | openvpn-model.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/openvpn-model.lua b/openvpn-model.lua index b0607ab..f9e8fa2 100644 --- a/openvpn-model.lua +++ b/openvpn-model.lua @@ -54,14 +54,27 @@ local function config_content( f ) if not string.find ( l, "^[;#].*" ) then local a,b = string.match ( l, "([^%s]*)%s(%S*)(.*)$" ) config[a]=b +-- config[string.gsub(a, "-", "")]=b end end + config.name = f + -- FIXME Variablenames with '-' causes trouble! + config.log = "xXx" + config.maxclients = "xXx" + config.tls = "xXx" + config.crlverify = "xXx" + if not ( config["local"] ) then config["local"] = "0.0.0.0" end +-- if not ( config["log"] ) and ( config[log-append] ) then +-- a = "log" +-- b = "plupp" +-- config.log=config["log-append"] +-- end return config end local is_running = function( process, parameters ) - strsplit = require("split") + local strsplit = require("split") local retval = "" local pidofsx,error = io.popen("pidof " .. process ,r) local pidofs = strsplit(" ", pidofsx:read("*a")) @@ -160,9 +173,14 @@ function openvpn_version() return openvpnversion end -function get_serverconfig ( f ) +function get_serverconfig ( self, f ) local serverconfig = {} - serverconfig = cfe{ name = f } + config = config_content ( f ) + local clientlist, connclients = clientlist () + local isrunning = is_running ("openvpn", config.name) + -- FIXME: Get status for autostart_status = 'rc_status | grep this process' + local autostart_status = "" + serverconfig = cfe{ name = f, device = config.dev, log = config.log, verb = config.verb, maxclients = config["maxclients"], clients = connclients, status = isrunning, autostart = autostart_status, dh = config.dh, ca = config.ca, cert = config.cert, key = config.key, tls = config.tls , crl = config.crlverify, port = config.port, proto = config.proto, loca = config["local"] } return serverconfig end |