Commit 21e2053e authored by Mika Havela's avatar Mika Havela
Browse files

Added information on autostart sequence.

Shows information on 'racoonctl show-sa [isakmp|esp|ah].

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@849 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 3142bc1b
......@@ -26,6 +26,35 @@ local function get_version()
return cmd_output_result,cmd_output_error
end
local function autostarts()
local cmd_output_result, cmd_output_error
local cmd = "/sbin/rc_status | egrep '^S' | egrep '" .. processname .."' 2>/dev/null"
local f = io.popen( cmd )
local cmdresult = f:read("*a")
if (cmdresult) and (#cmdresult > 0) then
cmd_output_result = "Process will autostart at next boot (at sequence '" .. string.match(cmdresult,"^%a+(%d%d)") .. "')"
else
cmd_output_error = "Not programmed to autostart"
end
f:close()
return cmd_output_result,cmd_output_error
end
local function racoonctl(proto)
local cmd_output_result, cmd_output_error
local cmd = "/usr/sbin/racoonctl show-sa ".. proto .. " 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
f:close()
return cmd_output_result,cmd_output_error
end
function process_status_text(procname)
local t = procps.pidof(procname)
......@@ -50,6 +79,34 @@ function getstatus()
label="Program status",
value=process_status_text(processname),
})
local autostart_sequense, autostart_errtxt = autostarts()
status.autostart = cfe({ name="autostart",
label="Autostart sequence",
value=autostart_sequense,
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,
})
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,
})
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,
})
return status
end
......
......@@ -29,20 +29,51 @@ end
<DL>
<?
local myform = form.status
local tags = { "status", "version", }
local tags = { "status", "version", "autostart", }
informationform(myform,tags)
?>
</DL>
<? ---[[ ?>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
<DL>
<?
--local myform = form.status
--local tags = { "stats", }
--informationform(myform,tags)
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<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")
?>
</DL>
<?
......
Supports Markdown
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