Saltstack Official Apache Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
9.5KB

  1. # Managed by saltstack
  2. LoadModule ssl_module libexec/apache24/mod_ssl.so
  3. <IfModule mod_ssl.c>
  4. #
  5. # Pseudo Random Number Generator (PRNG):
  6. # Configure one or more sources to seed the PRNG of the SSL library.
  7. # The seed data should be of good random quality.
  8. # WARNING! On some platforms /dev/random blocks if not enough entropy
  9. # is available. This means you then cannot use the /dev/random device
  10. # because it would lead to very long connection times (as long as
  11. # it requires to make more entropy available). But usually those
  12. # platforms additionally provide a /dev/urandom device which doesn't
  13. # block. So, if available, use this one instead. Read the mod_ssl User
  14. # Manual for more details.
  15. #
  16. SSLRandomSeed startup builtin
  17. SSLRandomSeed startup file:/dev/urandom 512
  18. SSLRandomSeed connect builtin
  19. SSLRandomSeed connect file:/dev/urandom 512
  20. ##
  21. ## SSL Global Context
  22. ##
  23. ## All SSL configuration in this context applies both to
  24. ## the main server and all SSL-enabled virtual hosts.
  25. ##
  26. #
  27. # Some MIME-types for downloading Certificates and CRLs
  28. #
  29. AddType application/x-x509-ca-cert .crt
  30. AddType application/x-pkcs7-crl .crl
  31. # Pass Phrase Dialog:
  32. # Configure the pass phrase gathering process.
  33. # The filtering dialog program (`builtin' is a internal
  34. # terminal dialog) has to provide the pass phrase on stdout.
  35. SSLPassPhraseDialog builtin
  36. # Inter-Process Session Cache:
  37. # Configure the SSL Session Cache: First the mechanism
  38. # to use and second the expiring timeout (in seconds).
  39. #SSLSessionCache dbm:${APACHE_RUN_DIR}/ssl_scache
  40. SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000)
  41. SSLSessionCacheTimeout 300
  42. # Semaphore:
  43. # Configure the path to the mutual exclusion semaphore the
  44. # SSL engine uses internally for inter-process synchronization.
  45. <IfVersion < 2.4>
  46. SSLMutex file:${APACHE_RUN_DIR}/ssl_mutex
  47. </IfVersion>
  48. # SSL Cipher Suite:
  49. # List the ciphers that the client is permitted to negotiate.
  50. # See the mod_ssl documentation for a complete list.
  51. # enable only secure ciphers:
  52. #SSLCipherSuite HIGH:MEDIUM:!ADH
  53. SSLCipherSuite EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
  54. # Mitigate the CRIME attack
  55. #SSLCompression off
  56. # Use this instead if you want to allow cipher upgrades via SGC facility.
  57. # In this case you also have to use something like
  58. # SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
  59. # see http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html.en#upgradeenc
  60. #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
  61. # enable only secure protocols: SSLv3 and TLSv1, but not SSLv2
  62. SSLProtocol all -SSLv2 -SSLv3
  63. SSLHonorCipherOrder On
  64. # (bettercrypto.org)
  65. # Add six earth month HSTS header for all users...
  66. Header add Strict-Transport-Security "max-age=15768000"
  67. # If you want to protect all subdomains, use the following header
  68. # ALL subdomains HAVE TO support HTTPS if you use this!
  69. # Strict-Transport-Security: max-age=15768000 ; includeSubDomains
  70. # SSL Engine Switch:
  71. # Enable/Disable SSL for this virtual host.
  72. SSLEngine on
  73. SSLOptions +StrictRequire
  74. # A self-signed (snakeoil) certificate can be created by installing
  75. # the ssl-cert package. See
  76. # /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
  77. # If both key and certificate are stored in the same file, only the
  78. # SSLCertificateFile directive is needed.
  79. SSLCertificateFile {{ salt['pillar.get']('apache:ssl:default_cert', '/usr/local/etc/apache24/server.crt') }}
  80. SSLCertificateKeyFile {{ salt['pillar.get']('apache:ssl:default_key', '/usr/local/etc/apache24/server.key') }}
  81. # Server Certificate Chain:
  82. # Point SSLCertificateChainFile at a file containing the
  83. # concatenation of PEM encoded CA certificates which form the
  84. # certificate chain for the server certificate. Alternatively
  85. # the referenced file can be the same as SSLCertificateFile
  86. # when the CA certificates are directly appended to the server
  87. # certificate for convinience.
  88. #SSLCertificateChainFile /usr/local/etc/apache24/ssl.crt/server-ca.crt
  89. # Certificate Authority (CA):
  90. # Set the CA certificate verification path where to find CA
  91. # certificates for client authentication or alternatively one
  92. # huge file containing all of them (file must be PEM encoded)
  93. # Note: Inside SSLCACertificatePath you need hash symlinks
  94. # to point to the certificate files. Use the provided
  95. # Makefile to update the hash symlinks after changes.
  96. #SSLCACertificatePath /etc/ssl/certs/
  97. #SSLCACertificateFile /usr/local/etc/apache24/ssl.crt/ca-bundle.crt
  98. # Certificate Revocation Lists (CRL):
  99. # Set the CA revocation path where to find CA CRLs for client
  100. # authentication or alternatively one huge file containing all
  101. # of them (file must be PEM encoded)
  102. # Note: Inside SSLCARevocationPath you need hash symlinks
  103. # to point to the certificate files. Use the provided
  104. # Makefile to update the hash symlinks after changes.
  105. #SSLCARevocationPath /usr/local/etc/apache24/ssl.crl/
  106. #SSLCARevocationFile /usr/local/etc/apache24/ssl.crl/ca-bundle.crl
  107. # Client Authentication (Type):
  108. # Client certificate verification type and depth. Types are
  109. # none, optional, require and optional_no_ca. Depth is a
  110. # number which specifies how deeply to verify the certificate
  111. # issuer chain before deciding the certificate is not valid.
  112. #SSLVerifyClient require
  113. #SSLVerifyDepth 10
  114. # Access Control:
  115. # With SSLRequire you can do per-directory access control based
  116. # on arbitrary complex boolean expressions containing server
  117. # variable checks and other lookup directives. The syntax is a
  118. # mixture between C and Perl. See the mod_ssl documentation
  119. # for more details.
  120. #<Location />
  121. #SSLRequire ( %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
  122. # and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
  123. # and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
  124. # and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
  125. # and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20 ) \
  126. # or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
  127. #</Location>
  128. # SSL Engine Options:
  129. # Set various options for the SSL engine.
  130. # o FakeBasicAuth:
  131. # Translate the client X.509 into a Basic Authorisation. This means that
  132. # the standard Auth/DBMAuth methods can be used for access control. The
  133. # user name is the `one line' version of the client's X.509 certificate.
  134. # Note that no password is obtained from the user. Every entry in the user
  135. # file needs this password: `xxj31ZMTZzkVA'.
  136. # o ExportCertData:
  137. # This exports two additional environment variables: SSL_CLIENT_CERT and
  138. # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
  139. # server (always existing) and the client (only existing when client
  140. # authentication is used). This can be used to import the certificates
  141. # into CGI scripts.
  142. # o StdEnvVars:
  143. # This exports the standard SSL/TLS related `SSL_*' environment variables.
  144. # Per default this exportation is switched off for performance reasons,
  145. # because the extraction step is an expensive operation and is usually
  146. # useless for serving static content. So one usually enables the
  147. # exportation for CGI and SSI requests only.
  148. # o StrictRequire:
  149. # This denies access when "SSLRequireSSL" or "SSLRequire" applied even
  150. # under a "Satisfy any" situation, i.e. when it applies access is denied
  151. # and no other module can change it.
  152. # o OptRenegotiate:
  153. # This enables optimized SSL connection renegotiation handling when SSL
  154. # directives are used in per-directory context.
  155. #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
  156. <FilesMatch "\.(cgi|shtml|phtml|php)$">
  157. SSLOptions +StdEnvVars
  158. </FilesMatch>
  159. <Directory /usr/lib/cgi-bin>
  160. SSLOptions +StdEnvVars
  161. </Directory>
  162. # SSL Protocol Adjustments:
  163. # The safe and default but still SSL/TLS standard compliant shutdown
  164. # approach is that mod_ssl sends the close notify alert but doesn't wait for
  165. # the close notify alert from client. When you need a different shutdown
  166. # approach you can use one of the following variables:
  167. # o ssl-unclean-shutdown:
  168. # This forces an unclean shutdown when the connection is closed, i.e. no
  169. # SSL close notify alert is send or allowed to received. This violates
  170. # the SSL/TLS standard but is needed for some brain-dead browsers. Use
  171. # this when you receive I/O errors because of the standard approach where
  172. # mod_ssl sends the close notify alert.
  173. # o ssl-accurate-shutdown:
  174. # This forces an accurate shutdown when the connection is closed, i.e. a
  175. # SSL close notify alert is send and mod_ssl waits for the close notify
  176. # alert of the client. This is 100% SSL/TLS standard compliant, but in
  177. # practice often causes hanging connections with brain-dead browsers. Use
  178. # this only for browsers where you know that their SSL implementation
  179. # works correctly.
  180. # Notice: Most problems of broken clients are also related to the HTTP
  181. # keep-alive facility, so you usually additionally want to disable
  182. # keep-alive for those clients, too. Use variable "nokeepalive" for this.
  183. # Similarly, one has to force some clients to use HTTP/1.0 to workaround
  184. # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
  185. # "force-response-1.0" for this.
  186. BrowserMatch "MSIE [2-6]" \
  187. nokeepalive ssl-unclean-shutdown \
  188. downgrade-1.0 force-response-1.0
  189. # MSIE 7 and newer should be able to use keepalive
  190. BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
  191. </IfModule>