|
@@ -0,0 +1,399 @@
|
|
1
|
+--[[
|
|
2
|
+
|
|
3
|
+LuCI E2Guardian module
|
|
4
|
+
|
|
5
|
+Copyright (C) 2015, Itus Networks, Inc.
|
|
6
|
+
|
|
7
|
+Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+you may not use this file except in compliance with the License.
|
|
9
|
+You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+ http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+Author: Marko Ratkaj <marko.ratkaj@sartura.hr>
|
|
14
|
+ Luka Perkov <luka.perkov@sartura.hr>
|
|
15
|
+
|
|
16
|
+]]--
|
|
17
|
+
|
|
18
|
+local fs = require "nixio.fs"
|
|
19
|
+local sys = require "luci.sys"
|
|
20
|
+
|
|
21
|
+m = Map("e2guardian", translate("E2Guardian"))
|
|
22
|
+m.on_after_commit = function() luci.sys.call("/etc/init.d/e2guardian restart") end
|
|
23
|
+
|
|
24
|
+s = m:section(TypedSection, "e2guardian")
|
|
25
|
+s.anonymous = true
|
|
26
|
+s.addremove = false
|
|
27
|
+
|
|
28
|
+s:tab("tab_general", translate("General Settings"))
|
|
29
|
+s:tab("tab_additional", translate("Additional Settings"))
|
|
30
|
+s:tab("tab_logs", translate("Logs"))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+----------------- General Settings Tab -----------------------
|
|
34
|
+
|
|
35
|
+filterip = s:taboption("tab_general", Value, "filterip", translate("IP that E2Guardian listens"))
|
|
36
|
+filterip.datatype = "ip4addr"
|
|
37
|
+
|
|
38
|
+filterports = s:taboption("tab_general", Value, "filterports", translate("Port that E2Guardian listens"))
|
|
39
|
+filterports.datatype = "portrange"
|
|
40
|
+filterports.placeholder = "0-65535"
|
|
41
|
+
|
|
42
|
+proxyip = s:taboption("tab_general", Value, "proxyip", translate("IP address of the proxy"))
|
|
43
|
+proxyip.datatype = "ip4addr"
|
|
44
|
+proxyip.default = "127.0.0.1"
|
|
45
|
+
|
|
46
|
+proxyport = s:taboption("tab_general", Value, "proxyport", translate("Port of the proxy"))
|
|
47
|
+proxyport.datatype = "portrange"
|
|
48
|
+proxyport.placeholder = "0-65535"
|
|
49
|
+
|
|
50
|
+languagedir = s:taboption("tab_general", Value, "languagedir", translate("Language dir"))
|
|
51
|
+languagedir.datatype = "string"
|
|
52
|
+languagedir.default = "/usr/share/e2guardian/languages"
|
|
53
|
+
|
|
54
|
+language = s:taboption("tab_general", Value, "language", translate("Language to use"))
|
|
55
|
+language.datatype = "string"
|
|
56
|
+language.default = "ukenglish"
|
|
57
|
+
|
|
58
|
+loglevel = s:taboption("tab_general", ListValue, "loglevel", translate("Logging Settings"))
|
|
59
|
+loglevel:value("0", translate("none"))
|
|
60
|
+loglevel:value("1", translate("just denied"))
|
|
61
|
+loglevel:value("2", translate("all text based"))
|
|
62
|
+loglevel:value("3", translate("all requests"))
|
|
63
|
+loglevel.default = "2"
|
|
64
|
+
|
|
65
|
+logexceptionhits = s:taboption("tab_general", ListValue, "logexceptionhits", translate("Log Exception Hits"))
|
|
66
|
+logexceptionhits:value("0", translate("never"))
|
|
67
|
+logexceptionhits:value("1", translate("log, but dont mark as exceptions"))
|
|
68
|
+logexceptionhits:value("2", translate("log and mark"))
|
|
69
|
+logexceptionhits.default = "2"
|
|
70
|
+
|
|
71
|
+logfileformat = s:taboption("tab_general", ListValue, "logfileformat", translate("Log File Format"))
|
|
72
|
+logfileformat:value("1", translate("DansgGuardian format, space delimited"))
|
|
73
|
+logfileformat:value("2", translate("CSV-style format"))
|
|
74
|
+logfileformat:value("3", translate("Squid Log File Format"))
|
|
75
|
+logfileformat:value("4", translate("Tab delimited"))
|
|
76
|
+logfileformat:value("5", translate("Protex format"))
|
|
77
|
+logfileformat:value("6", translate("Protex format with server field blanked"))
|
|
78
|
+logfileformat.default = "1"
|
|
79
|
+
|
|
80
|
+accessdeniedaddress = s:taboption("tab_general", Value, "accessdeniedaddress", translate("Access denied address"),
|
|
81
|
+translate("Server to which the cgi e2guardian reporting script was copied. Reporting levels 1 and 2 only"))
|
|
82
|
+accessdeniedaddress.datatype = "string"
|
|
83
|
+accessdeniedaddress.default = "http://YOURSERVER.YOURDOMAIN/cgi-bin/e2guardian.pl"
|
|
84
|
+
|
|
85
|
+usecustombannedimage = s:taboption("tab_general", ListValue, "usecustombannedimage", translate("Banned image replacement"))
|
|
86
|
+usecustombannedimage:value("on", translate("Yes"))
|
|
87
|
+usecustombannedimage:value("off", translate("No"))
|
|
88
|
+usecustombannedimage.default = "on"
|
|
89
|
+
|
|
90
|
+custombannedimagefile = s:taboption("tab_general", Value, "custombannedimagefile", translate("Custom banned image file"))
|
|
91
|
+custombannedimagefile.datatype = "string"
|
|
92
|
+custombannedimagefile.default = "/usr/share/e2guardian/transparent1x1.gif"
|
|
93
|
+
|
|
94
|
+usecustombannedflash = s:taboption("tab_general", ListValue, "usecustombannedflash", translate("Banned flash replacement"))
|
|
95
|
+usecustombannedflash:value("on", translate("Yes"))
|
|
96
|
+usecustombannedflash:value("off", translate("No"))
|
|
97
|
+usecustombannedflash.default = "on"
|
|
98
|
+
|
|
99
|
+custombannedflashfile = s:taboption("tab_general", Value, "custombannedflashfile", translate("Custom banned flash file"))
|
|
100
|
+custombannedflashfile.datatype = "string"
|
|
101
|
+custombannedflashfile.default = "/usr/share/e2guardian/blockedflash.swf"
|
|
102
|
+
|
|
103
|
+filtergroups = s:taboption("tab_general", Value, "filtergroups", translate("Number of filter groups"))
|
|
104
|
+filtergroups.datatype = "and(uinteger,min(1))"
|
|
105
|
+filtergroups.default = "1"
|
|
106
|
+
|
|
107
|
+filtergroupslist = s:taboption("tab_general", Value, "filtergroupslist", translate("List of filter groups"))
|
|
108
|
+filtergroupslist.datatype = "string"
|
|
109
|
+filtergroupslist.default = "/etc/e2guardian/lists/filtergroupslist"
|
|
110
|
+
|
|
111
|
+bannediplist = s:taboption("tab_general", Value, "bannediplist", translate("List of banned IPs"))
|
|
112
|
+bannediplist.datatype = "string"
|
|
113
|
+bannediplist.default = "/etc/e2guardian/lists/bannediplist"
|
|
114
|
+
|
|
115
|
+exceptioniplist = s:taboption("tab_general", Value, "exceptioniplist", translate("List of IP exceptions"))
|
|
116
|
+exceptioniplist.datatype = "string"
|
|
117
|
+exceptioniplist.default = "/etc/e2guardian/lists/exceptioniplist"
|
|
118
|
+
|
|
119
|
+perroomblockingdirectory = s:taboption("tab_general", Value, "perroomblockingdirectory", translate("Per-Room blocking definition directory"))
|
|
120
|
+perroomblockingdirectory.datatype = "string"
|
|
121
|
+perroomblockingdirectory.default = "/etc/e2guardian/lists/bannedrooms/"
|
|
122
|
+
|
|
123
|
+showweightedfound = s:taboption("tab_general", ListValue, "showweightedfound", translate("Show weighted phrases found"))
|
|
124
|
+showweightedfound:value("on", translate("Yes"))
|
|
125
|
+showweightedfound:value("off", translate("No"))
|
|
126
|
+showweightedfound.default = "on"
|
|
127
|
+
|
|
128
|
+weightedphrasemode = s:taboption("tab_general", ListValue, "weightedphrasemode", translate("Weighted phrase mode"))
|
|
129
|
+weightedphrasemode:value("0", translate("off"))
|
|
130
|
+weightedphrasemode:value("1", translate("on, normal operation"))
|
|
131
|
+weightedphrasemode:value("2", translate("on, phrase found only counts once on a page"))
|
|
132
|
+weightedphrasemode.default = "2"
|
|
133
|
+
|
|
134
|
+urlcachenumber = s:taboption("tab_general", Value, "urlcachenumber", translate("Clean result caching for URLs"))
|
|
135
|
+urlcachenumber.datatype = "and(uinteger,min(0))"
|
|
136
|
+urlcachenumber.default = "1000"
|
|
137
|
+
|
|
138
|
+urlcacheage = s:taboption("tab_general", Value, "urlcacheage", translate("Age before they should be ignored in seconds"))
|
|
139
|
+urlcacheage.datatype = "and(uinteger,min(0))"
|
|
140
|
+urlcacheage.default = "900"
|
|
141
|
+
|
|
142
|
+scancleancache = s:taboption("tab_general", ListValue, "scancleancache", translate("Cache for content (AV) scans as 'clean'"))
|
|
143
|
+scancleancache:value("on", translate("Yes"))
|
|
144
|
+scancleancache:value("off", translate("No"))
|
|
145
|
+scancleancache.default = "on"
|
|
146
|
+
|
|
147
|
+phrasefiltermode = s:taboption("tab_general", ListValue, "phrasefiltermode", translate("Filtering options"))
|
|
148
|
+phrasefiltermode:value("0", translate("raw"))
|
|
149
|
+phrasefiltermode:value("1", translate("smart"))
|
|
150
|
+phrasefiltermode:value("2", translate("both raw and smart"))
|
|
151
|
+phrasefiltermode:value("3", translate("meta/title"))
|
|
152
|
+phrasefiltermode.default = "2"
|
|
153
|
+
|
|
154
|
+preservecase = s:taboption("tab_general", ListValue, "perservecase", translate("Lower caseing options"))
|
|
155
|
+preservecase:value("0", translate("force lower case"))
|
|
156
|
+preservecase:value("1", translate("dont change"))
|
|
157
|
+preservecase:value("2", translate("scan fist in lower, then in original"))
|
|
158
|
+preservecase.default = "0"
|
|
159
|
+
|
|
160
|
+hexdecodecontent = s:taboption("tab_general", ListValue, "hexdecodecontent", translate("Hex decoding options"))
|
|
161
|
+hexdecodecontent:value("on", translate("Yes"))
|
|
162
|
+hexdecodecontent:value("off", translate("No"))
|
|
163
|
+hexdecodecontent.default = "off"
|
|
164
|
+
|
|
165
|
+forcequicksearch = s:taboption("tab_general", ListValue, "forcequicksearch", translate("Quick search"))
|
|
166
|
+forcequicksearch:value("on", translate("Yes"))
|
|
167
|
+forcequicksearch:value("off", translate("No"))
|
|
168
|
+forcequicksearch.default = "off"
|
|
169
|
+
|
|
170
|
+reverseaddresslookups= s:taboption("tab_general", ListValue, "reverseaddresslookups", translate("Reverse lookups for banned site and URLs"))
|
|
171
|
+reverseaddresslookups:value("on", translate("Yes"))
|
|
172
|
+reverseaddresslookups:value("off", translate("No"))
|
|
173
|
+reverseaddresslookups.default = "off"
|
|
174
|
+
|
|
175
|
+reverseclientiplookups = s:taboption("tab_general", ListValue, "reverseclientiplookups", translate("Reverse lookups for banned and exception IP lists"))
|
|
176
|
+reverseclientiplookups:value("on", translate("Yes"))
|
|
177
|
+reverseclientiplookups:value("off", translate("No"))
|
|
178
|
+reverseclientiplookups.default = "off"
|
|
179
|
+
|
|
180
|
+logclienthostnames = s:taboption("tab_general", ListValue, "logclienthostnames", translate("Perform reverse lookups on client IPs for successful requests"))
|
|
181
|
+logclienthostnames:value("on", translate("Yes"))
|
|
182
|
+logclienthostnames:value("off", translate("No"))
|
|
183
|
+logclienthostnames.default = "off"
|
|
184
|
+
|
|
185
|
+createlistcachefiles = s:taboption("tab_general", ListValue, "createlistcachefiles", translate("Build bannedsitelist and bannedurllist cache files"))
|
|
186
|
+createlistcachefiles:value("on",translate("Yes"))
|
|
187
|
+createlistcachefiles:value("off",translate("No"))
|
|
188
|
+createlistcachefiles.default = "on"
|
|
189
|
+
|
|
190
|
+prefercachedlists = s:taboption("tab_general", ListValue, "prefercachedlists", translate("Prefer cached list files"))
|
|
191
|
+prefercachedlists:value("on", translate("Yes"))
|
|
192
|
+prefercachedlists:value("off", translate("No"))
|
|
193
|
+prefercachedlists.default = "off"
|
|
194
|
+
|
|
195
|
+maxuploadsize = s:taboption("tab_general", Value, "maxuploadsize", translate("Max upload size (in Kbytes)"))
|
|
196
|
+maxuploadsize:value("-1", translate("no blocking"))
|
|
197
|
+maxuploadsize:value("0", translate("complete block"))
|
|
198
|
+maxuploadsize.default = "-1"
|
|
199
|
+
|
|
200
|
+maxcontentfiltersize = s:taboption("tab_general", Value, "maxcontentfiltersize", translate("Max content filter size"),
|
|
201
|
+translate("The value must not be higher than max content ram cache scan size or 0 to match it"))
|
|
202
|
+maxcontentfiltersize.datatype = "and(uinteger,min(0))"
|
|
203
|
+maxcontentfiltersize.default = "256"
|
|
204
|
+
|
|
205
|
+maxcontentramcachescansize = s:taboption("tab_general", Value, "maxcontentramcachescansize", translate("Max content ram cache scan size"),
|
|
206
|
+translate("This is the max size of file that DG will download and cache in RAM"))
|
|
207
|
+maxcontentramcachescansize.datatype = "and(uinteger,min(0))"
|
|
208
|
+maxcontentramcachescansize.default = "2000"
|
|
209
|
+
|
|
210
|
+maxcontentfilecachescansize = s:taboption("tab_general", Value, "maxcontentfilecachescansize", translate("Max content file cache scan size"))
|
|
211
|
+maxcontentfilecachescansize.datatype = "and(uinteger,min(0))"
|
|
212
|
+maxcontentfilecachescansize.default = "20000"
|
|
213
|
+
|
|
214
|
+proxytimeout = s:taboption("tab_general", Value, "proxytimeout", translate("Proxy timeout (5-100)"))
|
|
215
|
+proxytimeout.datatype = "range(5,100)"
|
|
216
|
+proxytimeout.default = "20"
|
|
217
|
+
|
|
218
|
+proxyexchange = s:taboption("tab_general", Value, "proxyexchange", translate("Proxy header excahnge (20-300)"))
|
|
219
|
+proxyexchange.datatype = "range(20,300)"
|
|
220
|
+proxyexchange.default = "20"
|
|
221
|
+
|
|
222
|
+pcontimeout = s:taboption("tab_general", Value, "pcontimeout", translate("Pconn timeout"),
|
|
223
|
+translate("How long a persistent connection will wait for other requests"))
|
|
224
|
+pcontimeout.datatype = "range(5,300)"
|
|
225
|
+pcontimeout.default = "55"
|
|
226
|
+
|
|
227
|
+filecachedir = s:taboption("tab_general", Value, "filecachedir", translate("File cache directory"))
|
|
228
|
+filecachedir.datatype = "string"
|
|
229
|
+filecachedir.default = "/tmp"
|
|
230
|
+
|
|
231
|
+deletedownloadedtempfiles = s:taboption("tab_general", ListValue, "deletedownloadedtempfiles", translate("Delete file cache after user completes download"))
|
|
232
|
+deletedownloadedtempfiles:value("on", translate("Yes"))
|
|
233
|
+deletedownloadedtempfiles:value("off", translate("No"))
|
|
234
|
+deletedownloadedtempfiles.default = "on"
|
|
235
|
+
|
|
236
|
+initialtrickledelay = s:taboption("tab_general", Value, "initialtrickledelay", translate("Initial Trickle delay"),
|
|
237
|
+translate("Number of seconds a browser connection is left waiting before first being sent *something* to keep it alive"))
|
|
238
|
+initialtrickledelay.datatype = "and(uinteger,min(0))"
|
|
239
|
+initialtrickledelay.default = "20"
|
|
240
|
+
|
|
241
|
+trickledelay = s:taboption("tab_general", Value, "trickledelay", translate("Trickle delay"),
|
|
242
|
+translate("Number of seconds a browser connection is left waiting before being sent more *something* to keep it alive"))
|
|
243
|
+trickledelay.datatype = "and(uinteger,min(0))"
|
|
244
|
+trickledelay.default = "10"
|
|
245
|
+
|
|
246
|
+downloadmanager = s:taboption("tab_general", Value, "downloadmanager", translate("Download manager"))
|
|
247
|
+downloadmanager.datatype = "string"
|
|
248
|
+downloadmanager.default = "/etc/e2guardian/downloadmanagers/default.conf"
|
|
249
|
+
|
|
250
|
+contentscannertimeout = s:taboption("tab_general", Value, "contentscannertimeout", translate("Content scanner timeout"))
|
|
251
|
+contentscannertimeout.datatype = "and(uinteger,min(0))"
|
|
252
|
+contentscannertimeout.default = "60"
|
|
253
|
+
|
|
254
|
+contentscanexceptions = s:taboption("tab_general", ListValue, "contentscanexceptions", translate("Content scan exceptions"))
|
|
255
|
+contentscanexceptions:value("on", translate("Yes"))
|
|
256
|
+contentscanexceptions:value("off", translate("No"))
|
|
257
|
+contentscanexceptions.default = "off"
|
|
258
|
+
|
|
259
|
+recheckreplacedurls = s:taboption("tab_general", ListValue, "recheckreplacedurls", translate("e-check replaced URLs"))
|
|
260
|
+recheckreplacedurls:value("on", translate("Yes"))
|
|
261
|
+recheckreplacedurls:value("off", translate("No"))
|
|
262
|
+recheckreplacedurls.default = "off"
|
|
263
|
+
|
|
264
|
+forwardedfor = s:taboption("tab_general", ListValue, "forwardedfor", translate("Misc setting: forwardedfor"),
|
|
265
|
+translate("If on, it may help solve some problem sites that need to know the source ip."))
|
|
266
|
+forwardedfor:value("on", translate("Yes"))
|
|
267
|
+forwardedfor:value("off", translate("No"))
|
|
268
|
+forwardedfor.default = "off"
|
|
269
|
+
|
|
270
|
+usexforwardedfor = s:taboption("tab_general", ListValue, "usexforwardedfor", translate("Misc setting: usexforwardedfor"),
|
|
271
|
+translate("This is for when you have squid between the clients and E2Guardian"))
|
|
272
|
+usexforwardedfor:value("on", translate("Yes"))
|
|
273
|
+usexforwardedfor:value("off", translate("No"))
|
|
274
|
+usexforwardedfor.default = "off"
|
|
275
|
+
|
|
276
|
+logconnectionhandlingerrors = s:taboption("tab_general", ListValue, "logconnectionhandlingerrors", translate("Log debug info about log()ing and accept()ing"))
|
|
277
|
+logconnectionhandlingerrors:value("on", translate("Yes"))
|
|
278
|
+logconnectionhandlingerrors:value("off", translate("No"))
|
|
279
|
+logconnectionhandlingerrors.default = "on"
|
|
280
|
+
|
|
281
|
+logchildprocesshandling = s:taboption("tab_general", ListValue, "logchildprocesshandling", translate("Log child process handling"))
|
|
282
|
+logchildprocesshandling:value("on", translate("Yes"))
|
|
283
|
+logchildprocesshandling:value("off", translate("No"))
|
|
284
|
+logchildprocesshandling.default = "off"
|
|
285
|
+
|
|
286
|
+maxchildren = s:taboption("tab_general", Value, "maxchildren", translate("Max number of processes to spawn"))
|
|
287
|
+maxchildren.datatype = "and(uinteger,min(0))"
|
|
288
|
+maxchildren.default = "180"
|
|
289
|
+
|
|
290
|
+minchildren = s:taboption("tab_general", Value, "minchildren", translate("Min number of processes to spawn"))
|
|
291
|
+minchildren.datatype = "and(uinteger,min(0))"
|
|
292
|
+minchildren.default = "20"
|
|
293
|
+
|
|
294
|
+minsparechildren = s:taboption("tab_general", Value, "minsparechildren", translate("Min number of processes to keep ready"))
|
|
295
|
+minsparechildren.datatype = "and(uinteger,min(0))"
|
|
296
|
+minsparechildren.default = "16"
|
|
297
|
+
|
|
298
|
+preforkchildren = s:taboption("tab_general", Value, "preforkchildren", translate("Sets minimum nuber of processes when it runs out"))
|
|
299
|
+preforkchildren.datatype = "and(uinteger,min(0))"
|
|
300
|
+preforkchildren.default = "10"
|
|
301
|
+
|
|
302
|
+maxsparechildren = s:taboption("tab_general", Value, "maxsparechildren", translate("Sets the maximum number of processes to have doing nothing"))
|
|
303
|
+maxsparechildren.datatype = "and(uinteger,min(0))"
|
|
304
|
+maxsparechildren.default = "32"
|
|
305
|
+
|
|
306
|
+maxagechildren = s:taboption("tab_general", Value, "maxagechildren", translate("Max age of child process"))
|
|
307
|
+maxagechildren.datatype = "and(uinteger,min(0))"
|
|
308
|
+maxagechildren.default = "500"
|
|
309
|
+
|
|
310
|
+maxips = s:taboption("tab_general", Value, "maxips", translate("Max number of clinets allowed to connect"))
|
|
311
|
+maxips:value("0", translate("no limit"))
|
|
312
|
+maxips.default = "0"
|
|
313
|
+
|
|
314
|
+ipipcfilename = s:taboption("tab_general", Value, "ipipcfilename", translate("IP list IPC server directory and filename"))
|
|
315
|
+ipipcfilename.datatype = "string"
|
|
316
|
+ipipcfilename.default = "/tmp/.dguardianipc"
|
|
317
|
+
|
|
318
|
+urlipcfilename = s:taboption("tab_general", Value, "urlipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process"))
|
|
319
|
+urlipcfilename.datatype = "string"
|
|
320
|
+urlipcfilename.default = "/tmp/.dguardianurlipc"
|
|
321
|
+
|
|
322
|
+ipcfilename = s:taboption("tab_general", Value, "ipcfilename", translate("Defines URL list IPC server directory and filename used to communicate with the URL cache process"))
|
|
323
|
+ipcfilename.datatype = "string"
|
|
324
|
+ipcfilename.default = "/tmp/.dguardianipipc"
|
|
325
|
+
|
|
326
|
+nodeamon = s:taboption("tab_general", ListValue, "nodeamon", translate("Disable deamoning"))
|
|
327
|
+nodeamon:value("on", translate("Yes"))
|
|
328
|
+nodeamon:value("off", translate("No"))
|
|
329
|
+nodeamon.default = "off"
|
|
330
|
+
|
|
331
|
+nologger = s:taboption("tab_general", ListValue, "nologger", translate("Disable logger"))
|
|
332
|
+nologger:value("on", translate("Yes"))
|
|
333
|
+nologger:value("off", translate("No"))
|
|
334
|
+nologger.default = "off"
|
|
335
|
+
|
|
336
|
+logadblock = s:taboption("tab_general", ListValue, "logadblock", translate("Enable logging of ADs"))
|
|
337
|
+logadblock:value("on", translate("Yes"))
|
|
338
|
+logadblock:value("off", translate("No"))
|
|
339
|
+logadblock.default = "off"
|
|
340
|
+
|
|
341
|
+loguseragent = s:taboption("tab_general", ListValue, "loguseragent", translate("Enable logging of client user agent"))
|
|
342
|
+loguseragent:value("on", translate("Yes"))
|
|
343
|
+loguseragent:value("off", translate("No"))
|
|
344
|
+loguseragent.default = "off"
|
|
345
|
+
|
|
346
|
+softrestart = s:taboption("tab_general", ListValue, "softrestart", translate("Enable soft restart"))
|
|
347
|
+softrestart:value("on", translate("Yes"))
|
|
348
|
+softrestart:value("off", translate("No"))
|
|
349
|
+softrestart.default = "off"
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+------------------------ Additional Settings Tab ----------------------------
|
|
353
|
+
|
|
354
|
+e2guardian_config_file = s:taboption("tab_additional", TextValue, "_data", "")
|
|
355
|
+e2guardian_config_file.wrap = "off"
|
|
356
|
+e2guardian_config_file.rows = 25
|
|
357
|
+e2guardian_config_file.rmempty = false
|
|
358
|
+
|
|
359
|
+function e2guardian_config_file.cfgvalue()
|
|
360
|
+ local uci = require "luci.model.uci".cursor_state()
|
|
361
|
+ file = "/etc/e2guardian/e2guardianf1.conf"
|
|
362
|
+ if file then
|
|
363
|
+ return fs.readfile(file) or ""
|
|
364
|
+ else
|
|
365
|
+ return ""
|
|
366
|
+ end
|
|
367
|
+end
|
|
368
|
+
|
|
369
|
+function e2guardian_config_file.write(self, section, value)
|
|
370
|
+ if value then
|
|
371
|
+ local uci = require "luci.model.uci".cursor_state()
|
|
372
|
+ file = "/etc/e2guardian/e2guardianf1.conf"
|
|
373
|
+ fs.writefile(file, value:gsub("\r\n", "\n"))
|
|
374
|
+ end
|
|
375
|
+end
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+---------------------------- Logs Tab -----------------------------
|
|
379
|
+
|
|
380
|
+e2guardian_logfile = s:taboption("tab_logs", TextValue, "lines", "")
|
|
381
|
+e2guardian_logfile.wrap = "off"
|
|
382
|
+e2guardian_logfile.rows = 25
|
|
383
|
+e2guardian_logfile.rmempty = true
|
|
384
|
+
|
|
385
|
+function e2guardian_logfile.cfgvalue()
|
|
386
|
+ local uci = require "luci.model.uci".cursor_state()
|
|
387
|
+ file = "/tmp/e2guardian/access.log"
|
|
388
|
+ if file then
|
|
389
|
+ return fs.readfile(file) or ""
|
|
390
|
+ else
|
|
391
|
+ return "Can't read log file"
|
|
392
|
+ end
|
|
393
|
+end
|
|
394
|
+
|
|
395
|
+function e2guardian_logfile.write()
|
|
396
|
+ return ""
|
|
397
|
+end
|
|
398
|
+
|
|
399
|
+return m
|