diff options
-rw-r--r-- | squid-advanced-html.lsp | 2 | ||||
-rw-r--r-- | squid-basic-html.lsp | 79 | ||||
-rw-r--r-- | squid-controller.lua | 7 | ||||
-rw-r--r-- | squid-model.lua | 25 |
4 files changed, 103 insertions, 10 deletions
diff --git a/squid-advanced-html.lsp b/squid-advanced-html.lsp index afcc642..072da93 100644 --- a/squid-advanced-html.lsp +++ b/squid-advanced-html.lsp @@ -38,7 +38,7 @@ 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> +until you restart the service.<br><br> <h2>Configuration</h2> <form action="" method="POST"> diff --git a/squid-basic-html.lsp b/squid-basic-html.lsp index 941dfba..b56b9e6 100644 --- a/squid-basic-html.lsp +++ b/squid-basic-html.lsp @@ -2,6 +2,7 @@ local form = ... local data = form.option local service = form.service + local config = form.service.config local srv1fill = "" local srv2fill = "disabled" @@ -10,6 +11,12 @@ srv2fill = "" end + local ifthen = function( variable, value, result ) + if variable == value then + io.write( result ) + end + end + ?> <h1>Web Proxy</h1> Squid is a web proxy server. It makes web requests in behalf of the client, and @@ -17,9 +24,9 @@ inspecting the returned and optionally caches that content so that the next time a client request is made, the content can be served from local disk. This can make web surfing faster. Squid can also forward its requests on to a content filter, such as DansGuardian.<br><br> -This page determines the general operational settings for squid.<br> +This page determines the general operational settings for squid.<br><br> -<h2>Status</h2> +<h1>Status</h1> <form action="" method="POST"> <table><tr> <td>squid is: <b><? io.write( service.status ) ?> </b> </td> @@ -27,14 +34,78 @@ This page determines the general operational settings for squid.<br> <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> +until you restart the service.<br><br> + +<form action="" method="POST"> +<h1>Configuration</h1> +<h2>Primary Listener service</h2> +These parameters define the interface and port that the web proxy uses to accept connections.<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 Service</h2> +These parameters define the ip address and port that the web proxy forwards requests to. +This is typically the address that DansGuardian (Web Content Filter) is listening on. +If you want this web proxy to handle retrieving the content, then leave these blank.<br><br> + +Filtering is a cpu-intensive process. The FilterRegex is a list of regular expressions that qualify +for filtering. Anything not matching the regular expression filter will bypass the content filter. +It is safe to leave this at the default settings.<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> +<tr><td align="right"><b>FilterRegex</b></td><td><input type="text" name="filterregex" value="<? io.write( config.filterregex.value ) ?>"></td></tr> +</table><br> -<h2>Configuration</h2> +<h2>Access Logs</h2> +This determines if the visited sites are logged or not.<br><br> +<table> +<tr><td><input type="radio" name="accesslog" value="no"<? ifthen( config.accesslog.value, "no", " checked" ); ?>> No access log</td></tr> +<tr><td><input type="radio" name="accesslog" value="yes"<? ifthen( config.accesslog.value, "yes", " checked" ); ?>> Use access log</td></tr> +</table><br> +<h2>Disk Cache Parameters</h2> +This determines if the disk is used for caching. This can speed up web surfing when many clients are accessing the Internet, +but it requires a local hard disk.<br><br> + +<table> +<tr><td><input type="radio" name="diskcache" value="no"<? ifthen( config.diskcache.value, "no", " checked" ); ?>> No caching</td></tr> +<tr><td><input type="radio" name="diskcache" value="yes"<? ifthen( config.diskcache.value, "yes", " checked" ); ?>> Use disk cache</td></tr> +</table><br> + +<h2>Authentication Method</h2> +Squid can use the Digest or NTLM authentication method. Unless you have a Windows domain controller in your ISM network, +use Digest authentication.<br><br> + +<table> +<tr><td><input type="radio" name="authmethod" value="digest"<? ifthen( config.authmethod.value, "digest", " checked" ); ?>> Digest Authentication</td></tr> +<tr><td><input type="radio" name="authmethod" value="ntlm"<? ifthen( config.authmethod.value, "ntlm", " checked" ); ?>> NTLM Authentication (also requires configuring NTLM authenticator)</td></tr> +<tr><td><input type="radio" name="authmethod" value="none"<? ifthen( config.authmethod.value, "none", " checked" ); ?>> No Authentication (Not Recomended)</td></tr> +</table><br> + +<h2>Allowed Ports</h2> +Web servers typically run on port 80; SSL (https) servers typically run on port 443. Some web +servers run on other ports as well. These fields list all ports and port ranges that are considered +"safe" for the web proxy to handle.<br><br> + +It is safe to leave these values at their default values.<br><br> + +<table> +<tr><td align="right"><b>Safe_ports</b></td><td><input type="text" name="safeports" value="<? io.write( config.safeports.value ) ?>"></td></tr> +<tr><td align="right"><b>SSL_ports</b></td><td><input type="text" name="sslports" value="<? io.write( config.sslports.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 3e8522f..a651d6c 100644 --- a/squid-controller.lua +++ b/squid-controller.lua @@ -6,7 +6,7 @@ module (..., package.seeall) -- We use the self.conf table because it already has prefix,controller,etc -- The redir code is defined in the application error handler (acf-controller) local list_redir = function (self) - self.conf.action = "home" + self.conf.action = "basic" self.conf.type = "redir" error (self.conf) end @@ -47,6 +47,7 @@ basic = function( self ) end service.status = self.model.get_status() + service.config = self.model.get_basic_config() return ( cfe ({ option = option, service = service }) ) end @@ -70,12 +71,12 @@ advanced = function( self ) if self.clientdata.cmd then if self.clientdata.cmd == "save" then - service.message = self.model.update_config( self.clientdata.config ) + service.message = self.model.update_adv_config( self.clientdata.config ) end end service.status = self.model.get_status() - service.config = self.model.get_config() + 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 f1fee43..0a56978 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -38,7 +38,7 @@ service_control = function( control ) return retval end -get_config = function() +get_adv_config = function() local retval = "" @@ -56,7 +56,7 @@ get_config = function() return retval end -update_config = function( config ) +update_adv_config = function( config ) local retval = "Successfully updated /etc/squid/squid.conf!" @@ -71,3 +71,24 @@ update_config = function( config ) return retval end +get_basic_config = function() + + local config = { proxyip = { value="", type="text", label="Proxy IP" }, + proxyport = { value="", type="text", label="Proxy Port" }, + filterip = { value="", type="text", label="Filter IP" }, + filterport = { value="", type="text", label="Filter Port" }, + filterregex = { value="", type="text", label="FilterRegex" }, + safeports = { value="", type="text", label="Safe_ports" }, + sslports = { value="", type="text", label="SSL_ports" }, + accesslog = { value="", type="select", label="Access Logs", option={ "yes", "no" } }, + diskcache = { value="", type="select", label="Disk Cache Parameters", option={ "yes", "no" } }, + authmethod = { value="", type="select", label="Authentication Method", option={ "digest", "ntlm", "none" } } + } + + config.proxyip.value = "192.168.83.129" + config.proxyport.value = 8080 + config.accesslog.value = "yes" + + return config +end + |