summaryrefslogtreecommitdiffstats
path: root/openvpn-viewconfig-html.lsp
blob: 9b9347203912f03cffc188bc230d8d1cda7ec1ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<% local view, viewlibrary, page_info, session = ... %>
<% format = require("acf.format") %>
<% html = require("acf.html") %>
<% local shortname = string.gsub(view.value.name, "^.*/", "") %>

<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label=format.cap_begin_word(view.value.type).." Config"}), page_info) %>
<% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label=format.cap_begin_word(view.value.type).." settings"}), page_info, htmlviewfunctions.incrementheader(header_level)) %>

<% htmlviewfunctions.displayitemstart() %>
Mode
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.type) %>
<% htmlviewfunctions.displayitemend() %>

<% htmlviewfunctions.displayitemstart() %>
User device
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.dev) %>
<% htmlviewfunctions.displayitemend() %>

<% if view.value.type == "server" then %>
<% htmlviewfunctions.displayitemstart() %>
Listens on
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value["local"]) %>:<%= html.html_escape(view.value.port) %> (<%= html.html_escape(view.value.proto) %>)
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if view.value.type == "client" then %>
<% htmlviewfunctions.displayitemstart() %>
Remote server
<% htmlviewfunctions.displayitemmiddle() %>
<% if string.find(view.value.remote, "%s") then io.write(html.html_escape(string.gsub(view.value.remote, "%s+", ":"))) else io.write(html.html_escape(view.value.remote .. (view.value.rport or view.value.port or "1194"))) end %> (<%= html.html_escape(view.value.proto) %>)
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% htmlviewfunctions.displayitemstart() %>
Logfile
<% htmlviewfunctions.displayitemmiddle() %>
<% if ( view.value.log ) then %><%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/logfile?name=" .. view.value.name, label=view.value.log } %><% else %>Syslog<% end %> (Verbosity level: <%= html.html_escape(view.value.verb) %>)
<% htmlviewfunctions.displayitemend() %>

<% if view.value.type == "server" then %>
<% local header_level3 = htmlviewfunctions.displaysectionstart(cfe({label="Connected clients status"}), page_info, htmlviewfunctions.incrementheader(header_level2)) %>

<% htmlviewfunctions.displayitemstart() %>
Last status was recorded
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.client_lastupdate) %> (This was <b><%= html.html_escape(view.value.client_lastdatechangediff) %></b> ago)
<% htmlviewfunctions.displayitemend() %>

<% htmlviewfunctions.displayitemstart() %>
Maximum clients
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value["max-clients"]) %>
<% htmlviewfunctions.displayitemend() %>

<% htmlviewfunctions.displayitemstart() %>
Connected clients
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.client_count) %>
<% htmlviewfunctions.displayitemend() %>

<% htmlviewfunctions.displaysectionend(header_level3) %>
<% end %>


<% if view.value.dh or view.value.ca or view.value.cert or view.value.key or view.value.tls or view.value.crl then %>
<% htmlviewfunctions.displaysectionend(header_level2) %>
<% htmlviewfunctions.displaysectionstart(cfe({label="Certificate files"}), page_info, header_level2) %>

<% if (view.value.dh) then %>
<% htmlviewfunctions.displayitemstart() %>
DH
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.dh, label=view.value.dh } %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if (view.value.ca) then %>
<% htmlviewfunctions.displayitemstart() %>
CA Certificate
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.ca, label=view.value.ca } %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if (view.value.cert) then %>
<% htmlviewfunctions.displayitemstart() %>
Certificate
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/viewcert?cert=" .. view.value.cert, label=view.value.cert } %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if (view.value.key) then %>
<% htmlviewfunctions.displayitemstart() %>
Private Key
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.key) %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if (view.value.tls) then %>
<% htmlviewfunctions.displayitemstart() %>
TLS Authentication
<%= html.html_escape(view.value.tls) %><% -- html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/pem_info?name=" .. view.value.tls  , label=view.value.tls } %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% if (view.value.crl) then %>
<% htmlviewfunctions.displayitemstart() %>
CRL Verify File
<% htmlviewfunctions.displayitemmiddle() %>
<%= html.html_escape(view.value.crl) %><% -- html.link{value = page_info.script .. page_info.prefix .. page_info.controller .. "/pem_info?name=" .. view.value.crl  , label=view.value.crl } %>
<% htmlviewfunctions.displayitemend() %>
<% end %>

<% end %>

<% htmlviewfunctions.displaysectionend(header_level2) %>
<% htmlviewfunctions.displaysectionend(header_level) %>