fix log-anon script
[ansible.git] / roles / apache / files / 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     #   Certificate, DH parameters and key
37     SSLCertificateFile    /etc/ssl/mycerts/$cert.crt+dh
38     SSLCertificateKeyFile /etc/ssl/private/$cert.key
39
40     #   Server Certificate Chain:
41     #   Point SSLCertificateChainFile at a file containing the
42     #   concatenation of PEM encoded CA certificates which form the
43     #   certificate chain for the server certificate. Alternatively
44     #   the referenced file can be the same as SSLCertificateFile
45     #   when the CA certificates are directly appended to the server
46     #   certificate for convinience.
47     SSLCertificateChainFile /etc/ssl/mycerts/$cert.chain
48
49     #   Certificate Authority (CA):
50     #   Set the CA certificate verification path where to find CA
51     #   certificates for client authentication or alternatively one
52     #   huge file containing all of them (file must be PEM encoded)
53     #   Note: Inside SSLCACertificatePath you need hash symlinks
54     #         to point to the certificate files. Use the provided
55     #         Makefile to update the hash symlinks after changes.
56     #SSLCACertificatePath /etc/ssl/certs/
57     #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
58
59     #   Certificate Revocation Lists (CRL):
60     #   Set the CA revocation path where to find CA CRLs for client
61     #   authentication or alternatively one huge file containing all
62     #   of them (file must be PEM encoded)
63     #   Note: Inside SSLCARevocationPath you need hash symlinks
64     #         to point to the certificate files. Use the provided
65     #         Makefile to update the hash symlinks after changes.
66     #SSLCARevocationPath /etc/apache2/ssl.crl/
67     #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
68
69     #   Client Authentication (Type):
70     #   Client certificate verification type and depth.  Types are
71     #   none, optional, require and optional_no_ca.  Depth is a
72     #   number which specifies how deeply to verify the certificate
73     #   issuer chain before deciding the certificate is not valid.
74     #SSLVerifyClient require
75     #SSLVerifyDepth  10
76
77     #   Access Control:
78     #   With SSLRequire you can do per-directory access control based
79     #   on arbitrary complex boolean expressions containing server
80     #   variable checks and other lookup directives.  The syntax is a
81     #   mixture between C and Perl.  See the mod_ssl documentation
82     #   for more details.
83     #<Location />
84     #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
85     #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
86     #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
87     #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
88     #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
89     #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
90     #</Location>
91
92     #   SSL Engine Options:
93     #   Set various options for the SSL engine.
94     #   o FakeBasicAuth:
95     #     Translate the client X.509 into a Basic Authorisation.  This means that
96     #     the standard Auth/DBMAuth methods can be used for access control.  The
97     #     user name is the `one line' version of the client's X.509 certificate.
98     #     Note that no password is obtained from the user. Every entry in the user
99     #     file needs this password: `xxj31ZMTZzkVA'.
100     #   o ExportCertData:
101     #     This exports two additional environment variables: SSL_CLIENT_CERT and
102     #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
103     #     server (always existing) and the client (only existing when client
104     #     authentication is used). This can be used to import the certificates
105     #     into CGI scripts.
106     #   o StdEnvVars:
107     #     This exports the standard SSL/TLS related `SSL_*' environment variables.
108     #     Per default this exportation is switched off for performance reasons,
109     #     because the extraction step is an expensive operation and is usually
110     #     useless for serving static content. So one usually enables the
111     #     exportation for CGI and SSI requests only.
112     #   o StrictRequire:
113     #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
114     #     under a "Satisfy any" situation, i.e. when it applies access is denied
115     #     and no other module can change it.
116     #   o OptRenegotiate:
117     #     This enables optimized SSL connection renegotiation handling when SSL
118     #     directives are used in per-directory context.
119     #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
120     #<FilesMatch "\.(cgi|shtml|phtml|php)$">
121     #       SSLOptions +StdEnvVars
122     #</FilesMatch>
123     #<Directory /usr/lib/cgi-bin>
124     #       SSLOptions +StdEnvVars
125     #</Directory>
126
127     #   SSL Protocol Adjustments:
128     #   The safe and default but still SSL/TLS standard compliant shutdown
129     #   approach is that mod_ssl sends the close notify alert but doesn't wait for
130     #   the close notify alert from client. When you need a different shutdown
131     #   approach you can use one of the following variables:
132     #   o ssl-unclean-shutdown:
133     #     This forces an unclean shutdown when the connection is closed, i.e. no
134     #     SSL close notify alert is send or allowed to received.  This violates
135     #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
136     #     this when you receive I/O errors because of the standard approach where
137     #     mod_ssl sends the close notify alert.
138     #   o ssl-accurate-shutdown:
139     #     This forces an accurate shutdown when the connection is closed, i.e. a
140     #     SSL close notify alert is send and mod_ssl waits for the close notify
141     #     alert of the client. This is 100% SSL/TLS standard compliant, but in
142     #     practice often causes hanging connections with brain-dead browsers. Use
143     #     this only for browsers where you know that their SSL implementation
144     #     works correctly.
145     #   Notice: Most problems of broken clients are also related to the HTTP
146     #   keep-alive facility, so you usually additionally want to disable
147     #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
148     #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
149     #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
150     #   "force-response-1.0" for this.
151     #BrowserMatch "MSIE [2-6]" \
152     #       nokeepalive ssl-unclean-shutdown \
153     #       downgrade-1.0 force-response-1.0
154     # MSIE 7 and newer should be able to use keepalive
155     #BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
156 </Macro>