summaryrefslogtreecommitdiffstats
path: root/ipsectools-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2015-10-30 15:14:11 +0000
committerTed Trask <ttrask01@yahoo.com>2015-10-30 15:14:11 +0000
commit8e14e610cb2cc21eb05808074036a7bf8edaa3c1 (patch)
tree09be3efa967e9f6cc7f2f49c9402bd2e97821007 /ipsectools-model.lua
parent30a0990f37d1e968215687b8b8c96d145237af42 (diff)
downloadacf-ipsec-tools-8e14e610cb2cc21eb05808074036a7bf8edaa3c1.tar.bz2
acf-ipsec-tools-8e14e610cb2cc21eb05808074036a7bf8edaa3c1.tar.xz
Modify logfile to get logging info from the config and use common view
Diffstat (limited to 'ipsectools-model.lua')
-rw-r--r--ipsectools-model.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/ipsectools-model.lua b/ipsectools-model.lua
index 5af6556..e3e7c99 100644
--- a/ipsectools-model.lua
+++ b/ipsectools-model.lua
@@ -8,6 +8,7 @@ format = require("acf.format")
validator = require("acf.validator")
-- Set variables
+local confdfile = "/etc/conf.d/racoon"
local configfile = "/etc/racoon/racoon.conf"
local configfile2 = "/etc/ipsec.conf"
local processname = "racoon"
@@ -271,4 +272,25 @@ mymodule.view_cert = function(self, viewcert)
return viewcert
end
+function mymodule.get_logfile(self, clientdata)
+ -- Can override syslog with logfile specified in command-line options "-l logfile"
+ -- Otherwise, uses syslog with facility LOG_DAEMON
+ local retval = cfe({ type="group", value={}, label="Log File Configuration" })
+ retval.value.facility = cfe({value="daemon", label="Syslog Facility"})
+ retval.value.grep = cfe({ value="racoon", label="Grep" })
+ local opts = format.parse_ini_file(fs.read_file(confdfile), "", "RACOON_OPTS")
+ if opts then
+ -- remove quotes
+ local opts2 = string.match(opts, "\"(.*)\"")
+ local opts = " "..(opts2 or "")
+ local logfile = string.match(opts, "%s%-l%s+(%S+)")
+ if logfile then
+ retval.value.filename = cfe({value=logfile, label="File name"})
+ retval.value.facility = nil
+ retval.value.grep = nil
+ end
+ end
+ return retval
+end
+
return mymodule