diff options
-rw-r--r-- | squid-cfilter-html.lsp | 76 | ||||
-rw-r--r-- | squid-controller.lua | 17 | ||||
-rw-r--r-- | squid-model.lua | 8 |
3 files changed, 101 insertions, 0 deletions
diff --git a/squid-cfilter-html.lsp b/squid-cfilter-html.lsp new file mode 100644 index 0000000..89c8aab --- /dev/null +++ b/squid-cfilter-html.lsp @@ -0,0 +1,76 @@ +<? + local form = ... + local data = form.option + local service = form.service + local config = form.service.config + + local srv1fill = "" + local srv2fill = "disabled" + if service.status == "running" then + srv1fill = "disabled" + srv2fill = "" + end + + local ifthen = function( variable, value, result ) + if variable == value then + io.write( result ) + end + end + +?> +<h1>Content Filter</1> +DansGuardian is web content filtering software. It works as a web proxy, +making web requests in behalf of the client, and inspecting the returned +content before passing on to the client. DansGuardian uses phraselists to +identify harmful content. This means that updated "blacklists" are +generally not necessary. DansGuardian must be used in combination with a +"smart proxy", such as squid. +<b>This page defines the basic network configuration settings for DansGuardian.</b><br> + +<h1>Status</h1> +<form action="" method="POST"> +<table><tr> +<td>dansguardian is: <b><? io.write( service.status ) ?> </b> </td> +<td><input type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?> style="width:100px"></td> +<td><input type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?> style="width:100px"></td> +<td><input type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?> style="width:100px"></td> +</tr></table> +</form> + +<pre style="color: #ff2020;"><? io.write( service.message ) ?></pre><br> + +This process runs as a service. When you make and save changes, the configuration +files for the service are changed. However, the changes will not be <i>applied</i> +until you restart the service.<br><br> + +<form action="" method="POST"> +<h1>Configuration</h1> +<h2>Listener service</h2> +These parameters define the interface and port that Dansguardian uses to accept connections.<br><br> + +<table> +<tr><td align="right"><b>filterip</b></td><td><input type="text" name="filterip" value="<? io.write( config.filterip.value ) ?>"></td></tr> +<tr><td align="right"><b>filterport</b></td><td><input type="text" name="filterport" value="<? io.write( config.filterport.value ) ?>"></td></tr> +</table><br> + +<h2>Proxy service</h2> +These parameters define the ip address and port that Dansguardian should forward requests on to.<br><br> + +<table> +<tr><td align="right"><b>proxyip</b></td><td><input type="text" name="proxyip" value="<? io.write( config.proxyip.value ) ?>"></td></tr> +<tr><td align="right"><b>proxyport</b></td><td><input type="text" name="proxyport" value="<? io.write( config.proxyport.value ) ?>"></td></tr> +</table><br> + +<h2>Filter Actions</h2> +These parameters define how sensitive the filter is, and where to redirect requests if the content filter +determines that the content is inappropriate. The "naughtynesslimit" is more sensitive the lower it is set. +The author recommends 50 for "young children", 100 for "older children" and 160 for "young adults".<br><br> + +<table> +<tr><td align="right"><b>accessdeniedaddress</b></td><td><input type="text" name="accessdeniedaddress" value="<? io.write( config.accessdeniedaddress.value ) ?>"</td></tr> +<tr><td align="right"><b>naughtynesslimit</b></td><td><input type="text" name="naughtynesslimit" value="<? io.write( config.naughtynesslimit.value ) ?>"></td></tr> +</table><br> + +<input type="submit" name="cmd" value="save" style="width:100px"><br> +</form> + diff --git a/squid-controller.lua b/squid-controller.lua index a651d6c..f8e5f56 100644 --- a/squid-controller.lua +++ b/squid-controller.lua @@ -81,3 +81,20 @@ advanced = function( self ) return ( cfe ({ option = option, service = service }) ) end +cfilter = function( self ) + + local option = { script = ENV["SCRIPT_NAME"], + prefix = self.conf.prefix, + controller = self.conf.controller, + action = self.conf.action, + extra = "" + } + + local service = { message="", status="", config="" } + + service.status = self.model.get_status() + service.config = self.model.get_adv_config() + + return ( cfe ({ option = option, service = service }) ) +end + diff --git a/squid-model.lua b/squid-model.lua index 0a56978..2ab54c8 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -56,6 +56,14 @@ get_adv_config = function() return retval end +get_filter_config = function() + + local retval = "" + + + return retval +end + update_adv_config = function( config ) local retval = "Successfully updated /etc/squid/squid.conf!" |