From 21e2053e9a09638f9af7a0861a0faf33351c5129 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Thu, 27 Mar 2008 15:14:06 +0000 Subject: 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 --- ipsec-tools-model.lua | 57 +++++++++++++++++++++++++++++++++++++++++++++ ipsec-tools-status-html.lsp | 43 +++++++++++++++++++++++++++++----- 2 files changed, 94 insertions(+), 6 deletions(-) diff --git a/ipsec-tools-model.lua b/ipsec-tools-model.lua index 3994007..ece5886 100644 --- a/ipsec-tools-model.lua +++ b/ipsec-tools-model.lua @@ -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 diff --git a/ipsec-tools-status-html.lsp b/ipsec-tools-status-html.lsp index f3acbb4..34b1248 100644 --- a/ipsec-tools-status-html.lsp +++ b/ipsec-tools-status-html.lsp @@ -29,20 +29,51 @@ end
-

PROGRAM SPECIFIC OPTIONS/INFORMATION

0) then io.write(" class='error'") end +io.write(">" .. myform.label .. "\n") + +io.write("\t\t
" .. myform.value .. "
\n") +if (myform.descr) and (#myform.descr > 0) then io.write("\t\t

" .. string.gsub(myform.descr, "\n", "
") .. "

\n") end +if (#myform.errtxt > 0) then io.write("\t\t

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end +io.write("\t\t
\n") + +?> + 0) then io.write(" class='error'") end +io.write(">" .. myform.label .. "\n") + +io.write("\t\t
" .. myform.value .. "
\n") +if (myform.descr) and (#myform.descr > 0) then io.write("\t\t

" .. string.gsub(myform.descr, "\n", "
") .. "

\n") end +if (#myform.errtxt > 0) then io.write("\t\t

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end +io.write("\t\t
\n") + ?> - + 0) then io.write(" class='error'") end +io.write(">" .. myform.label .. "\n") + +io.write("\t\t
" .. myform.value .. "
\n") +if (myform.descr) and (#myform.descr > 0) then io.write("\t\t

" .. string.gsub(myform.descr, "\n", "
") .. "

\n") end +if (#myform.errtxt > 0) then io.write("\t\t

" .. string.gsub(myform.errtxt, "\n", "
") .. "

\n") end +io.write("\t\t
\n") + +?> + +