Commit a8b03832 authored by Mika Havela's avatar Mika Havela
Browse files

Renamed ipsec-tools to ipsectools to come around a but with the menu-system

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@850 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 21e2053e
......@@ -3,10 +3,10 @@ PACKAGE=acf-$(APP_NAME)
VERSION=0.1
APP_DIST=\
ipsec-tools-controller.lua \
ipsec-tools-model.lua \
ipsec-tools-status-html.lsp \
ipsec-tools.menu \
ipsectools-controller.lua \
ipsectools-model.lua \
ipsectools-status-html.lsp \
ipsectools.menu \
EXTRA_DIST=README Makefile config.mk
......
......@@ -27,7 +27,7 @@ local function get_version()
end
local function autostarts()
local cmd_output_result, cmd_output_error
local cmd_output_result
local cmd = "/sbin/rc_status | egrep '^S' | egrep '" .. processname .."' 2>/dev/null"
local f = io.popen( cmd )
local cmdresult = f:read("*a")
......@@ -37,23 +37,26 @@ local function autostarts()
cmd_output_error = "Not programmed to autostart"
end
f:close()
return cmd_output_result,cmd_output_error
return cmd_output_result
end
local function racoonctl(proto)
local function racoonctl()
local cmd_output_result, cmd_output_error
local cmd = "/usr/sbin/racoonctl show-sa ".. proto .. " 2>/dev/null"
local cmd = "/usr/sbin/racoonctl -lll show-sa isakmp 2>/dev/null"
local f = io.popen( cmd )
local cmdresult = f:read("*a")
if (cmdresult) and (#cmdresult > 0) then
cmd_output_result = cmdresult
else
cmd_output_error = "Not programmed to autostart"
end
local cmd_output_result = f:read("*a")
f:close()
return cmd_output_result,cmd_output_error
end
local function ip_xfrm(mode)
local cmd_output_result
local cmd = "/bin/ip xfrm " .. mode .. " 2>/dev/null"
local f = io.popen( cmd )
local cmd_output_result = f:read("*a")
f:close()
return cmd_output_result
end
function process_status_text(procname)
......@@ -86,25 +89,19 @@ function getstatus()
errtxt=autostart_errtxt,
})
local racoon_sequense, racoon_errtxt = racoonctl("isakmp")
status.show_isakmp = cfe({ name="show_isakmp",
label="racoon show-sa isakmp",
value=racoon_sequense,
errtxt=racoon_errtxt,
label="racoonctl -lll show-sa isakmp",
value=racoonctl(),
})
local racoon_sequense, racoon_errtxt = racoonctl("esp")
status.show_esp = cfe({ name="show_esp",
label="racoon show-sa esp",
value=racoon_sequense,
errtxt=racoon_errtxt,
status.ip_xfrm_state = cfe({ name="show_esp",
label="ip xfrm state",
value=ip_xfrm("state"),
})
local racoon_sequense, racoon_errtxt = racoonctl("ah")
status.show_ah = cfe({ name="show_ah",
label="racoon show-sa ah",
value=racoon_sequense,
errtxt=racoon_errtxt,
status.ip_xfrm_policy = cfe({ name="ip_xfrm_policy",
label="ip xfrm policy",
value=ip_xfrm("policy"),
})
return status
......
......@@ -38,39 +38,16 @@ informationform(myform,tags)
<DL>
<?
local myform = form.status.show_isakmp
io.write("\t<DT")
if (#myform.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n")
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
?>
<?
local myform = form.status.show_esp
io.write("\t<DT")
if (#myform.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n")
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
?>
<?
local myform = form.status.show_ah
io.write("\t<DT")
if (#myform.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n")
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
local myform = form.status.ip_xfrm_state
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
local myform = form.status.ip_xfrm_policy
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
?>
</DL>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment