]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Documented cachemgr.cgi purpose and configuration
authorserassio <>
Sat, 30 Apr 2005 21:30:57 +0000 (21:30 +0000)
committerserassio <>
Sat, 30 Apr 2005 21:30:57 +0000 (21:30 +0000)
Extended cachemgr.conf syntax to allow wilcard port specifications

Forward port of 2.5 changes

doc/Makefile.am
doc/cachemgr.cgi.8.in [new file with mode: 0755]
doc/squid.8.in [moved from doc/squid.8 with 80% similarity, mode: 0755]
src/cachemgr.cc
src/cachemgr.conf

index 2848d906987720ec1a46137e92cf6ad557806683..641b5a593daf7f1d96ffb09cb006fbbfc7763e25 100644 (file)
@@ -1,14 +1,38 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.3 2003/01/23 00:34:53 robertc Exp $
+#  $Id: Makefile.am,v 1.4 2005/04/30 15:30:57 serassio Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
 
+DEFAULT_CONFIG_FILE = $(sysconfdir)/squid.conf
+DEFAULT_CACHEMGR_CONFIG = $(sysconfdir)/cachemgr.conf
+DEFAULT_MIME_TABLE      = $(sysconfdir)/mime.conf
+DEFAULT_ERROR_DIR       = $(datadir)/errors/@ERR_DEFAULT_LANGUAGE@
+
+SUBSTITUTE=sed "\
+       s%@DEFAULT_CONFIG_FILE@%$(DEFAULT_CONFIG_FILE)%g;\
+       s%@DEFAULT_CACHEMGR_CONFIG@%$(DEFAULT_CACHEMGR_CONFIG)%g;\
+       s%@DEFAULT_ERROR_DIR@%$(DEFAULT_ERROR_DIR)%g;\
+       s%@DEFAULT_MIME_TABLE@%$(DEFAULT_MIME_TABLE)%g;\
+       "
+
+squid.8: squid.8.in Makefile
+       $(SUBSTITUTE) < $< > $@
+
+cachemgr.cgi.8: cachemgr.cgi.8.in Makefile
+       $(SUBSTITUTE) < $< > $@
+
 man_MANS = \
-       squid.8
+       squid.8 \
+       cachemgr.cgi.8
 
 EXTRA_DIST = \
-       squid.8 \
+       squid.8.in \
+       cachemgr.cgi.8.in \
        debug-sections.txt
