summaryrefslogtreecommitdiffstats
path: root/lbu-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-model.lua')
-rw-r--r--lbu-model.lua33
1 files changed, 32 insertions, 1 deletions
diff --git a/lbu-model.lua b/lbu-model.lua
index 8a362ce..3170736 100644
--- a/lbu-model.lua
+++ b/lbu-model.lua
@@ -1,6 +1,8 @@
module (..., package.seeall)
-require "fs"
+require("fs")
+require("getopts")
+
local configfile = "/etc/lbu/lbu.conf"
-- ################################################################################
@@ -29,6 +31,22 @@ local function getLbuStatus()
return ret
end
+local function getciphers()
+ local opensslciphers = {}
+ local watchdog = nil
+ local f = io.popen("/usr/bin/openssl -v 2>&1", "r")
+ if not (f) then return ciphers end
+ for line in f:lines() do
+ if (watchdog) then
+ for cipher in string.gmatch(line, "(%S+)") do
+ table.insert(opensslciphers,tostring(cipher))
+ end
+ end
+ if (string.match(line, "^Cipher commands")) then watchdog="yes" end
+ end
+ f:close()
+ return opensslciphers
+end
-- ################################################################################
-- PUBLIC FUNCTIONS
@@ -57,6 +75,19 @@ function list(self)
return ret
end
+function getconfig ()
+ local path = configfile
+ local config = {}
+ local lbumedias = {}
+ table.insert(lbumedias, {name="No default", value=""})
+ table.insert(lbumedias, {name="floppy", value="floppy"})
+ table.insert(lbumedias, {name="usb", value="usb"})
+ config = getopts.getoptsfromfile(path)
+ config["LBU_MEDIA_LIST"]= lbumedias
+ config["DEFAULT_CIPHER_LIST"]= getciphers()
+-- config["debug"] = getciphers()
+ return config
+end
-- ################################################################################
-- OLD FUNCTIONS