httpd-ssl.conf 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. #
  2. # This is the Apache server configuration file providing SSL support.
  3. # It contains the configuration directives to instruct the server how to
  4. # serve pages over an https connection. For detailed information about these
  5. # directives see <URL:http://httpd.apache.org/docs/2.4/mod/mod_ssl.html>
  6. #
  7. # Do NOT simply read the instructions in here without understanding
  8. # what they do. They're here only as hints or reminders. If you are unsure
  9. # consult the online docs. You have been warned.
  10. #
  11. # Required modules: mod_log_config, mod_setenvif, mod_ssl,
  12. # socache_shmcb_module (for default value of SSLSessionCache)
  13. #
  14. # Pseudo Random Number Generator (PRNG):
  15. # Configure one or more sources to seed the PRNG of the SSL library.
  16. # The seed data should be of good random quality.
  17. # WARNING! On some platforms /dev/random blocks if not enough entropy
  18. # is available. This means you then cannot use the /dev/random device
  19. # because it would lead to very long connection times (as long as
  20. # it requires to make more entropy available). But usually those
  21. # platforms additionally provide a /dev/urandom device which doesn't
  22. # block. So, if available, use this one instead. Read the mod_ssl User
  23. # Manual for more details.
  24. #
  25. #SSLRandomSeed startup file:/dev/random 512
  26. #SSLRandomSeed startup file:/dev/urandom 512
  27. #SSLRandomSeed connect file:/dev/random 512
  28. #SSLRandomSeed connect file:/dev/urandom 512
  29. #
  30. # When we also provide SSL we have to listen to the
  31. # standard HTTP port (see above) and to the HTTPS port
  32. #
  33. Listen 443
  34. ##
  35. ## SSL Global Context
  36. ##
  37. ## All SSL configuration in this context applies both to
  38. ## the main server and all SSL-enabled virtual hosts.
  39. ##
  40. # SSL Cipher Suite:
  41. # List the ciphers that the client is permitted to negotiate,
  42. # and that httpd will negotiate as the client of a proxied server.
  43. # See the OpenSSL documentation for a complete list of ciphers, and
  44. # ensure these follow appropriate best practices for this deployment.
  45. # httpd 2.2.30, 2.4.13 and later force-disable aNULL, eNULL and EXP ciphers,
  46. # while OpenSSL disabled these by default in 0.9.8zf/1.0.0r/1.0.1m/1.0.2a.
  47. SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
  48. SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
  49. # By the end of 2016, only TLSv1.2 ciphers should remain in use.
  50. # Older ciphers should be disallowed as soon as possible, while the
  51. # kRSA ciphers do not offer forward secrecy. These changes inhibit
  52. # older clients (such as IE6 SP2 or IE8 on Windows XP, or other legacy
  53. # non-browser tooling) from successfully connecting.
  54. #
  55. # To restrict mod_ssl to use only TLSv1.2 ciphers, and disable
  56. # those protocols which do not support forward secrecy, replace
  57. # the SSLCipherSuite and SSLProxyCipherSuite directives above with
  58. # the following two directives, as soon as practical.
  59. # SSLCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA
  60. # SSLProxyCipherSuite HIGH:MEDIUM:!SSLv3:!kRSA
  61. # User agents such as web browsers are not configured for the user's
  62. # own preference of either security or performance, therefore this
  63. # must be the prerogative of the web server administrator who manages
  64. # cpu load versus confidentiality, so enforce the server's cipher order.
  65. SSLHonorCipherOrder on
  66. # SSL Protocol support:
  67. # List the protocol versions which clients are allowed to connect with.
  68. # Disable SSLv3 by default (cf. RFC 7525 3.1.1). TLSv1 (1.0) should be
  69. # disabled as quickly as practical. By the end of 2016, only the TLSv1.2
  70. # protocol or later should remain in use.
  71. SSLProtocol all -SSLv3
  72. SSLProxyProtocol all -SSLv3
  73. # Pass Phrase Dialog:
  74. # Configure the pass phrase gathering process.
  75. # The filtering dialog program (`builtin' is an internal
  76. # terminal dialog) has to provide the pass phrase on stdout.
  77. SSLPassPhraseDialog builtin
  78. # Inter-Process Session Cache:
  79. # Configure the SSL Session Cache: First the mechanism
  80. # to use and second the expiring timeout (in seconds).
  81. #SSLSessionCache "dbm:${SRVROOT}/logs/ssl_scache"
  82. SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
  83. SSLSessionCacheTimeout 300
  84. # OCSP Stapling (requires OpenSSL 0.9.8h or later)
  85. #
  86. # This feature is disabled by default and requires at least
  87. # the two directives SSLUseStapling and SSLStaplingCache.
  88. # Refer to the documentation on OCSP Stapling in the SSL/TLS
  89. # How-To for more information.
  90. #
  91. # Enable stapling for all SSL-enabled servers:
  92. #SSLUseStapling On
  93. # Define a relatively small cache for OCSP Stapling using
  94. # the same mechanism that is used for the SSL session cache
  95. # above. If stapling is used with more than a few certificates,
  96. # the size may need to be increased. (AH01929 will be logged.)
  97. #SSLStaplingCache "shmcb:${SRVROOT}/logs/ssl_stapling(32768)"
  98. # Seconds before valid OCSP responses are expired from the cache
  99. #SSLStaplingStandardCacheTimeout 3600
  100. # Seconds before invalid OCSP responses are expired from the cache
  101. #SSLStaplingErrorCacheTimeout 600
  102. ##
  103. ## SSL Virtual Host Context
  104. ##
  105. <VirtualHost _default_:443>
  106. # General setup for the virtual host
  107. DocumentRoot "${SRVROOT}/htdocs"
  108. ServerName www.example.com:443
  109. ServerAdmin admin@example.com
  110. ErrorLog "${SRVROOT}/logs/error.log"
  111. TransferLog "${SRVROOT}/logs/access.log"
  112. # SSL Engine Switch:
  113. # Enable/Disable SSL for this virtual host.
  114. SSLEngine on
  115. # Server Certificate:
  116. # Point SSLCertificateFile at a PEM encoded certificate. If
  117. # the certificate is encrypted, then you will be prompted for a
  118. # pass phrase. Note that a kill -HUP will prompt again. Keep
  119. # in mind that if you have both an RSA and a DSA certificate you
  120. # can configure both in parallel (to also allow the use of DSA
  121. # ciphers, etc.)
  122. # Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
  123. # require an ECC certificate which can also be configured in
  124. # parallel.
  125. SSLCertificateFile "${SRVROOT}/conf/server.crt"
  126. #SSLCertificateFile "${SRVROOT}/conf/server-dsa.crt"
  127. #SSLCertificateFile "${SRVROOT}/conf/server-ecc.crt"
  128. # Server Private Key:
  129. # If the key is not combined with the certificate, use this
  130. # directive to point at the key file. Keep in mind that if
  131. # you've both a RSA and a DSA private key you can configure
  132. # both in parallel (to also allow the use of DSA ciphers, etc.)
  133. # ECC keys, when in use, can also be configured in parallel
  134. SSLCertificateKeyFile "${SRVROOT}/conf/server.key"
  135. #SSLCertificateKeyFile "${SRVROOT}/conf/server-dsa.key"
  136. #SSLCertificateKeyFile "${SRVROOT}/conf/server-ecc.key"
  137. # Server Certificate Chain:
  138. # Point SSLCertificateChainFile at a file containing the
  139. # concatenation of PEM encoded CA certificates which form the
  140. # certificate chain for the server certificate. Alternatively
  141. # the referenced file can be the same as SSLCertificateFile
  142. # when the CA certificates are directly appended to the server
  143. # certificate for convenience.
  144. #SSLCertificateChainFile "${SRVROOT}/conf/server-ca.crt"
  145. # Certificate Authority (CA):
  146. # Set the CA certificate verification path where to find CA
  147. # certificates for client authentication or alternatively one
  148. # huge file containing all of them (file must be PEM encoded)
  149. # Note: Inside SSLCACertificatePath you need hash symlinks
  150. # to point to the certificate files. Use the provided
  151. # Makefile to update the hash symlinks after changes.
  152. #SSLCACertificatePath "${SRVROOT}/conf/ssl.crt"
  153. #SSLCACertificateFile "${SRVROOT}/conf/ssl.crt/ca-bundle.crt"
  154. # Certificate Revocation Lists (CRL):
  155. # Set the CA revocation path where to find CA CRLs for client
  156. # authentication or alternatively one huge file containing all
  157. # of them (file must be PEM encoded).
  158. # The CRL checking mode needs to be configured explicitly
  159. # through SSLCARevocationCheck (defaults to "none" otherwise).
  160. # Note: Inside SSLCARevocationPath you need hash symlinks
  161. # to point to the certificate files. Use the provided
  162. # Makefile to update the hash symlinks after changes.
  163. #SSLCARevocationPath "${SRVROOT}/conf/ssl.crl"
  164. #SSLCARevocationFile "${SRVROOT}/conf/ssl.crl/ca-bundle.crl"
  165. #SSLCARevocationCheck chain
  166. # Client Authentication (Type):
  167. # Client certificate verification type and depth. Types are
  168. # none, optional, require and optional_no_ca. Depth is a
  169. # number which specifies how deeply to verify the certificate
  170. # issuer chain before deciding the certificate is not valid.
  171. #SSLVerifyClient require
  172. #SSLVerifyDepth 10
  173. # TLS-SRP mutual authentication:
  174. # Enable TLS-SRP and set the path to the OpenSSL SRP verifier
  175. # file (containing login information for SRP user accounts).
  176. # Requires OpenSSL 1.0.1 or newer. See the mod_ssl FAQ for
  177. # detailed instructions on creating this file. Example:
  178. # "openssl srp -srpvfile ${SRVROOT}/conf/passwd.srpv -add username"
  179. #SSLSRPVerifierFile "${SRVROOT}/conf/passwd.srpv"
  180. # Access Control:
  181. # With SSLRequire you can do per-directory access control based
  182. # on arbitrary complex boolean expressions containing server
  183. # variable checks and other lookup directives. The syntax is a
  184. # mixture between C and Perl. See the mod_ssl documentation
  185. # for more details.
  186. #<Location />
  187. #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
  188. # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
  189. # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
  190. # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
  191. # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
  192. # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
  193. #</Location>
  194. # SSL Engine Options:
  195. # Set various options for the SSL engine.
  196. # o FakeBasicAuth:
  197. # Translate the client X.509 into a Basic Authorisation. This means that
  198. # the standard Auth/DBMAuth methods can be used for access control. The
  199. # user name is the `one line' version of the client's X.509 certificate.
  200. # Note that no password is obtained from the user. Every entry in the user
  201. # file needs this password: `xxj31ZMTZzkVA'.
  202. # o ExportCertData:
  203. # This exports two additional environment variables: SSL_CLIENT_CERT and
  204. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  205. # server (always existing) and the client (only existing when client
  206. # authentication is used). This can be used to import the certificates
  207. # into CGI scripts.
  208. # o StdEnvVars:
  209. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  210. # Per default this exportation is switched off for performance reasons,
  211. # because the extraction step is an expensive operation and is usually
  212. # useless for serving static content. So one usually enables the
  213. # exportation for CGI and SSI requests only.
  214. # o StrictRequire:
  215. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  216. # under a "Satisfy any" situation, i.e. when it applies access is denied
  217. # and no other module can change it.
  218. # o OptRenegotiate:
  219. # This enables optimized SSL connection renegotiation handling when SSL
  220. # directives are used in per-directory context.
  221. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  222. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  223. SSLOptions +StdEnvVars
  224. </FilesMatch>
  225. <Directory "${SRVROOT}/cgi-bin">
  226. SSLOptions +StdEnvVars
  227. </Directory>
  228. # SSL Protocol Adjustments:
  229. # The safe and default but still SSL/TLS standard compliant shutdown
  230. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  231. # the close notify alert from client. When you need a different shutdown
  232. # approach you can use one of the following variables:
  233. # o ssl-unclean-shutdown:
  234. # This forces an unclean shutdown when the connection is closed, i.e. no
  235. # SSL close notify alert is sent or allowed to be received. This violates
  236. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  237. # this when you receive I/O errors because of the standard approach where
  238. # mod_ssl sends the close notify alert.
  239. # o ssl-accurate-shutdown:
  240. # This forces an accurate shutdown when the connection is closed, i.e. a
  241. # SSL close notify alert is send and mod_ssl waits for the close notify
  242. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  243. # practice often causes hanging connections with brain-dead browsers. Use
  244. # this only for browsers where you know that their SSL implementation
  245. # works correctly.
  246. # Notice: Most problems of broken clients are also related to the HTTP
  247. # keep-alive facility, so you usually additionally want to disable
  248. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  249. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  250. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  251. # "force-response-1.0" for this.
  252. BrowserMatch "MSIE [2-5]" \
  253. nokeepalive ssl-unclean-shutdown \
  254. downgrade-1.0 force-response-1.0
  255. # Per-Server Logging:
  256. # The home of a custom SSL log file. Use this when you want a
  257. # compact non-error SSL logfile on a virtual host basis.
  258. CustomLog "${SRVROOT}/logs/ssl_request.log" \
  259. "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
  260. </VirtualHost>