letsencrypt now generates certificates that include the chain
[ansible.git] / roles / apache / templates / ssl.conf
1 # SSL OCSP stapling
2 #SSLStaplingCache shmcb:/var/cache/apache2/ssl_stapling_cache(256000)
3 #SSLUseStapling  on
4
5 # Redirects
6 <Macro HTTP2HTTPS $domain>
7     <VirtualHost *:80>
8         ServerName $domain
9         Redirect permanent / https://$domain/
10     </VirtualHost>
11 </Macro>
12
13
14 # SSL Macros
15 <Macro SSL $cert>
16     # Use HTTP Strict Transport Security to force client to use secure connections only
17     Header unset Strict-Transport-Security
18     Header set Strict-Transport-Security "max-age=864000"
19     # Make sure we load everything via HTTPS
20     Header set Content-Security-Policy "upgrade-insecure-requests"
21
22     #########################################################
23     # SSL configuration below ###############################
24     #########################################################
25     #   SSL Engine Switch:
26     #   Enable/Disable SSL for this virtual host.
27     SSLEngine on
28
29     # configure SSL ciphers and protocols
30     SSLProtocol All -SSLv2 -SSLv3
31     # TODO: Once OpenSSL supports GCM with more than just AES, revisit this
32     # NOTE: The reason we support non-FS ciphers is stupid middleboxes like the one used by Frauenhofer in SB, that don't support FS
33     SSLCipherSuite 'kEECDH+AESGCM:kEDH+AESGCM:kEECDH:kEDH:AESGCM:ALL:!3DES:!EXPORT:!LOW:!MEDIUM:!aNULL:!eNULL'
34     SSLHonorCipherOrder     on
35
36     # DH parameters
37     SSLOpenSSLConfCmd DHParameters "/etc/ssl/dh2048.pem"
38
39     #   Certificate and key
40     SSLCertificateFile    /etc/ssl/mycerts/$cert.crt
41     SSLCertificateKeyFile /etc/ssl/private/$cert.key
42
43     #   Server Certificate Chain:
44     #   Point SSLCertificateChainFile at a file containing the
45     #   concatenation of PEM encoded CA certificates which form the
46     #   certificate chain for the server certificate. Alternatively
47     #   the referenced file can be the same as SSLCertificateFile
48     #   when the CA certificates are directly appended to the server
49     #   certificate for convinience.
50     SSLCertificateChainFile /etc/ssl/mycerts/$cert.crt
51
52     #   Certificate Authority (CA):
53     #   Set the CA certificate verification path where to find CA
54     #   certificates for client authentication or alternatively one
55     #   huge file containing all of them (file must be PEM encoded)
56     #   Note: Inside SSLCACertificatePath you need hash symlinks
57     #         to point to the certificate files. Use the provided
58     #         Makefile to update the hash symlinks after changes.
59     #SSLCACertificatePath /etc/ssl/certs/
60     #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
61
62     #   Certificate Revocation Lists (CRL):
63     #   Set the CA revocation path where to find CA CRLs for client
64     #   authentication or alternatively one huge file containing all
65     #   of them (file must be PEM encoded)
66     #   Note: Inside SSLCARevocationPath you need hash symlinks
67     #         to point to the certificate files. Use the provided
68     #         Makefile to update the hash symlinks after changes.
69     #SSLCARevocationPath /etc/apache2/ssl.crl/
70     #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
71
72     #   Client Authentication (Type):
73     #   Client certificate verification type and depth.  Types are
74     #   none, optional, require and optional_no_ca.  Depth is a
75     #   number which specifies how deeply to verify the certificate
76     #   issuer chain before deciding the certificate is not valid.
77     #SSLVerifyClient require
78     #SSLVerifyDepth  10
79
80     #   Access Control:
81     #   With SSLRequire you can do per-directory access control based
82     #   on arbitrary complex boolean expressions containing server
83     #   variable checks and other lookup directives.  The syntax is a
84     #   mixture between C and Perl.  See the mod_ssl documentation
85     #   for more details.
86     #<Location />
87     #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
88     #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
89     #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
90     #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
91     #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
92     #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
93     #</Location>
94
95     #   SSL Engine Options:
96     #   Set various options for the SSL engine.
97     #   o FakeBasicAuth:
98     #     Translate the client X.509 into a Basic Authorisation.  This means that
99     #     the standard Auth/DBMAuth methods can be used for access control.  The
100     #     user name is the `one line' version of the client's X.509 certificate.
101     #     Note that no password is obtained from the user. Every entry in the user
102     #     file needs this password: `xxj31ZMTZzkVA'.
103     #   o ExportCertData:
104     #     This exports two additional environment variables: SSL_CLIENT_CERT and
105     #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
106     #     server (always existing) and the client (only existing when client
107     #     authentication is used). This can be used to import the certificates
108     #     into CGI scripts.
109     #   o StdEnvVars:
110     #     This exports the standard SSL/TLS related `SSL_*' environment variables.
111     #     Per default this exportation is switched off for performance reasons,
112     #     because the extraction step is an expensive operation and is usually
113     #     useless for serving static content. So one usually enables the
114     #     exportation for CGI and SSI requests only.
115     #   o StrictRequire:
116     #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
117     #     under a "Satisfy any" situation, i.e. when it applies access is denied
118     #     and no other module can change it.
119     #   o OptRenegotiate:
120     #     This enables optimized SSL connection renegotiation handling when SSL
121     #     directives are used in per-directory context.
122     #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
123     #<FilesMatch "\.(cgi|shtml|phtml|php)$">
124     #       SSLOptions +StdEnvVars
125     #</FilesMatch>
126     #<Directory /usr/lib/cgi-bin>
127     #       SSLOptions +StdEnvVars
128     #</Directory>
129
130     #   SSL Protocol Adjustments:
131     #   The safe and default but still SSL/TLS standard compliant shutdown
132     #   approach is that mod_ssl sends the close notify alert but doesn't wait for
133     #   the close notify alert from client. When you need a different shutdown
134     #   approach you can use one of the following variables:
135     #   o ssl-unclean-shutdown:
136     #     This forces an unclean shutdown when the connection is closed, i.e. no
137     #     SSL close notify alert is send or allowed to received.  This violates
138     #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
139     #     this when you receive I/O errors because of the standard approach where
140     #     mod_ssl sends the close notify alert.
141     #   o ssl-accurate-shutdown:
142     #     This forces an accurate shutdown when the connection is closed, i.e. a
143     #     SSL close notify alert is send and mod_ssl waits for the close notify
144     #     alert of the client. This is 100% SSL/TLS standard compliant, but in
145     #     practice often causes hanging connections with brain-dead browsers. Use
146     #     this only for browsers where you know that their SSL implementation
147     #     works correctly.
148     #   Notice: Most problems of broken clients are also related to the HTTP
149     #   keep-alive facility, so you usually additionally want to disable
150     #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
151     #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
152     #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
153     #   "force-response-1.0" for this.
154     #BrowserMatch "MSIE [2-6]" \
155     #       nokeepalive ssl-unclean-shutdown \
156     #       downgrade-1.0 force-response-1.0
157     # MSIE 7 and newer should be able to use keepalive
158     #BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
159 </Macro>