HSTS Apache: Header always add/set
[ach-master.git] / src / configuration / Webservers-legacy / Apache / 000-default-ssl
1 <IfModule mod_ssl.c>
2 # this setting is needed to allow non SNI aware clients to connect too
3 SSLStrictSNIVHostCheck off
4
5 # This needs to be the first virtual host entry; on Debian systems put this
6 # in /etc/apache2/sites-enabled/000-default-ssl
7 <VirtualHost *:443>
8         DocumentRoot /var/www/bad-ssl
9         SSLEngine on
10         SSLProtocol All
11         SSLCipherSuite ALL:!ADH:!NULL:!EXPORT:+HIGH:+MEDIUM:+LOW:+SSLv3
12         SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
13         SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
14 </VirtualHost>
15
16 <VirtualHost _default_:443>
17         ServerAdmin webmaster@localhost
18
19         DocumentRoot /var/www
20         <Directory />
21                 Options FollowSymLinks
22                 AllowOverride None
23         </Directory>
24         <Directory /var/www/>
25                 Options Indexes FollowSymLinks MultiViews
26                 AllowOverride None
27                 Order allow,deny
28                 allow from all
29         </Directory>
30
31         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
32         <Directory "/usr/lib/cgi-bin">
33                 AllowOverride None
34                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
35                 Order allow,deny
36                 Allow from all
37         </Directory>
38
39         ErrorLog ${APACHE_LOG_DIR}/error.log
40
41         # Possible values include: debug, info, notice, warn, error, crit,
42         # alert, emerg.
43         LogLevel warn
44
45         CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
46
47         #   SSL Engine Switch:
48         #   Enable/Disable SSL for this virtual host.
49         SSLEngine on
50
51         #   A self-signed (snakeoil) certificate can be created by installing
52         #   the ssl-cert package. See
53         #   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
54         #   If both key and certificate are stored in the same file, only the
55         #   SSLCertificateFile directive is needed.
56         SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
57         SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
58
59         #   Server Certificate Chain:
60         #   Point SSLCertificateChainFile at a file containing the
61         #   concatenation of PEM encoded CA certificates which form the
62         #   certificate chain for the server certificate. Alternatively
63         #   the referenced file can be the same as SSLCertificateFile
64         #   when the CA certificates are directly appended to the server
65         #   certificate for convinience.
66         #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
67
68         #   Certificate Authority (CA):
69         #   Set the CA certificate verification path where to find CA
70         #   certificates for client authentication or alternatively one
71         #   huge file containing all of them (file must be PEM encoded)
72         #   Note: Inside SSLCACertificatePath you need hash symlinks
73         #         to point to the certificate files. Use the provided
74         #         Makefile to update the hash symlinks after changes.
75         #SSLCACertificatePath /etc/ssl/certs/
76         #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
77
78         #   Certificate Revocation Lists (CRL):
79         #   Set the CA revocation path where to find CA CRLs for client
80         #   authentication or alternatively one huge file containing all
81         #   of them (file must be PEM encoded)
82         #   Note: Inside SSLCARevocationPath you need hash symlinks
83         #         to point to the certificate files. Use the provided
84         #         Makefile to update the hash symlinks after changes.
85         #SSLCARevocationPath /etc/apache2/ssl.crl/
86         #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
87
88         #   Client Authentication (Type):
89         #   Client certificate verification type and depth.  Types are
90         #   none, optional, require and optional_no_ca.  Depth is a
91         #   number which specifies how deeply to verify the certificate
92         #   issuer chain before deciding the certificate is not valid.
93         #SSLVerifyClient require
94         #SSLVerifyDepth  10
95
96         #   Access Control:
97         #   With SSLRequire you can do per-directory access control based
98         #   on arbitrary complex boolean expressions containing server
99         #   variable checks and other lookup directives.  The syntax is a
100         #   mixture between C and Perl.  See the mod_ssl documentation
101         #   for more details.
102         #<Location />
103         #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
104         #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
105         #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
106         #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
107         #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
108         #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
109         #</Location>
110
111         #   SSL Engine Options:
112         #   Set various options for the SSL engine.
113         #   o FakeBasicAuth:
114         #     Translate the client X.509 into a Basic Authorisation.  This means that
115         #     the standard Auth/DBMAuth methods can be used for access control.  The
116         #     user name is the `one line' version of the client's X.509 certificate.
117         #     Note that no password is obtained from the user. Every entry in the user
118         #     file needs this password: `xxj31ZMTZzkVA'.
119         #   o ExportCertData:
120         #     This exports two additional environment variables: SSL_CLIENT_CERT and
121         #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
122         #     server (always existing) and the client (only existing when client
123         #     authentication is used). This can be used to import the certificates
124         #     into CGI scripts.
125         #   o StdEnvVars:
126         #     This exports the standard SSL/TLS related `SSL_*' environment variables.
127         #     Per default this exportation is switched off for performance reasons,
128         #     because the extraction step is an expensive operation and is usually
129         #     useless for serving static content. So one usually enables the
130         #     exportation for CGI and SSI requests only.
131         #   o StrictRequire:
132         #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
133         #     under a "Satisfy any" situation, i.e. when it applies access is denied
134         #     and no other module can change it.
135         #   o OptRenegotiate:
136         #     This enables optimized SSL connection renegotiation handling when SSL
137         #     directives are used in per-directory context.
138         #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
139         <FilesMatch "\.(cgi|shtml|phtml|php)$">
140                 SSLOptions +StdEnvVars
141         </FilesMatch>
142         <Directory /usr/lib/cgi-bin>
143                 SSLOptions +StdEnvVars
144         </Directory>
145
146         #   SSL Protocol Adjustments:
147         #   The safe and default but still SSL/TLS standard compliant shutdown
148         #   approach is that mod_ssl sends the close notify alert but doesn't wait for
149         #   the close notify alert from client. When you need a different shutdown
150         #   approach you can use one of the following variables:
151         #   o ssl-unclean-shutdown:
152         #     This forces an unclean shutdown when the connection is closed, i.e. no
153         #     SSL close notify alert is send or allowed to received.  This violates
154         #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
155         #     this when you receive I/O errors because of the standard approach where
156         #     mod_ssl sends the close notify alert.
157         #   o ssl-accurate-shutdown:
158         #     This forces an accurate shutdown when the connection is closed, i.e. a
159         #     SSL close notify alert is send and mod_ssl waits for the close notify
160         #     alert of the client. This is 100% SSL/TLS standard compliant, but in
161         #     practice often causes hanging connections with brain-dead browsers. Use
162         #     this only for browsers where you know that their SSL implementation
163         #     works correctly.
164         #   Notice: Most problems of broken clients are also related to the HTTP
165         #   keep-alive facility, so you usually additionally want to disable
166         #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
167         #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
168         #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
169         #   "force-response-1.0" for this.
170         BrowserMatch "MSIE [2-6]" \
171                 nokeepalive ssl-unclean-shutdown \
172                 downgrade-1.0 force-response-1.0
173         # MSIE 7 and newer should be able to use keepalive
174         BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
175
176         SSLProtocol All -SSLv2 -SSLv3
177         SSLHonorCipherOrder On
178         SSLCompression off
179         # Add six earth month HSTS header for all users...
180         Header always set Strict-Transport-Security "max-age=15768000"
181         # If you want to protect all subdomains, use the following header
182         # ALL subdomains HAVE TO support HTTPS if you use this!
183         # Strict-Transport-Security: max-age=15768000 ; includeSubDomains
184         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'
185
186 </VirtualHost>
187 </IfModule>