+
+CLEANFILES = \
+       squid.8 \
+       cachemgr.cgi.8
diff --git a/doc/cachemgr.cgi.8.in b/doc/cachemgr.cgi.8.in
new file mode 100755 (executable)
index 0000000..0a2cdc3
--- /dev/null
@@ -0,0 +1,49 @@
+.TH cachemgr.cgi 8 "squid version 3.0"
+.\" Copyright and licensing information
+.\" goes here.
+.SH NAME
+cachemgr.cgi \- squid HTTP proxy manager interface
+.SH SYNOPSIS
+.B http://your.server/cgi-bin/cachemgr.cgi
+.SH DESCRIPTION
+The cache manager (cachemgr.cgi) is a CGI utility for displaying statistics
+about the Squid HTTP proxy process as it runs. The cache manager is a
+convenient way to manage the cache and view statistics without logging
+into the server.
+.SH FILES
+.I ./cachemgr.conf
+.br
+.I @DEFAULT_CACHEMGR_CONFIG@
+.RS
+The access configuration file defining which Squid servers may
+be managed via this cachemgr.cgi program. Each line specifies a
+.BR server : port
+followed by an optional description
+.P
+The server name may contain shell wildcard characters such as *, [] etc.
+A quick selection dropdown menu is automatically constructed from the simple
+server names.
+.P
+Specifying :port is optional. If not specified then
+the default proxy port is assumed. :* or :any matches
+any port on the target server.
+.RE
+.SH SECURITY
+cachemgr.cgi calls the requested server on the requested port using HTTP
+and returns a formatted version of the response. To avoid abuse it is
+recommended to configure your web server to restrict access to the
+cachemgr.cgi program.
+.P
+Configuration examples for many common web servers can be found in the
+Squid FAQ.
+.SH SEE ALSO
+.BR squid "(8)"
+.br
+.BR "The Squid FAQ" ", Chapter 9 The Cache Manager"
+.\" Could add the following sections:
+.\" .SH ENVIRONMENT
+.\" .SH DIAGNOSTICS
+.\" .SH BUGS
+.\" .SH AUTHOR
+.\" .SH SEE ALSO
+
old mode 100644 (file)
new mode 100755 (executable)
similarity index 80%
rename from doc/squid.8
rename to doc/squid.8.in
index 813fb6b..87b5ef0
@@ -6,10 +6,8 @@ squid \- proxy caching server
 .SH SYNOPSIS
 .B squid
 [
-.B \-dhvzCDFNRVYX
+.B \-dhsvzCDFNRVYX
 ] [
-.B \-s
-|
 .BI \-l " facility"
 ] [
 .BI \-f " config-file"
@@ -58,9 +56,8 @@ This manual page only lists the command line arguments.  For details
 on how to configure
 .B squid
 see the file 
-.BI /etc/squid/squid.conf,
-the FAQ included with the distribution
-and the documentation at the
+.BI @DEFAULT_CONFIG_FILE@,
+the Squid FAQ and the documentation at the
 .B squid
 home page http://www.squid-cache.org
 .PP
@@ -71,7 +68,7 @@ Specify HTTP port number (default: 3128).
 Write debugging to stderr also.
 .IP "-f file"
 Use the given config-file instead of
-.IR /etc/squid/squid.conf .
+.IR @DEFAULT_CONFIG_FILE@ .
 If the file name starts with a ! or | then it is assumed to be an external
 command or command line. Can for example be used to pre-process the
 configuration before it is being read by Squid. To facilitate this Squid
@@ -81,8 +78,10 @@ Print help message.
 .IP "-k reconfigure | rotate | shutdown | interrupt | kill | debug | check | parse"
 Parse configuration file, then send signal to running copy 
 (except -k parse) and exit.
-.IP "-s | -l facility"
+.IP -s
 Enable logging to syslog.
+.IP "-l facility"
+Use specified syslog facility. implies -s
 .IP "-u port"
 Specify ICP port number (default: 3130), disable with 0.
 .IP -v
@@ -106,13 +105,42 @@ Force full debugging.
 .IP -Y
 Only return UDP_HIT or UDP_MISS_NOFETCH during fast reload.   
 .SH FILES
-.I /etc/squid/squid.conf
+.I @DEFAULT_CONFIG_FILE@
 .RS
 The main configuration file.  You must initially make 
 changes to this file for 
 .B squid
 to work.  For example, the default configuration does not 
 allow access from any browser.
+.RE
+
+.I @DEFAULT_CONFIG_FILE@.default
+.RS
+Reference copy of the configuration file. Always kept up to date with
+the version of Squid you are using. Use this to look up configuration
+syntax after upgrading.
+.RE
+
+.I @DEFAULT_MIME_TABLE@ (mime_table)
+.RS
+MIME type mappings for FTP gatewaying
+.RE
+
+.I @DEFAULT_ERROR_DIR@ (error_directory)
+.RS
+Error page templates
+.RE
+
+.SH SEE ALSO
+.BR cachemgr.cgi "(8), "
+.BR pam_auth "(8), "
+.BR squid_ldap_auth "(8), "
+.BR squid_ldap_group "(8), "
+.BR squid_unix_group "(8), "
+.br
+.B The Squid FAQ
+
+
 
 .\" Could add the following sections:
 .\" .SH ENVIRONMENT
index 3ebc7152d70204d3984060a7e1a53b2b5531c100..f8910a09e5e90cff59895a77e902eb8c1241d184 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.109 2005/04/23 20:40:51 serassio Exp $
+ * $Id: cachemgr.cc,v 1.110 2005/04/30 15:30:57 serassio Exp $
  *
  * DEBUG: section 0     CGI Cache Manager
  * AUTHOR: Duane Wessels
 #include "snprintf.h"
 
 #ifndef DEFAULT_CACHEMGR_CONFIG
-#define DEFAULT_CACHEMGR_CONFIG "/etc/squid/cahemgr.conf"
+#define DEFAULT_CACHEMGR_CONFIG "/etc/squid/cachemgr.conf"
 #endif
 
 typedef struct
@@ -1181,10 +1181,16 @@ check_target_acl(const char *hostname, int port) {
         if ((token = strtok(NULL, ":")) != NULL) {
             int i;
 
-            if (sscanf(token, "%d", &i) != 1)
+            if (strcmp(token, "*") == 0)
+
+                ;   /* Wildcard port specification */
+            else if (strcasecmp(token, "any") == 0)
+
+                ;   /* Wildcard port specification */
+            else if (sscanf(token, "%d", &i) != 1)
                 continue;
 
-            if (i != port)
+            else if (i != port)
                 continue;
         } else if (port != CACHE_HTTP_PORT)
             continue;
index b7a2937aa4eb7f626a159a90bc3d0caf8d62cb5a..17805138b6347bb5406684f23fb2f534c9ed0b56 100755 (executable)
@@ -5,7 +5,8 @@
 #   hostname:port  description
 #
 # Specifying :port is optional. If not specified then
-# the default proxy port is assumed.
+# the default proxy port is assumed. :* or :any matches
+# any port on the target server.
 #
 # hostname is matched using shell filename matching, allowing
 # * and other shell wildcards.