[Top] [Prev] [Next] [Last]
|
|
Chapter 1Basic Administration
This chapter discusses basic server administration tasks, including how to
- start and stop the Stronghold Web Server
- navigate the server directory tree
- use the logs and reports
- track sessions
Starting and Stopping Stronghold
Stronghold Web Server comes with three scripts designed to automate the starting, restarting, and shutting down of your server. All three are located in the ServerRoot/bin/ directory. This section shows you how to run these scripts from the command line. If you decide to customize the scripts or write your own, read the existing scripts carefully before doing so.
Starting Stronghold
# bin/start-server
# bin/decrypt_key hostname
# bin/change_pass hostname
NOTE: The change_pass script encrypts the key after changing the pass phrase. If you were storing the key unencrypted, run decrypt_key again after you run change_pass.
Restarting Stronghold
The reload-server script lets you restart the Stronghold Web Server server in one step:
# bin/reload-server
Shutting Stronghold Down
To shut down the server, simply run the stop-server script:
# bin/stop-server
The Server Directory Tree
Using Logs and Reports
By default, Stronghold Web Server compiles with the modules that implement
- access logs
- error logs
- cipher logs
- custom logs
- server status reports
- server information reports
- agent logs
- referer logs
Access Logs
The access log records the transfer of information between the server and clients, including all client requests and server responses. The default location of your access log is ServerRoot/logs/access_log, but you can change it at any time by editing the TransferLog directive in httpd.conf. The transfer log is configurable, so it can include a flexible variety of information in any order you like.
By default, the transfer log follows the common log format, which contains these fields:
- remote hostname or IP
- basic authentication username (if applicable)
- identd (RFC1413) username (if applicable and enabled)
- date and time
- request
- returned status code
For a full list of status codes and their meanings, see Appendix B.
- bytes sent
mserver42.n-link.com - - [29/Oct/1996:18:17:21 -0800] "GET / HTTP/1.0" 200 2291
207.176.149.181 - - [29/Oct/1996:18:17:21 -0800] "GET /~ic/img/skullt.gif HTTP/1.0" 200 -
proxy5tu1.proxy.ozemail.net - - [29/Oct/1996:18:17:23 -0800] "GET /~pre111/api5.html HTTP/1.0" 200 244
proxy5tu1.proxy.ozemail.net - - [29/Oct/1996:18:17:23 -0800] "GET /~pre111/api6.html HTTP/1.0" 304 -
In this example, none of the transactions involved authentication, so the second and third fields are empty. In the last entry, the server sent a status code of 304 Not Modified, meaning "use local copy," and the body of the message was empty. Therefore, the byte field is empty.
The log configuration directive is LogFormat, which uses a string of variables to set the fields for all log entries. The default log has the following format:
LogFormat "%h %u %l %t \"%r\" %>s %b
To configure the log, you can change the order of the field variables, add static text, or add SSL/TLS field variables. For a complete list of log format variables, see "Custom Logs" on page 1-7.
Error Logs
Stronghold keeps two error logs:
- ServerRoot/logs/error_log records errors that occur during normal transactions. Its location is set with the ErrorLog directive.
- ServerRoot/logs/ssl/error_log records errors that occur during SSL/TLS transactions. Its location is set with the SSLErrorFile directive.
The location of the error log is set during installation, but you can change it at any time by editing the ErrorLog directive in httpd.conf. You can also set this directive to "syslog" to pipe the error logs through syslogd(8), if the system supports it.
Stronghold's error log records two types of errors in two different forms:
- requests that cause the server to return an error-related status code:
[date] error-message
- CGI errors:
location: error-message
tail -f error_log
Cipher Logs
The default location of the cipher log is ServerRoot/logs/ssl/cipher_log. It is set with the SSLLogFile directive. A typical cipher log entry looks like this:
[11/Nov/1997:13:55:42 -0800] SSLv3 RC4-MD5 reused 0 "ok" "/O=C2Net/CN=Sonya L. Jo/[email protected]"
- date, time, and time zone offset (from GMT) at the time of logging
- SSL/TLS version number for this transaction, either "SSLv2," "SSLv3," or "TLSv1"
- cipher used to encrypt this transaction
For a complete list of ciphers support by Stronghold Web Server, see "Controlling Stronghold's Ciphers" on page 2-6.
- "new" or "reused," depending on whether the requested file was newly retrieved or reused from the cache
- verification status code: "0" if verification succeeded
- verification status: "ok" if certificate verification succeeded, and an error message if verification failed
- contents of the Organization, Common Name, and Email fields of the client certificate presented for this transaction
Custom Logs
With the CustomLog directive, you can create multiple logs in custom formats. The value for CustomLog is a path followed by a string of variables or the name of a log format defined by a LogFormat directive. Each variable specifies the content of a log field.
CustomLog logs/customlog %400,501{User-agent}i
CustomLog logs/customlog %!200,304,302{Referer}i
Server Status Reports
- the current date and time
- the date and time when server was last started or restarted
- the server uptime
- the total number of accesses
- the total traffic volume
- the CPU usage
- the average number of requests per second, average volume per second, and average volume per request
- the number of requests currently being processed
- the current number of idle children
- a snapshot of the ScoreBoardFile
Figure 1-1: Server Status Report
The snapshot of the ScoreBoardFile has two parts: a quick summary in ASCII and a detailed report in tabular form. Each character in the quick summary represents one child process. Children represented by a period (.) are unused but available as determined by the MaxSpareServers directive. Children in use are each represented by a code:
Code Description _ waiting for a connection S starting up R reading a request W writing a response K keepalive (waiting) D performing a DNS lookup L logging a transaction The same codes are reflected in the table, which gives the following details about each child:
<Location /stronghold-status>
SetHandler server-status
<Limit GET POST>
order deny,allow
deny from all
allow from .foo.com
</Limit>
</Location>
To access the server status report
- Access http://your.server.name/stronghold-status with a Web browser.
- For an automatically refreshing status report, access the page as http://your.server.name/stronghold-status?refresh=n where n is the number of seconds in a refresh cycle.
- For a machine-readable version of the status file, access http://your.server.name/stronghold-status?auto.
Server Information Reports
- the currently compiled modules
- the server version
- the core server configuration
- the available configuration directives for each module
- the current configuration for each module
- additional information about modules, if configured with AddModuleInfo
Figure 1-2: Server Information Report
Optional Logs
Two optional logs are available:
- Agent logs record the client used for each request, enabling you to track which browsers your visitors are using. You can set it with the AgentLog directive.
- Referer logs show you the links users follow to reach your site, so you can track which sites are linked to yours. You can set it with the RefererLog directive.
Each of these is implemented by a separate module. Keep in mind that you can also implement the same logs using the CustomLog directive, described on page 7-40.
Resetting the Logs
To reset a log file
- Move the old file:
# mv logfile logfile.old
- Restart the server:
# ServerRoot/reload
Tracking Sessions
There are two ways to perform session tracking:
- cookies, which pass session identification information in the HTTP header
- the CGI PATH_INFO variable, which allows session identification information to be encoded in a URL
Session Tracking with Cookies
Cookies provide session tracking capabilities by tagging a series of transactions with an identifying token. The server generates the token in response to an initial request, then sends it to the client in the Set-Cookie header of its HTTP response. For the remainder of the session, the client sends this token in the Cookie header of each request, and the token is available to CGI programs through the HTTP_COOKIE environment variable. CGI programs can use it to recognize requests that belong to the same session.
The Set-Cookie header uses this syntax:
Set-Cookie name=value; expires=date; path=pathname; domain=domain-name; secure
CookieTracking on
CookieExpires 2 weeks 6 hours
Cookie: name=gw427516826238200437
By reading the HTTP_COOKIE environment variable, a program can track related requests and produce dynamic content based on multiple requests over the course of a session.
CustomLog logs/clickstream "%{cookie}i %r %t"
Session Tracking with PATH_INFO
The PATH_INFO variable places a session identification token in the URL, instead of in the response header. The client then uses the GET request method to communicate its token to the server, instead of the Cookie HTTP header. This method accommodates older browsers that do not support cookies, as well as users who do not accept cookies. It also requires some elaborate CGI engineering.
[Top] [Prev] [Next] [Last]
© 1998 C2Net International
Feedback: [email protected]![]()