Apache-SSL's directives follow, with a small section at the end of the chapter concerning CGIs.
SSLDisable Server config, virtual host
Disable SSL. This directive is useful if you wish to run both secure and nonsecure hosts on the same server. Conversely, SSL can be enabled with SSLEnable.
SSLEnable Server config, virtual host
Enable SSL. The default; but if you've used SSLDisable in the main server, you can enable SSL again for virtual hosts using this directive.
SSLRequireSSL Server config, .htaccess, virtual host, directory
Require SSL. This can be used in <Directory> sections (and elsewhere) to protect against inadvertently disabling SSL. If SSL is not in use when this directive applies, access will be refused. This is a useful belt-and-suspenders measure for critical information.
SSLCacheServerPath filename Server config
This directive specifies the path to the global cache server, gcache. It can be absolute or relative to the server root.
SSLCacheServerRunDir directory Server config
Sets the directory in which gcache runs, so that it can produce core dumps during debugging.
SSLCacheServerPort file|port Server config
The cache server can use either TCP/IP or Unix domain sockets. If the file or port argument is a number, then a TCP/IP port at that number is used; otherwise, it is assumed to be the path to use for a Unix domain socket.
SSLSessionCacheTimeout time_in_seconds Server config, virtual host
A session key is generated when a client connects to the server for the first time. This directive sets the length of time in seconds that the session key will be cached locally. Lower values are safer (an attacker then has a limited time to crack the key before a new one will be used) but also slower, because the key will be regenerated at each timeout. If client certificates are being requested by the server, they will also be required to be re-presented at each timeout. For many purposes, timeouts measured in hours are perfectly safe, for example:
SSLCACertificatePath directory Server config, virtual host
This directive specifies the path to the directory where you keep the certificates of the certification authorities whose client certificates you are prepared to accept. They must be PEM encoded.
SSLCACertificateFile filename Server config, virtual host
If you only accept client certificates from a single CA, then you can use this directive instead of SSLCACertificatePath to specify a single PEM-encoded (according to SSLeay) certificate file.
SSLCertificateFile filename Config outside <Directory> or <Location> blocks
This is your PEM-encoded certificate. It is encoded with distinguished encoding rules (DER), and is ASCII-armored so it will go over the Web. If the certificate is encrypted, you are prompted for a passphrase.
SSLCertificateKeyFile filename Config outside <Directory> or <Location> blocks
This is the private key of your PEM-encoded certificate. If the key is not combined with the certificate, use this directive to point at the key file. If the filename starts with "/", it specifies an absolute path; otherwise, it is relative to the default certificate area, which is currently defined by SSLeay to be either /usr/local/ssl/ private or <wherever you told ssl to install>/private. Examples:
SSLCertificateKeyFile /usr/local/apache/certs/my.server.key.pem SSLCertificateKeyFile certs/my.server.key.pem
SSLVerifyClient level Default: 0 Server config, virtual host
This directive defines what you require of clients:
- 0: No certificate required.
- 1: The client may present a valid certificate.
- 2: The client must present a valid certificate.
- 3: The client may present a valid certificate, but not necessarily from a certification authority for which the server holds a certificate.
SSLVerifyDepth depth Server config, virtual host
In real life, the certificate we are dealing with was issued by a CA, who in turn relied on another CA for validation, and so on, back to a root certificate. This directive specifies how far up or down the chain we are prepared to go before giving up. What happens when we give up is determined by the setting given to SSLVerifyClient. Normally, you only trust certificates signed directly by a CA you've authorized, so this should be set to 1.
SSLFakeBasicAuth Server config, virtual host
This directive makes Apache pretend that the user has been logged in using basic authentication (see Chapter 5, Authentication), except that instead of the username you get the one-line X509, a version of the client's certificate. If you switch this on, along with SSLVerifyClient, you should see the results in one of the logs. The code adds a predefined password.
CustomLog nickname Server config, virtual host
CustomLog is a standard Apache directive (see Chapter 11, What's Going On?)to which Apache-SSL adds some extra categories that can be logged:
- The name of the cipher being used for this connection.
- The one-line version of the certificate presented by the client.
- If the client certificate verification failed, this is the SSLeay error code. In the case of success, a "-" will be logged.
- This is the SSLeay string corresponding to the error code.
- The version of SSL being used. If you are using SSLeay versions prior to 0.9.0, then this is simply a number: 2 for SSL2 or 3 for SSL3. For SSLeay version 0.9.0 and later, it is a string, currently one of "SSL2," "SSL3," or "TLS1."
Obsolete -- do not use.
The SSL protocol does not restrict clients and servers to a single encryption brew for the secure exchange of information. There are a number of possible cryptographic ingredients, but as in any cookpot, some ingredients go better together than others. The seriously interested can refer to Bruce Schneier's Applied Crytography ( John Wiley & Sons), in conjunction with the SSL specification (from Netscape). The list of cipher suites is in the SSLeay software at ... /ssl/ssl.h. The macro names give a better idea of what is meant than the text strings.
For most purposes, the webmaster does not have to bother with all this, but some of the following directives need entries from this list.
SSLRequiredCiphers cipher list Server config, virtual host
This directive specifies a colon-separated list of cipher suites, used by SSLeay to limit what the client end can do. Possible suites are listed in the preceding section. This is a per-server option:
SSLRequireCipher cipher list Server config, virtual host, .htaccess, directory
This directive specifies a space-separated list of cipher suites, used to verify the cipher after the connection is established. This is a per-directory option.
SSLBanCipher <cipher list> Config, virtual, .htaccess, directory
This directive specifies a space-separated list of cipher suites, as per SSLRequire-Cipher, except it bans them. The logic is as follows: if banned, reject; if required, accept; if no required ciphers are listed, accept. For example:
SSLBanCipher NULL-MD5 NULL-SHA
It is sensible to ban these suites because they are test suites that actually do no encryption.
SSL and CGI
One directive affects the writing of CGIs.
SSLExportClientCertificates Server config, virtual host, .htaccess, directory
Exports client certificates and the chain behind them to CGIs. The certificates are base 64 encoded in the environment variables SSL_CLIENT_CERT and SSL_CLIENT_CERT_CHAIN_n, where n runs from 1 up. This directive is only enabled if APACHE_SSL_EXPORT_CERTS is set to TRUE in .../src/include/buff.h.