Online Book Reader

Home Category

Squid_ The Definitive Guide - Duane Wessels [132]

By Root 2054 0
one alongside Squid if you prefer. Keep in mind that the cache manager has only weak security (cleartext passwords). If the HTTP server is on a different host, you need to add its IP address to a cache manager access list (see Section 14.2.2). You may also want to add access controls to the HTTP server so that others can't access cachemgr.cgi.

If you use Apache, I recommend making a special cgi-bin directory so you can protect cachemgr.cgi with access controls. For example, create a new directory, and copy the binary to it:

# mkdir /usr/local/apache/squid-cgi

# cp /usr/local/squid/libexec/cachemgr.cgi /usr/local/apache/squid-cgi

# chmod 755 /usr/local/apache/squid-cgi/cachemgr.cgi

Now, add a ScriptAlias line to Apache's httpd.conf:

ScriptAlias /squid-cgi/ "/usr/local/apache/squid-cgi/"

Finally, create an .htaccess file in the squid-cgi directory that contains access controls. To allow requests from only one IP address, use something like this:

Allow from 192.168.4.2

Deny from all

Once cachemgr.cgi is installed, simply enter the appropriate URL into your web browser. For example:

http://www.server.name/squid-cgi/cachemgr.cgi

If the CGI program is working, you should see a page with four fields. See Figure 14-1 for an example. The Cache Host field contains the name of the host on which Squid is running—localhost by default. You can set it with the —enable-cachemgr-hostname option when running ./configure. Similarly, Cache Port contains the TCP port number to which Squid listens for requests. It's 3128 by default and can be changed with the —enable-cachemgr-port option. The Manager name and Password fields are for access to protected pages, which I'll talk about shortly.

Figure 14-1. The cachemgr.cgi login screen

After clicking on the Continue... button, you should see a list of all cache manager pages currently available. The following section describes the various pages, some of which are available only when you enable certain features at compile time.

Cache Manager Pages

This section describes the cache manager pages, in the same order in which they appear in the menu. Each section title has both the page name (for use with squidclient), followed by its description. Descriptions that contain an asterisk indicate pages that are disabled by default, unless you configure a password for them. Table 14-1 shows the table of contents and the section number for each page.

Table 14-1. Cache manager pages

Short name

Description

leaks

Memory Leak Tracking

mem

Memory Utilization

cbdata

Callback Data Registry Contents

events

Event Queue

squidaio_counts

Async IO Function Counters

diskd

DISKD Stats

config

Current Squid Configuration*

comm_incoming

comm_incoming( ) Stats

ipcache

IP Cache Stats and Contents

fqdncache

FQDN Cache Stats and Contents

idns

Internal DNS Statistics

dns

Dnsserver Statistics

redirector

URL Redirector Stats

basicauthenticator

Basic User Authenticator Stats

digestauthenticator

Digest User Authenticator Stats

ntlmauthenticator

NTLM User Authenticator Stats

external_acl

External ACL Stats

http_headers

HTTP Header Statistics

via_headers

Via Request Headers

forw_headers

X-Forwarded-For Request Headers

menu

This Cache Manager Menu

shutdown

Shut Down the Squid Process*

offline_toggle

Toggle offline_mode Setting*

info

General Runtime Information

filedescriptors

Process File Descriptor Allocation

objects

All Cache Objects

vm_objects

In-Memory and In-Transit Objects

openfd_objects

Objects with Swapout Files Open

io

Server-Side Network read( ) Size Histograms

counters

Traffic and Resource Counters

peer_select

Peer Selection Algorithms

digest_stats

Cache Digest and ICP Blob

5min

5 Minute Average of Counters

60min

60 Minute Average of Counters

utilization

Cache Utilization

histograms

Full Histogram Counts

active_requests

Client-Side Active Requests

store_digest

Store Digest

storedir

Store Directory Stats

store_check_cachable_stats

storeCheckCachable(

Return Main Page Previous Page Next Page

®Online Book Reader