diff options
Diffstat (limited to 'ipsectools-model.lua')
-rw-r--r-- | ipsectools-model.lua | 63 |
1 files changed, 63 insertions, 0 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(), |