diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | dansguardian-general-html.lsp | 12 | ||||
-rw-r--r-- | dansguardian-plain-html.lsp | 2 | ||||
-rw-r--r-- | squid-basic-html.lsp | 4 | ||||
-rw-r--r-- | squid-controller.lua | 77 | ||||
-rw-r--r-- | squid-model.lua | 135 |
6 files changed, 224 insertions, 9 deletions
@@ -7,6 +7,9 @@ APP_DIST=squid-controller.lua \ squid-basic-html.lsp \ squid-authentication-html.lsp \ squid-advanced-html.lsp \ + squid-digest-html.lsp \ + squid-ntlm-html.lsp \ + squid-saccess-html.lsp \ squid.menu \ dansguardian-controller.lua \ dansguardian-model.lua \ diff --git a/dansguardian-general-html.lsp b/dansguardian-general-html.lsp index 905c5d2..41116a3 100644 --- a/dansguardian-general-html.lsp +++ b/dansguardian-general-html.lsp @@ -50,16 +50,16 @@ until you restart the service.<br><br><br> 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 class="text" type="text" name="filterip" value="<? io.write( config.filterip.value ) ?>" style="width:100px"></td></tr> -<tr><td align="right"><b>filterport</b></td><td><input class="text" type="text" name="filterport" value="<? io.write( config.filterport.value ) ?>" style="width:100px"></td></tr> +<tr><td align="right" style="width:120px;"><b>filterip</b></td><td><input class="text" type="text" name="filterip" value="<? io.write( config.filterip.value ) ?>" style="width:100px"></td></tr> +<tr><td align="right" style="width:120px;"><b>filterport</b></td><td><input class="text" type="text" name="filterport" value="<? io.write( config.filterport.value ) ?>" style="width:100px"></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 class="text" type="text" name="proxyip" value="<? io.write( config.proxyip.value ) ?>" style="width:100px"></td></tr> -<tr><td align="right"><b>proxyport</b></td><td><input class="text" type="text" name="proxyport" value="<? io.write( config.proxyport.value ) ?>" style="width:100px"></td></tr> +<tr><td align="right" style="width:120px;"><b>proxyip</b></td><td><input class="text" type="text" name="proxyip" value="<? io.write( config.proxyip.value ) ?>" style="width:100px"></td></tr> +<tr><td align="right" style="width:120px;"><b>proxyport</b></td><td><input class="text" type="text" name="proxyport" value="<? io.write( config.proxyport.value ) ?>" style="width:100px"></td></tr> </table><br> <h2>Filter Actions</h2> @@ -68,8 +68,8 @@ determines that the content is inappropriate. The "naughtynesslimit" is more sen 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 class="text" type="text" name="accessdeniedaddress" value="<? io.write( config.accessdeniedaddress.value ) ?>" style="width:250px"></td></tr> -<tr><td align="right"><b>naughtynesslimit</b></td><td><input class="text" type="text" name="naughtynesslimit" value="<? io.write( config.naughtynesslimit.value ) ?>" style="width:100px"></td></tr> +<tr><td align="right" style="width:120px;"><b>accessdeniedaddress</b></td><td><input class="text" type="text" name="accessdeniedaddress" value="<? io.write( config.accessdeniedaddress.value ) ?>" style="width:350px"></td></tr> +<tr><td align="right" style="width:120px;"><b>naughtynesslimit</b></td><td><input class="text" type="text" name="naughtynesslimit" value="<? io.write( config.naughtynesslimit.value ) ?>" style="width:100px"></td></tr> </table><br><br> <input class="submit" type="submit" name="cmd" value="save" style="width:100px"><br> diff --git a/dansguardian-plain-html.lsp b/dansguardian-plain-html.lsp index ecc9450..fa79879 100644 --- a/dansguardian-plain-html.lsp +++ b/dansguardian-plain-html.lsp @@ -53,7 +53,7 @@ until you restart the service.<br><br><br> These parameters define the interface and port that Dansguardian uses to accept connections.<br><br> <table> -<tr><td><textarea name="config" style="width:600px"><? io.write( service.config ) ?></textarea></td></tr> +<tr><td><textarea name="config" style="width:100%"><? io.write( service.config ) ?></textarea></td></tr> </table><br> <input class="submit" type="submit" name="cmd" value="save" style="width:100px"><br> diff --git a/squid-basic-html.lsp b/squid-basic-html.lsp index d266d1a..3f55aa5 100644 --- a/squid-basic-html.lsp +++ b/squid-basic-html.lsp @@ -95,8 +95,8 @@ It is safe to leave these values at their default values.<br><br> <table> <tr><td align="right" style="width:80px"><b>Safe_ports</b></td><td><input class="text" type="text" name="safeports" value="<? io.write( config.safeports.value ) ?>" style="width:400px;"></td></tr> <tr><td align="right" style="width:80px"><b>SSL_ports</b></td><td><input class="text" type="text" name="sslports" value="<? io.write( config.sslports.value ) ?>" style="width:400px;"></td></tr> -</table><br> +</table><br><br> -<input class="submit" type="submit" name="cmd" value="save" style="width:100px"><br> +<input class="submit" type="submit" name="cmd" value="save" style="width:100%"><br> </form><br> diff --git a/squid-controller.lua b/squid-controller.lua index c37b05b..84e60dd 100644 --- a/squid-controller.lua +++ b/squid-controller.lua @@ -123,6 +123,83 @@ advanced = function( self ) return ( cfe ({ option = option, service = service }) ) end +digest = 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="" } + + if self.clientdata.cmd then + if self.clientdata.cmd == "save" then + service.message = self.model.update_digest_userlist( self.clientdata.userlist ) + end + end + + service.config = self.model.get_digest_userlist() + + return ( cfe ({ option = option, service = service }) ) +end + +ntlm = 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="" } + if self.clientdata.srvcmd then + local srvcmd = self.clientdata.srvcmd + if srvcmd == "start" or srvcmd == "stop" or srvcmd == "restart" then + service.message = self.model.service_control_winbindd( srvcmd ) + end + end + + if self.clientdata.cmd then + if self.clientdata.cmd == "save" then + service.message = self.model.update_winbindd_config( self.clientdata.config ) + end + end + + service.status = self.model.get_status_winbindd() + service.config = self.model.get_winbindd_config() + + return ( cfe ({ option = option, service = service }) ) +end + +saccess = 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="" } + + if self.clientdata.cmd then + if self.clientdata.cmd == "save" then + local config = {} + config.s_ip = self.clientdata.s_ip + config.s_browser = self.clientdata.s_browser + config.s_domain = self.clientdata.s_domain + service.message = self.model.update_saccess( config ) + end + end + + service.config = self.model.get_saccess() + + return ( cfe ({ option = option, service = service }) ) +end + cfilter = function( self ) local option = { script = ENV["SCRIPT_NAME"], diff --git a/squid-model.lua b/squid-model.lua index 6c272c6..7e7fed7 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -64,6 +64,22 @@ get_status = function() return retval end +get_status_winbindd = function() + + local retval = "stopped" + + local ptr = io.popen( "/bin/pidof winbindd" ) + local pid = ptr:read( "*a" ) + ptr:close() + if pid ~= nil then + if #pid > 1 then + retval = "running" + end + end + + return retval +end + service_control = function( control ) local retval = "" @@ -84,6 +100,47 @@ service_control = function( control ) return retval end +service_control_winbindd = function( control ) + + local retval = "" + + local ptr = io.popen( "/etc/init.d/winbindd " .. control, "r" ) + if ptr ~= nil then + local retmsg = ptr:read( "*a" ) + ptr:close() + if retmsg ~= nil then + retval = retmsg + else + retval = "service_control(): Failed to read output from initscript!\n" + end + else + retval = "service_control(): Failed to start/stop/restart service!\n" + end + + return retval +end + +get_winbindd_config = function() + + local error = "" + local config = { domain = { value="", type="text", label="domain" }, + dcname = { value="", type="text", label="DC NetBIOS name" }, + dcipaddr = { value="", type="text", label="DC IP Address" }, + interfaces = { value="", type="text", label="interfaces" }, + loglevel = { value="", type="text", label="0" }, + account = { value="", type="text", label="account" }, + password = { value="", type="text", label="password" } + } + + local ptr = io.open( "/etc/samba/smb.conf" ) + if ptr ~= nil then + + else + + end + +end + get_adv_config = function() local retval = "" @@ -102,6 +159,71 @@ get_adv_config = function() return retval end +get_digest_userlist = function() + + local retval = "" + + local ptr = io.open( "/etc/squid/users.list" ) + if ptr ~= nil then + local retcfg = ptr:read( "*a" ) + ptr:close() + if retcfg == nil then + retval = "\n\n Error: Failed to read user/password list!\n\n" + else + retval = retcfg + end + end + + return retval +end + +get_saccess = function() + + local config = {} + + config.s_ip = get_file_contents( "/etc/squid/anoniplist" ) + config.s_browser = get_file_contents( "/etc/squid/anonbrowserlist" ) + config.s_domain = get_file_contents( "/etc/squid/anondomainlist" ) + + return config +end + +update_saccess = function( config ) + + write_file_contents( "/etc/squid/anoniplist", config.s_ip ) + write_file_contents( "/etc/squid/anonbrowserlist", config.s_browser ) + write_file_contents( "/etc/squid/anondomainlist", config.s_domain ) + + return +end + +write_file_contents = function( name, contents ) + + local ptr = io.open( name, "wb+" ) + if ptr ~= nil then + ptr:write( format.dostounix( contents ) ) + ptr:close() + end + + return +end + +get_file_contents = function( name ) + + local retval = "" + + local ptr = io.open( name ) + if ptr ~= nil then + retval = ptr:read( "*a" ) + ptr:close() + if retval == nil then + retval = "" + end + end + + return retval +end + update_adv_config = function( config ) local retval = "Successfully updated " .. squidconf .. "!" @@ -117,6 +239,19 @@ update_adv_config = function( config ) return retval end +update_digest_userlist = function( config ) + + local retval = "Successfully updated user list!" + + local ptr = io.open( "/etc/squid/users.list", "wb+" ) + if ptr ~= nil then + ptr:write( format.dostounix( config ) ) + ptr:close() + else + retval = "Update Digest User List: Error, failed to open /etc/squid/users.list!\n" + end +end + get_conf_tag = function( tag, gat ) local retval = "" |