]> TLD Linux GIT Repositories - packages/apache.git/blob - apache-mod_ssl.conf
cc1a2a2e07ef9d60001213af5558358fc4f17824
[packages/apache.git] / apache-mod_ssl.conf
1 LoadModule ssl_module   modules/mod_ssl.so
2
3 # This is the Apache server configuration file providing SSL support.
4 # It contains the configuration directives to instruct the server how to
5 # serve pages over an https connection. For detailing information about these
6 # directives see <URL:http://httpd.apache.org/docs/2.2/mod/mod_ssl.html>
7
8 <IfModule mod_ssl.c>
9 #
10 # Pseudo Random Number Generator (PRNG):
11 # Configure one or more sources to seed the PRNG of the SSL library.
12 # The seed data should be of good random quality.
13 # WARNING! On some platforms /dev/random blocks if not enough entropy
14 # is available. This means you then cannot use the /dev/random device
15 # because it would lead to very long connection times (as long as
16 # it requires to make more entropy available). But usually those
17 # platforms additionally provide a /dev/urandom device which doesn't
18 # block. So, if available, use this one instead. Read the mod_ssl User
19 # Manual for more details.
20 #
21
22 SSLRandomSeed startup file:/dev/urandom  256
23 SSLRandomSeed connect builtin
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
31 #
32 # When we also provide SSL we have to listen to the
33 # standard HTTP port (see above) and to the HTTPS port
34 #
35 # Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
36 #          Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
37 #
38 Listen 443
39
40 ##
41 ##  SSL Global Context
42 ##
43 ##  All SSL configuration in this context applies both to
44 ##  the main server and all SSL-enabled virtual hosts.
45 ##
46
47 #   Pass Phrase Dialog:
48 #   Configure the pass phrase gathering process.
49 #   The filtering dialog program (`builtin' is a internal
50 #   terminal dialog) has to provide the pass phrase on stdout.
51 SSLPassPhraseDialog  builtin
52
53 #   Inter-Process Session Cache:
54 #   Configure the SSL Session Cache: First the mechanism
55 #   to use and second the expiring timeout (in seconds).
56 #SSLSessionCache                 dbm:/var/cache/httpd/ssl_scache
57 #SSLSessionCache                shmcb:/var/run/ssl_scache(512000)
58 SSLSessionCache         shmcb:/var/cache/httpd/ssl_scache(512000)
59 SSLSessionCacheTimeout  300
60
61 # FOLLOW SECURE DEFAULTS: https://wiki.mozilla.org/Security/Server_Side_TLS
62
63 #   Usable SSL protocol flavors:
64 #   This directive can be used to control the SSL protocol flavors mod_ssl
65 #   should use when establishing its server environment. Clients then can only
66 #   connect with one of the provided protocols.
67 SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
68
69 #   SSL Cipher Suite:
70 #   List the ciphers that the client is permitted to negotiate.
71 #   See the mod_ssl documentation for a complete list.
72 SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!CAMELLIA128:!AES128:!RSA
73 SSLHonorCipherOrder on
74 SSLCompression off
75 SSLSessionTickets off
76
77 #   Use this command to generate 4096 DH parameters (it will take long time):
78 #   openssl dhparam -out /etc//httpd/ssl/dhparams.pem 4096
79 #   When finished, uncomment line below
80 #SSLOpenSSLConfCmd DHParameters /etc/httpd/ssl/dhparams.pem
81
82 SSLOpenSSLConfCmd ECDHParameters secp384r1
83 SSLOpenSSLConfCmd Curves secp521r1:secp384r1
84
85 Header always set Strict-Transport-Security max-age=31556952;includeSubDomains
86 Header always set X-Frame-Options SAMEORIGIN
87 Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
88 Header always set X-Content-Type-Options nosnif
89
90 # OCSP Stapling
91 SSLUseStapling          on
92 SSLStaplingResponderTimeout 5
93 SSLStaplingReturnResponderErrors off
94 SSLStaplingCache        shmcb:/var/cache/httpd/ocsp(128000)
95
96 # Whether to allow non-SNI clients to access a name-based virtual host.
97 #SSLStrictSNIVHostCheck on
98
99 ##
100 ## SSL Virtual Host Context
101 ##
102
103 <VirtualHost _default_:443>
104 #   SSL Engine Switch:
105 #   Enable/Disable SSL for this virtual host.
106 SSLEngine on
107
108 # Enable, if you have real ssl cert and want to cache OCSP
109 # https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
110 SSLUseStapling          off
111
112 #   Server Certificate:
113 #   Point SSLCertificateFile at a PEM encoded certificate.  If
114 #   the certificate is encrypted, then you will be prompted for a
115 #   pass phrase.  Note that a kill -HUP will prompt again.  Keep
116 #   in mind that if you have both an RSA and a DSA certificate you
117 #   can configure both in parallel (to also allow the use of DSA
118 #   ciphers, etc.)
119 SSLCertificateFile /etc/httpd/ssl/server.crt
120 #SSLCertificateFile /etc/httpd/ssl/server-dsa.crt
121
122 #   Server Private Key:
123 #   If the key is not combined with the certificate, use this
124 #   directive to point at the key file.  Keep in mind that if
125 #   you've both a RSA and a DSA private key you can configure
126 #   both in parallel (to also allow the use of DSA ciphers, etc.)
127 SSLCertificateKeyFile /etc/httpd/ssl/server.key
128 #SSLCertificateKeyFile /etc/httpd/ssl/server-dsa.key
129
130 #   Server Certificate Chain:
131 #   Point SSLCertificateChainFile at a file containing the
132 #   concatenation of PEM encoded CA certificates which form the
133 #   certificate chain for the server certificate. Alternatively
134 #   the referenced file can be the same as SSLCertificateFile
135 #   when the CA certificates are directly appended to the server
136 #   certificate for convinience.
137 #SSLCertificateChainFile /etc/httpd/ssl/ca.crt
138
139 #   Certificate Authority (CA):
140 #   Set the CA certificate verification path where to find CA
141 #   certificates for client authentication or alternatively one
142 #   huge file containing all of them (file must be PEM encoded)
143 #   Note: Inside SSLCACertificatePath you need hash symlinks
144 #                to point to the certificate files. Use the provided
145 #                Makefile to update the hash symlinks after changes.
146 #SSLCACertificatePath /etc/httpd/ssl
147 #SSLCACertificateFile /etc/httpd/ssl/ca-bundle.crt
148
149 #   Certificate Revocation Lists (CRL):
150 #   Set the CA revocation path where to find CA CRLs for client
151 #   authentication or alternatively one huge file containing all
152 #   of them (file must be PEM encoded)
153 #   Note: Inside SSLCARevocationPath you need hash symlinks
154 #                to point to the certificate files. Use the provided
155 #                Makefile to update the hash symlinks after changes.
156 #SSLCARevocationPath /etc/httpd/ssl
157 #SSLCARevocationFile /etc/httpd/ssl/ca-bundle.crl
158
159 #   Client Authentication (Type):
160 #   Client certificate verification type and depth.  Types are
161 #   none, optional, require and optional_no_ca.  Depth is a
162 #   number which specifies how deeply to verify the certificate
163 #   issuer chain before deciding the certificate is not valid.
164 #SSLVerifyClient require
165 #SSLVerifyDepth  10
166
167 #   Access Control:
168 #   With SSLRequire you can do per-directory access control based
169 #   on arbitrary complex boolean expressions containing server
170 #   variable checks and other lookup directives.  The syntax is a
171 #   mixture between C and Perl.  See the mod_ssl documentation
172 #   for more details.
173 #<Location />
174 #SSLRequire (   %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
175 #                       and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
176 #                       and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
177 #                       and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
178 #                       and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
179 #                  or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
180 #</Location>
181
182 #   SSL Engine Options:
183 #   Set various options for the SSL engine.
184 #   o FakeBasicAuth:
185 #        Translate the client X.509 into a Basic Authorisation.  This means that
186 #        the standard Auth/DBMAuth methods can be used for access control.  The
187 #        user name is the `one line' version of the client's X.509 certificate.
188 #        Note that no password is obtained from the user. Every entry in the user
189 #        file needs this password: `xxj31ZMTZzkVA'.
190 #   o ExportCertData:
191 #        This exports two additional environment variables: SSL_CLIENT_CERT and
192 #        SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
193 #        server (always existing) and the client (only existing when client
194 #        authentication is used). This can be used to import the certificates
195 #        into CGI scripts.
196 #   o StdEnvVars:
197 #        This exports the standard SSL/TLS related `SSL_*' environment variables.
198 #        Per default this exportation is switched off for performance reasons,
199 #        because the extraction step is an expensive operation and is usually
200 #        useless for serving static content. So one usually enables the
201 #        exportation for CGI and SSI requests only.
202 #   o StrictRequire:
203 #        This denies access when "SSLRequireSSL" or "SSLRequire" applied even
204 #        under a "Satisfy any" situation, i.e. when it applies access is denied
205 #        and no other module can change it.
206 #   o OptRenegotiate:
207 #        This enables optimized SSL connection renegotiation handling when SSL
208 #        directives are used in per-directory context.
209 #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
210 <FilesMatch "\.(cgi|shtml|phtml|php)$">
211         SSLOptions +StdEnvVars
212 </FilesMatch>
213 <Directory "/home/services/httpd/cgi-bin">
214         SSLOptions +StdEnvVars
215 </Directory>
216
217 #   SSL Protocol Adjustments:
218 #   The safe and default but still SSL/TLS standard compliant shutdown
219 #   approach is that mod_ssl sends the close notify alert but doesn't wait for
220 #   the close notify alert from client. When you need a different shutdown
221 #   approach you can use one of the following variables:
222 #   o ssl-unclean-shutdown:
223 #        This forces an unclean shutdown when the connection is closed, i.e. no
224 #        SSL close notify alert is send or allowed to received.  This violates
225 #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
226 #        this when you receive I/O errors because of the standard approach where
227 #        mod_ssl sends the close notify alert.
228 #   o ssl-accurate-shutdown:
229 #        This forces an accurate shutdown when the connection is closed, i.e. a
230 #        SSL close notify alert is send and mod_ssl waits for the close notify
231 #        alert of the client. This is 100% SSL/TLS standard compliant, but in
232 #        practice often causes hanging connections with brain-dead browsers. Use
233 #        this only for browsers where you know that their SSL implementation
234 #        works correctly.
235 #   Notice: Most problems of broken clients are also related to the HTTP
236 #   keep-alive facility, so you usually additionally want to disable
237 #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
238 #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
239 #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
240 #   "force-response-1.0" for this.
241 <IfModule mod_setenvif.c>
242         BrowserMatch ".*MSIE [2-5]\..*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
243         BrowserMatch ".*MSIE [6-9]\..*" ssl-unclean-shutdown
244 </IfModule>
245
246 #   Per-Server Logging:
247 #   The home of a custom SSL log file. Use this when you want a
248 #   compact non-error SSL logfile on a virtual host basis.
249 #<IfModule mod_log_config.c>
250 #       CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
251 #       # enable common log too, otherwise you be suprised of no access logs
252 #       CustomLog logs/access_log common
253 #</IfModule>
254
255 </VirtualHost>
256
257 </IfModule>