summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-05-05 15:44:37 +0000
committerMika Havela <mika.havela@gmail.com>2008-05-05 15:44:37 +0000
commit1b8bad95d1204e4f3f90bfe4f212870d09c44918 (patch)
tree67fc5130f8dae4d489876f444ad682e7cffe6eca
parentea937c7c3628041c298289c3859a95a63ba09f47 (diff)
downloadacf-squid-1b8bad95d1204e4f3f90bfe4f212870d09c44918.tar.bz2
acf-squid-1b8bad95d1204e4f3f90bfe4f212870d09c44918.tar.xz
Moved around the information on the view-files to reflect the same layout as other ACF's.
Added information on autostart sequence. Fetch programversion the same way as other acf's do (apk_version -v). git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@1102 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--squid-advanced-html.lsp46
-rw-r--r--squid-authentication-html.lsp53
-rw-r--r--squid-basic-html.lsp80
-rw-r--r--squid-controller.lua27
-rw-r--r--squid-digest-html.lsp5
-rw-r--r--squid-model.lua62
-rw-r--r--squid-saccess-html.lsp10
7 files changed, 161 insertions, 122 deletions
diff --git a/squid-advanced-html.lsp b/squid-advanced-html.lsp
index 328680e..1d933b0 100644
--- a/squid-advanced-html.lsp
+++ b/squid-advanced-html.lsp
@@ -1,4 +1,6 @@
<?
+require("viewfunctions")
+
local form = ...
local data = form.option
local service = form.service
@@ -11,8 +13,17 @@
end
?>
-<h1>Web Proxy Configuration</h1>
-<p>
+<H1>SYSTEM INFO</H1>
+<DL>
+<?
+local myform = form.info
+local tags = { "status", "version", "autostart", }
+displayinfo(myform,tags,"viewonly")
+?>
+</DL>
+
+
+<h1>Advanced configuration</h1>
<dl>
<dt>Warning</dt>
<dd class="attention">
@@ -20,35 +31,28 @@
You must be familiar with the configuration file before proceeding.
</dd>
</dl>
-</p>
-<p></p>
-<h2>Status</h2>
+<h2>Configuration</h2>
<form action="" method="POST">
+<textarea name="config"><? io.write( service.config ) ?></textarea>
+
+<h3>Save Changes</h3>
<dl>
-<dt>Program version</dt><dd><? io.write( form.info.version.value ) ?></dd>
-<dt>Process status</dt><dd><? io.write( form.info.status.value ) ?></dd>
+<dt>Save the contents of the box above</dt><dd><input class="submit" type="submit" name="cmd" value="save"></dd>
<dt>Process information</dt><dd>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.</dd>
-<dt>Daemon control</dt>
-<dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>></dd>
</dl>
</form>
-<p>
-<pre class="attention"><? io.write( service.message ) ?></pre>
-</p>
-
-<h2>Configuration</h2>
+<h1>MANAGEMENT</h1>
<form action="" method="POST">
-<textarea name="config"><? io.write( service.config ) ?></textarea>
-<p></p>
-<h3>Save Changes</h3>
<dl>
-<dt>Save the contents of the box above</dt><dd><input class="submit" type="submit" name="cmd" value="save"></dd>
+<DT>Daemon control</DT>
+<dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>>
+<pre class="attention"><? io.write( service.message ) ?></pre></dd>
</dl>
-<p></p>
</form>
+
diff --git a/squid-authentication-html.lsp b/squid-authentication-html.lsp
index fcf8164..e3eac32 100644
--- a/squid-authentication-html.lsp
+++ b/squid-authentication-html.lsp
@@ -1,4 +1,6 @@
<?
+require("viewfunctions")
+
local form = ...
local data = form.option
local service = form.service
@@ -18,7 +20,16 @@
end
?>
-<h1>Web Proxy</h1>
+
+<H1>SYSTEM INFO</H1>
+<DL>
+<?
+local myform = form.info
+local tags = { "status", "version", "autostart", }
+displayinfo(myform,tags,"viewonly")
+?>
+</DL>
+
<h2>General Information</h2>
<p>
Squid is a web proxy server. It makes web requests in behalf of the client, and
@@ -31,27 +42,9 @@ such as DansGuardian.
This page lets you modify the authentication scheme of squid.
</p>
-<h2>Status</h2>
-<dt>Program version</dt><dd><? io.write( form.info.version.value ) ?></dd>
-<dt>Process status</dt><dd><? io.write( form.info.status.value ) ?></dd>
-<dt>Process information</dt><dd>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.</dd>
-<form action="" method="POST">
-<dt>Daemon control</dt>
-<dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>></dd>
-</form>
-
-<p>
-<pre class="attention"><? io.write( service.message ) ?></pre>
-</p>
-
+<h1>Configuration</h1>
+<h2>Authentication Scheme</h2>
<form action="" method="POST">
-<h2>Configuration</h2>
-
-<h3>Authentication Scheme</h3>
<p>
Choose the desired authentication mechanisms and their order.
</p>
@@ -110,6 +103,22 @@ Choose the desired authentication mechanisms and their order.
</select>
</td>
</tr>
-</table><br>
+</table>
+<h2>Information</h2>
+<DL>
+<dt>Process information</dt><dd>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.</dd>
+</DL>
</form>
+<h1>MANAGEMENT</h1>
+<form action="" method="POST">
+<dl>
+<DT>Daemon control</DT>
+<dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>>
+<pre class="attention"><? io.write( service.message ) ?></pre></dd>
+</dl>
+</form>
diff --git a/squid-basic-html.lsp b/squid-basic-html.lsp
index e92c3cd..ab96ea8 100644
--- a/squid-basic-html.lsp
+++ b/squid-basic-html.lsp
@@ -1,4 +1,6 @@
<?
+require("viewfunctions")
+
local form = ...
local data = form.option
local service = form.service
@@ -18,7 +20,16 @@
end
?>
-<h1>Web Proxy</h1>
+
+<H1>SYSTEM INFO</H1>
+<DL>
+<?
+local myform = form.info
+local tags = { "status", "version", "autostart", }
+displayinfo(myform,tags,"viewonly")
+?>
+</DL>
+
<H2>General information</H2>
<p>
Squid is a web proxy server. It makes web requests in behalf of the client, and
@@ -28,39 +39,20 @@ web surfing faster. Squid can also forward its requests on to a content filter,
such as DansGuardian.</p>
<p>This page determines the general operational settings for squid.</p><p></p>
-<h2>Status</h2>
+<h1>Configuration</h1>
<form action="" method="POST">
-<dl>
-<dt>Program version</dt><DD><? io.write( form.info.version.value ) ?></DD>
-<dt>Process status</dt><DD><? io.write( form.info.status.value ) ?></DD>
-<DT>Process information</DT><DD>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.</DD>
-<DT>Daemon control</DT><dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
-<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>></dd>
-</dl>
-<p class="error"><? io.write( service.message ) ?></p>
-</form>
-
-<p></p>
+<h2>Primary Listener service</h2>
+<p>These parameters define the interface and port that the web proxy uses to accept connections.</p>
-<h2>Configuration</h2>
-<form action="" method="POST">
<dl>
-<DT>Config status</DT><DD class="error"><? io.write(service.error ) ?></DD>
+<dt>proxyip</dt>
+<dd><input class="text" type="text" name="proxyip" value="<? io.write( config.proxyip.value ) ?>"></dd>
+<dt>proxyport</dt>
+<dd><input class="text" type="text" name="proxyport" value="<? io.write( config.proxyport.value ) ?>"></dd>
</dl>
-<p></p>
-<h3>Primary Listener service</h3>
-<p>These parameters define the interface and port that the web proxy uses to accept connections.</p>
-
-<dl><dt>proxyip</dt><dd><input class="text" type="text" name="proxyip" value="<? io.write( config.proxyip.value ) ?>"></dd></dl>
-<dl><dt>proxyport</dt><dd><input class="text" type="text" name="proxyport" value="<? io.write( config.proxyport.value ) ?>"></dd></dl>
-
-<p></p>
-<h3>Filter Service</h3>
+<h2>Filter Service</h2>
<p>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.</p>
@@ -74,8 +66,7 @@ It is safe to leave this at the default settings.</p>
<dt>FilterRegex</dt><dd><input class="text" type="text" name="filterregex" value="<? io.write( config.filterregex.value ) ?>"></dd>
</dl>
-<p></p>
-<h3>Access Logs</h3>
+<h2>Access Logs</h2>
<p>This determines if the visited sites are logged or not.</p>
<dl>
<dt>Log visited sites</dt>
@@ -83,8 +74,7 @@ It is safe to leave this at the default settings.</p>
<input type="radio" name="accesslog" value="yes"<? ifthen( config.accesslog.value, "yes", " checked" ); ?>> Use access log</dd>
</dl>
-<p></p>
-<h3>Disk Cache Parameters</h3>
+<h2>Disk Cache Parameters</h2>
<p>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.</p>
@@ -94,22 +84,38 @@ but it requires a local hard disk.</p>
<input class="radio" type="radio" name="diskcache" value="yes"<? ifthen( config.diskcache.value, "yes", " checked" ); ?>>Yes</dd>
</dl>
-<p></p>
-<h3>Allowed Ports</h3>
+<h2>Allowed Ports</h2>
<p>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.</p>
-
<p>It is safe to leave these values at their default values.</p>
<dl>
-<dt>Safe_ports</dt><dd><input class="text" type="text" name="safeports" value="<? io.write( config.safeports.value ) ?>></dd>
+<dt>Safe_ports</dt><dd><input class="text" type="text" name="safeports" value="<? io.write( config.safeports.value ) ?>"></dd>
<dt>SSL_ports</dt><dd><input class="text" type="text" name="sslports" value="<? io.write( config.sslports.value ) ?>"></dd>
</dl>
-<p></p>
<h2>Save changes</h2>
<dl>
<DT>Save above changes</DT><DD><input class="submit" type="submit" name="cmd" value="save"></DD>
+<? if #service.error > 0 then ?>
+<DT>Config status</DT><DD class="error"><? io.write(service.error ) ?></DD>
+<? end ?>
+<DT>Process information</DT><DD>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.</DD>
+
</dl>
</form>
+
+<h1>MANAGEMENT</h1>
+
+<form action="" method="POST">
+<dl>
+<DT>Daemon control</DT><dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
+<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>>
+<? if #service.message > 0 then ?><pre><? io.write( service.message ) ?></pre><? end ?></dd>
+</dl>
+</form>
+
diff --git a/squid-controller.lua b/squid-controller.lua
index ebc6133..8ffe0cb 100644
--- a/squid-controller.lua
+++ b/squid-controller.lua
@@ -22,7 +22,12 @@ end
basic = function( self )
- local info = { status = { value = "stopped" }, version = { value = self.model.get_squid_version() }, srvctrl = { value = srvctrl} };
+ local info = {
+ status=self.model.get_status(),
+ version = self.model.get_squid_version(),
+ autostart = self.model.get_autostart(),
+ srvctrl = { value = srvctrl}
+ }
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
@@ -63,7 +68,7 @@ basic = function( self )
end
service.status = self.model.get_status()
- info.status.value = service.status;
+-- info.status.value = service.status;
service.config, service.error = self.model.get_basic_config()
return ( cfe ({ option = option, service = service, info = info }) )
@@ -71,7 +76,12 @@ end
authentication = function( self )
- local info = { status = { value = "stopped" }, version = { value = self.model.get_squid_version() }, srvctrl = { value = srvctrl} };
+ local info = {
+ status=self.model.get_status(),
+ version = self.model.get_squid_version(),
+ autostart = self.model.get_autostart(),
+ srvctrl = { value = srvctrl}
+ }
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
@@ -110,7 +120,7 @@ authentication = function( self )
end
service.status = self.model.get_status()
- info.status.value = service.status
+-- info.status.value = service.status
service.config, service.error = self.model.get_basic_config()
return ( cfe ({ option = option, service = service, info = info }) )
@@ -118,7 +128,12 @@ end
advanced = function( self )
- local info = { status = { value = "stopped" }, version = { value = self.model.get_squid_version() }, srvctrl = { value = srvctrl} };
+ local info = {
+ status=self.model.get_status(),
+ version = self.model.get_squid_version(),
+ autostart = self.model.get_autostart(),
+ srvctrl = { value = srvctrl}
+ }
local option = { script = ENV["SCRIPT_NAME"],
prefix = self.conf.prefix,
@@ -142,7 +157,7 @@ advanced = function( self )
end
service.status = self.model.get_status()
- info.status.value = service.status
+-- info.status.value = service.status
service.config = self.model.get_adv_config()
return ( cfe ({ option = option, service = service, info = info }) )
diff --git a/squid-digest-html.lsp b/squid-digest-html.lsp
index 9c9e9a3..b41ecde 100644
--- a/squid-digest-html.lsp
+++ b/squid-digest-html.lsp
@@ -18,11 +18,12 @@
This list is active only for digest authentication. If you are using NTLM authentication, all domain users are
allowed to use the web proxy.
</p>
-<p></p>
<h2>User List</h2>
<form action="" method="POST">
<textarea name="userlist"><? io.write( service.config ) ?></textarea>
-<p></p>
+
<h3>Save Changes</h3>
+<DL>
<dt>Save the contents of the box above</dt><dd><input class="submit" type="submit" name="cmd" value="save"></dd>
+</DL>
</form>
diff --git a/squid-model.lua b/squid-model.lua
index 11dc7d0..e2b9285 100644
--- a/squid-model.lua
+++ b/squid-model.lua
@@ -2,10 +2,16 @@
-- Copyright(c) 2007 A. Brodmann - Licensed under terms of GPL2
module (..., package.seeall)
-require "format"
+-- Load libraries
+require("format")
+require("processinfo")
+require("procps")
-squidconf = "/etc/squid/squid.conf"
-squidtempl = "/etc/squid/squid.conf.template"
+-- Set variables
+local squidconf = "/etc/squid/squid.conf"
+local squidtempl = "/etc/squid/squid.conf.template"
+local processname = "squid"
+local packagename = "squid"
--- the tokenizer functions - must be dislocated into a library later
tokenizer = {}
@@ -50,33 +56,37 @@ end
---
get_status = function()
-
- local retval = "stopped"
-
- local ptr = io.popen( "/bin/pidof squid" )
- local pid = ptr:read( "*a" )
- ptr:close()
- if pid ~= nil then
- if #pid > 1 then
- retval = "running"
- end
+ local t = procps.pidof(procname)
+ local stats
+ if (t) and (#t > 0) then
+ stats = "Enabled"
+ else
+ stats = "Disabled"
end
-
+ local retval = cfe({ name="status",
+ label="Program status",
+ value=stats,
+ })
return retval
end
get_squid_version = function()
+ local value, errtxt = processinfo.package_version(packagename)
+ local retval = cfe({ name = "version",
+ label="Program version",
+ value=value,
+ errtxt=errtxt,
+ })
+ return retval
+end
- local retval = ""
-
- local ptr = io.popen( "/usr/sbin/squid -v" )
- if ptr ~= nil then
- retval = ptr:read( "*l" )
- ptr:close()
- else
- retval = "Error - can't retrieve squid version"
- end
-
+get_autostart = function()
+ local autostart_sequense, autostart_errtxt = processinfo.process_botsequence(processname)
+ local retval = cfe({ name="autostart",
+ label="Autostart sequence",
+ value=autostart_sequense,
+ errtxt=autostart_errtxt,
+ })
return retval
end
@@ -97,14 +107,14 @@ end
get_status_winbindd = function()
- local retval = "stopped"
+ local retval = "Disabled"
local ptr = io.popen( "/bin/pidof winbindd" )
local pid = ptr:read( "*a" )
ptr:close()
if pid ~= nil then
if #pid > 1 then
- retval = "running"
+ retval = "Enabled"
end
end
diff --git a/squid-saccess-html.lsp b/squid-saccess-html.lsp
index 64ac5c4..b864d1f 100644
--- a/squid-saccess-html.lsp
+++ b/squid-saccess-html.lsp
@@ -22,15 +22,12 @@
</p>
<form action="" method="POST">
-<p></p>
<h2>Special IP Addresses</h2>
<p>
If you wish to specify hosts that may access the Internet by IP address,
enter the address(es) in the box below, one per line.
</p>
-<p>
<textarea name="s_ip"><? io.write( service.config.s_ip ) ?></textarea>
-</p>
<h2>Browser Identification</h2>
<p>
@@ -39,9 +36,7 @@ specify it here. Note that any client identifying itself as this type
of browser will be allowed anonymous access. Enter the browser identification(s)
in the box below, one per line. Regular expressions are allowed.
</p>
-<p>
<textarea name="s_browser"><? io.write( service.config.s_browser ) ?></textarea>
-</p>
<h2>Special Domains</h2>
<p>
@@ -49,11 +44,10 @@ If you have a specail domain that needs to be accessed in a special way, you
may specify if here. This will allow anonymous access to the domains listed.
Enter the domain url below. Regular expressions are allowed.
</p>
-<p>
<textarea name="s_domain"><? io.write( service.config.s_domain ) ?></textarea>
-</p>
-<p></p>
<h3>Save Changes</h3>
+<dl>
<dt>Save changes of the above boxes</dt><dd><input class="submit" type="submit" name="cmd" value="save"></dd>
+</dl>
</form>