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