summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipsectools-model.lua63
-rw-r--r--ipsectools-status-html.lsp36
2 files changed, 94 insertions, 5 deletions
diff --git a/ipsectools-model.lua b/ipsectools-model.lua
index 5545c78..26d9ffc 100644
--- a/ipsectools-model.lua
+++ b/ipsectools-model.lua
@@ -50,6 +50,64 @@ local function racoonctl()
return cmd_output_result,cmd_output_error
end
+local function racoonctl_table()
+ local value = racoonctl()
+ local output = {}
+ for k,v in pairs(format.string_to_table(value,"\n")) do
+ if not (string.find(v,"^Source")) then
+ output[k]={}
+ local variable=format.string_to_table(v,"%s+")
+ output[k]['Source']=cfe({
+ name="Source",
+ label="Source",
+ value=variable[1],
+ })
+ output[k]['Destination']=cfe({
+ name="Destination",
+ label="Destination",
+ value=variable[2],
+ })
+ output[k]['Cookies']=cfe({
+ name="Cookies",
+ label="Cookies",
+ value=variable[3],
+ })
+ output[k]['St']=cfe({
+ name="St",
+ label="Variable St",
+ value=variable[4],
+ })
+ output[k]['S']=cfe({
+ name="S",
+ label="Variable S",
+ value=variable[5],
+ })
+ output[k]['V']=cfe({
+ name="V",
+ label="Variable V",
+ value=variable[6],
+ })
+ output[k]['E']=cfe({
+ name="E",
+ label="Variable E",
+ value=variable[7],
+ })
+ output[k]['Created']=cfe({
+ name="Created",
+ label="Created",
+ value=(variable[8] or "") .. " " .. (variable[9] or ""),
+ })
+
+ output[k]['Phase2']=cfe({
+ name="Phase2",
+ label="Phase2",
+ value=variable[10],
+ })
+ end
+ end
+ return output
+end
+
local function ip_xfrm(mode)
local cmd_output_result
local cmd = "/bin/ip xfrm " .. mode .. " 2>/dev/null"
@@ -89,6 +147,11 @@ function getstatus()
errtxt=autostart_errtxt,
})
+ status.show_isakmp2 = cfe({ name="show_isakmp2",
+ label="Tunnels",
+ value=racoonctl_table(),
+ })
+
status.show_isakmp = cfe({ name="show_isakmp",
label="racoonctl -lll show-sa isakmp",
value=racoonctl(),
diff --git a/ipsectools-status-html.lsp b/ipsectools-status-html.lsp
index 6215542..b76acfe 100644
--- a/ipsectools-status-html.lsp
+++ b/ipsectools-status-html.lsp
@@ -35,18 +35,44 @@ informationform(myform,tags)
</DL>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
+
+<H3>Phase1</H3>
+<DL>
+
+<TABLE>
+<TR><TD CLASS='header'>Source</TD><TD CLASS='header'>Destination</TD><TD CLASS='header'>Cookies</TD><TD CLASS='header'>St</TD><TD CLASS='header'>S</TD><TD CLASS='header'>V</TD><TD CLASS='header'>E</TD><TD CLASS='header'>Created</TD><TD CLASS='header'>Phase2</TD></TR>
+<?
+local myform = form.status.show_isakmp2.value
+for k,v in pairs(myform) do
+ io.write("\t<TR>\n")
+ io.write("\t \t<TD>" .. (v['Source']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['Destination']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['Cookies']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['St']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['S']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['V']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['E']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['Created']['value'] or "") .. "</TD>\n")
+ io.write("\t \t<TD>" .. (v['Phase2']['value'] or "") .. "</TD>\n")
+ io.write("\t</TR>\n")
+end
+?>
+</TABLE>
+</DL>
+
+<H3>Phase2</H3>
<DL>
<?
-local myform = form.status.show_isakmp
-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_state
-io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
+?>
+</DL>
+<H3>Policy</H3>
+<DL>
+<?
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")
?>