From: serassio <> Date: Sat, 30 Apr 2005 21:30:57 +0000 (+0000) Subject: Documented cachemgr.cgi purpose and configuration X-Git-Tag: SQUID_3_0_PRE4~789 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b4ee1908dd6e58348ea1abb2f6c9077fe16584eb;p=thirdparty%2Fsquid.git Documented cachemgr.cgi purpose and configuration Extended cachemgr.conf syntax to allow wilcard port specifications Forward port of 2.5 changes --- diff --git a/doc/Makefile.am b/doc/Makefile.am index 2848d90698..641b5a593d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 index 0000000000..0a2cdc3749 --- /dev/null +++ b/doc/cachemgr.cgi.8.in @@ -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 + diff --git a/doc/squid.8 b/doc/squid.8.in old mode 100644 new mode 100755 similarity index 80% rename from doc/squid.8 rename to doc/squid.8.in index 813fb6b9c3..87b5ef0167 --- a/doc/squid.8 +++ b/doc/squid.8.in @@ -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 diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 3ebc7152d7..f8910a09e5 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -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 @@ -135,7 +135,7 @@ #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; diff --git a/src/cachemgr.conf b/src/cachemgr.conf index b7a2937aa4..17805138b6 100755 --- a/src/cachemgr.conf +++ b/src/cachemgr.conf @@ -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.