|
|
af9b8b |
#
|
|
|
af9b8b |
# When we also provide SSL we have to listen to the
|
|
|
af9b8b |
# the HTTPS port in addition.
|
|
|
af9b8b |
#
|
|
|
af9b8b |
Listen 443 https
|
|
|
af9b8b |
|
|
|
af9b8b |
##
|
|
|
af9b8b |
## SSL Global Context
|
|
|
af9b8b |
##
|
|
|
af9b8b |
## All SSL configuration in this context applies both to
|
|
|
af9b8b |
## the main server and all SSL-enabled virtual hosts.
|
|
|
af9b8b |
##
|
|
|
af9b8b |
|
|
|
af9b8b |
# Pass Phrase Dialog:
|
|
|
af9b8b |
# Configure the pass phrase gathering process.
|
|
|
af9b8b |
# The filtering dialog program (`builtin' is a internal
|
|
|
af9b8b |
# terminal dialog) has to provide the pass phrase on stdout.
|
|
|
af9b8b |
SSLPassPhraseDialog builtin
|
|
|
af9b8b |
|
|
|
af9b8b |
# Inter-Process Session Cache:
|
|
|
af9b8b |
# Configure the SSL Session Cache: First the mechanism
|
|
|
af9b8b |
# to use and second the expiring timeout (in seconds).
|
|
|
af9b8b |
SSLSessionCache shmcb:$localstatedir/run/httpd/sslcache(512000)
|
|
|
af9b8b |
SSLSessionCacheTimeout 300
|
|
|
af9b8b |
|
|
|
af9b8b |
# Pseudo Random Number Generator (PRNG):
|
|
|
af9b8b |
# Configure one or more sources to seed the PRNG of the
|
|
|
af9b8b |
# SSL library. The seed data should be of good random quality.
|
|
|
af9b8b |
# WARNING! On some platforms /dev/random blocks if not enough entropy
|
|
|
af9b8b |
# is available. This means you then cannot use the /dev/random device
|
|
|
af9b8b |
# because it would lead to very long connection times (as long as
|
|
|
af9b8b |
# it requires to make more entropy available). But usually those
|
|
|
af9b8b |
# platforms additionally provide a /dev/urandom device which doesn't
|
|
|
af9b8b |
# block. So, if available, use this one instead. Read the mod_ssl User
|
|
|
af9b8b |
# Manual for more details.
|
|
|
af9b8b |
SSLRandomSeed startup file:/dev/urandom 256
|
|
|
af9b8b |
SSLRandomSeed connect builtin
|
|
|
af9b8b |
#SSLRandomSeed startup file:/dev/random 512
|
|
|
af9b8b |
#SSLRandomSeed connect file:/dev/random 512
|
|
|
af9b8b |
#SSLRandomSeed connect file:/dev/urandom 512
|
|
|
af9b8b |
|
|
|
af9b8b |
#
|
|
|
af9b8b |
# Use "SSLCryptoDevice" to enable any supported hardware
|
|
|
af9b8b |
# accelerators. Use "openssl engine -v" to list supported
|
|
|
af9b8b |
# engine names. NOTE: If you enable an accelerator and the
|
|
|
af9b8b |
# server does not start, consult the error logs and ensure
|
|
|
af9b8b |
# your accelerator is functioning properly.
|
|
|
af9b8b |
#
|
|
|
af9b8b |
SSLCryptoDevice builtin
|
|
|
af9b8b |
#SSLCryptoDevice ubsec
|
|
|
af9b8b |
|
|
|
af9b8b |
##
|
|
|
af9b8b |
## SSL Virtual Host Context
|
|
|
af9b8b |
##
|
|
|
af9b8b |
|
|
|
af9b8b |
<VirtualHost _default_:443>
|
|
|
af9b8b |
|
|
|
af9b8b |
# General setup for the virtual host, inherited from global configuration
|
|
|
af9b8b |
#DocumentRoot "/var/www/html"
|
|
|
af9b8b |
#ServerName www.example.com:443
|
|
|
af9b8b |
|
|
|
af9b8b |
# Use separate log files for the SSL virtual host; note that LogLevel
|
|
|
af9b8b |
# is not inherited from httpd.conf.
|
|
|
af9b8b |
ErrorLog logs/ssl_error_log
|
|
|
af9b8b |
TransferLog logs/ssl_access_log
|
|
|
af9b8b |
LogLevel warn
|
|
|
af9b8b |
|
|
|
af9b8b |
# SSL Engine Switch:
|
|
|
af9b8b |
# Enable/Disable SSL for this virtual host.
|
|
|
af9b8b |
SSLEngine on
|
|
|
af9b8b |
|
|
|
af9b8b |
# SSL Protocol support:
|
|
|
af9b8b |
# List the enable protocol levels with which clients will be able to
|
|
|
af9b8b |
# connect. Disable SSLv2 access by default:
|
|
|
af9b8b |
SSLProtocol all -SSLv2
|
|
|
af9b8b |
|
|
|
af9b8b |
# SSL Cipher Suite:
|
|
|
af9b8b |
# List the ciphers that the client is permitted to negotiate.
|
|
|
af9b8b |
# See the mod_ssl documentation for a complete list.
|
|
|
af9b8b |
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
|
|
|
af9b8b |
|
|
|
af9b8b |
# Speed-optimized SSL Cipher configuration:
|
|
|
af9b8b |
# If speed is your main concern (on busy HTTPS servers e.g.),
|
|
|
af9b8b |
# you might want to force clients to specific, performance
|
|
|
af9b8b |
# optimized ciphers. In this case, prepend those ciphers
|
|
|
af9b8b |
# to the SSLCipherSuite list, and enable SSLHonorCipherOrder.
|
|
|
af9b8b |
# Caveat: by giving precedence to RC4-SHA and AES128-SHA
|
|
|
af9b8b |
# (as in the example below), most connections will no longer
|
|
|
af9b8b |
# have perfect forward secrecy - if the server's key is
|
|
|
af9b8b |
# compromised, captures of past or future traffic must be
|
|
|
af9b8b |
# considered compromised, too.
|
|
|
af9b8b |
#SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
|
|
|
af9b8b |
#SSLHonorCipherOrder on
|
|
|
af9b8b |
|
|
|
af9b8b |
# Server Certificate:
|
|
|
af9b8b |
# Point SSLCertificateFile at a PEM encoded certificate. If
|
|
|
af9b8b |
# the certificate is encrypted, then you will be prompted for a
|
|
|
af9b8b |
# pass phrase. Note that a kill -HUP will prompt again. A new
|
|
|
af9b8b |
# certificate can be generated using the genkey(1) command.
|
|
|
af9b8b |
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
|
|
|
af9b8b |
|
|
|
af9b8b |
# Server Private Key:
|
|
|
af9b8b |
# If the key is not combined with the certificate, use this
|
|
|
af9b8b |
# directive to point at the key file. Keep in mind that if
|
|
|
af9b8b |
# you've both a RSA and a DSA private key you can configure
|
|
|
af9b8b |
# both in parallel (to also allow the use of DSA ciphers, etc.)
|
|
|
af9b8b |
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
|
|
|
af9b8b |
|
|
|
af9b8b |
# Server Certificate Chain:
|
|
|
af9b8b |
# Point SSLCertificateChainFile at a file containing the
|
|
|
af9b8b |
# concatenation of PEM encoded CA certificates which form the
|
|
|
af9b8b |
# certificate chain for the server certificate. Alternatively
|
|
|
af9b8b |
# the referenced file can be the same as SSLCertificateFile
|
|
|
af9b8b |
# when the CA certificates are directly appended to the server
|
|
|
af9b8b |
# certificate for convinience.
|
|
|
af9b8b |
#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt
|
|
|
af9b8b |
|
|
|
af9b8b |
# Certificate Authority (CA):
|
|
|
af9b8b |
# Set the CA certificate verification path where to find CA
|
|
|
af9b8b |
# certificates for client authentication or alternatively one
|
|
|
af9b8b |
# huge file containing all of them (file must be PEM encoded)
|
|
|
af9b8b |
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
|
|
|
af9b8b |
|
|
|
af9b8b |
# Client Authentication (Type):
|
|
|
af9b8b |
# Client certificate verification type and depth. Types are
|
|
|
af9b8b |
# none, optional, require and optional_no_ca. Depth is a
|
|
|
af9b8b |
# number which specifies how deeply to verify the certificate
|
|
|
af9b8b |
# issuer chain before deciding the certificate is not valid.
|
|
|
af9b8b |
#SSLVerifyClient require
|
|
|
af9b8b |
#SSLVerifyDepth 10
|
|
|
af9b8b |
|
|
|
af9b8b |
# Access Control:
|
|
|
af9b8b |
# With SSLRequire you can do per-directory access control based
|
|
|
af9b8b |
# on arbitrary complex boolean expressions containing server
|
|
|
af9b8b |
# variable checks and other lookup directives. The syntax is a
|
|
|
af9b8b |
# mixture between C and Perl. See the mod_ssl documentation
|
|
|
af9b8b |
# for more details.
|
|
|
af9b8b |
#<Location />
|
|
|
af9b8b |
#SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
|
|
|
af9b8b |
# and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
|
|
|
af9b8b |
# and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
|
|
|
af9b8b |
# and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
|
|
|
af9b8b |
# and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
|
|
|
af9b8b |
# or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
|
|
|
af9b8b |
#</Location>
|
|
|
af9b8b |
|
|
|
af9b8b |
# SSL Engine Options:
|
|
|
af9b8b |
# Set various options for the SSL engine.
|
|
|
af9b8b |
# o FakeBasicAuth:
|
|
|
af9b8b |
# Translate the client X.509 into a Basic Authorisation. This means that
|
|
|
af9b8b |
# the standard Auth/DBMAuth methods can be used for access control. The
|
|
|
af9b8b |
# user name is the `one line' version of the client's X.509 certificate.
|
|
|
af9b8b |
# Note that no password is obtained from the user. Every entry in the user
|
|
|
af9b8b |
# file needs this password: `xxj31ZMTZzkVA'.
|
|
|
af9b8b |
# o ExportCertData:
|
|
|
af9b8b |
# This exports two additional environment variables: SSL_CLIENT_CERT and
|
|
|
af9b8b |
# SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
|
|
|
af9b8b |
# server (always existing) and the client (only existing when client
|
|
|
af9b8b |
# authentication is used). This can be used to import the certificates
|
|
|
af9b8b |
# into CGI scripts.
|
|
|
af9b8b |
# o StdEnvVars:
|
|
|
af9b8b |
# This exports the standard SSL/TLS related `SSL_*' environment variables.
|
|
|
af9b8b |
# Per default this exportation is switched off for performance reasons,
|
|
|
af9b8b |
# because the extraction step is an expensive operation and is usually
|
|
|
af9b8b |
# useless for serving static content. So one usually enables the
|
|
|
af9b8b |
# exportation for CGI and SSI requests only.
|
|
|
af9b8b |
# o StrictRequire:
|
|
|
af9b8b |
# This denies access when "SSLRequireSSL" or "SSLRequire" applied even
|
|
|
af9b8b |
# under a "Satisfy any" situation, i.e. when it applies access is denied
|
|
|
af9b8b |
# and no other module can change it.
|
|
|
af9b8b |
# o OptRenegotiate:
|
|
|
af9b8b |
# This enables optimized SSL connection renegotiation handling when SSL
|
|
|
af9b8b |
# directives are used in per-directory context.
|
|
|
af9b8b |
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
|
|
|
af9b8b |
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
|
|
|
af9b8b |
SSLOptions +StdEnvVars
|
|
|
af9b8b |
</Files>
|
|
|
af9b8b |
<Directory "/var/www/cgi-bin">
|
|
|
af9b8b |
SSLOptions +StdEnvVars
|
|
|
af9b8b |
</Directory>
|
|
|
af9b8b |
|
|
|
af9b8b |
# SSL Protocol Adjustments:
|
|
|
af9b8b |
# The safe and default but still SSL/TLS standard compliant shutdown
|
|
|
af9b8b |
# approach is that mod_ssl sends the close notify alert but doesn't wait for
|
|
|
af9b8b |
# the close notify alert from client. When you need a different shutdown
|
|
|
af9b8b |
# approach you can use one of the following variables:
|
|
|
af9b8b |
# o ssl-unclean-shutdown:
|
|
|
af9b8b |
# This forces an unclean shutdown when the connection is closed, i.e. no
|
|
|
af9b8b |
# SSL close notify alert is send or allowed to received. This violates
|
|
|
af9b8b |
# the SSL/TLS standard but is needed for some brain-dead browsers. Use
|
|
|
af9b8b |
# this when you receive I/O errors because of the standard approach where
|
|
|
af9b8b |
# mod_ssl sends the close notify alert.
|
|
|
af9b8b |
# o ssl-accurate-shutdown:
|
|
|
af9b8b |
# This forces an accurate shutdown when the connection is closed, i.e. a
|
|
|
af9b8b |
# SSL close notify alert is send and mod_ssl waits for the close notify
|
|
|
af9b8b |
# alert of the client. This is 100% SSL/TLS standard compliant, but in
|
|
|
af9b8b |
# practice often causes hanging connections with brain-dead browsers. Use
|
|
|
af9b8b |
# this only for browsers where you know that their SSL implementation
|
|
|
af9b8b |
# works correctly.
|
|
|
af9b8b |
# Notice: Most problems of broken clients are also related to the HTTP
|
|
|
af9b8b |
# keep-alive facility, so you usually additionally want to disable
|
|
|
af9b8b |
# keep-alive for those clients, too. Use variable "nokeepalive" for this.
|
|
|
af9b8b |
# Similarly, one has to force some clients to use HTTP/1.0 to workaround
|
|
|
af9b8b |
# their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
|
|
|
af9b8b |
# "force-response-1.0" for this.
|
|
|
af9b8b |
BrowserMatch "MSIE [2-5]" \
|
|
|
af9b8b |
nokeepalive ssl-unclean-shutdown \
|
|
|
af9b8b |
downgrade-1.0 force-response-1.0
|
|
|
af9b8b |
|
|
|
af9b8b |
# Per-Server Logging:
|
|
|
af9b8b |
# The home of a custom SSL log file. Use this when you want a
|
|
|
af9b8b |
# compact non-error SSL logfile on a virtual host basis.
|
|
|
af9b8b |
CustomLog logs/ssl_request_log \
|
|
|
af9b8b |
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
|
|
|
af9b8b |
|
|
|
af9b8b |
</VirtualHost>
|
|
|
af9b8b |
|