source: darkpeak-services/roles/apache2/templates/apache.vhost.conf.j2 @ 8fab56d2

ansiblekeycloakmatrixpleroma
Last change on this file since 8fab56d2 was 8fab56d2, checked in by Mat Booth <mat.booth@…>, 2 years ago

Refs #7 - Refactor to allow each service to have its own cert

Precursor to letsencrypt

  • Property mode set to 100644
File size: 6.2 KB
Line 
1<VirtualHost *:80>
2    # Force all requests over SSL
3{% if service_name == 'default' %}
4    ServerName {{ domain_name }}
5    Redirect / https://{{ domain_name }}/
6{% else %}
7    ServerName {{ domain }}
8    Redirect permanent / https://{{ domain }}/
9{% endif %}
10</VirtualHost>
11
12<IfModule mod_ssl.c>
13        <VirtualHost _default_:443>
14                ServerAdmin webmaster@{{ domain_name }}
15{% if service_name == 'default' %}
16                # Redirect the bare domain name to the service providing the home page
17                ServerName {{ domain_name }}
18                Redirect / https://{{ redirect_to_service }}.{{ domain_name }}/
19{% else %}
20                ServerName {{ domain }}
21{% endif %}
22                DocumentRoot {{ web_root }}
23
24                ErrorLog ${APACHE_LOG_DIR}/{{ service_name }}/error.log
25                CustomLog ${APACHE_LOG_DIR}/{{ service_name }}/access.log combined
26
27                SSLEngine on
28
29                #   Server Certificate:
30                #   If both key and certificate are stored in the same file, only the
31                #   SSLCertificateFile directive is needed.
32{% if service_name == 'default' %}
33                SSLCertificateFile /etc/ssl/private/{{ domain_name }}.pem
34                #SSLCertificateKeyFile /etc/ssl/private/{{ domain_name }}.key
35{% else %}
36                SSLCertificateFile /etc/ssl/private/{{ domain }}.pem
37                #SSLCertificateKeyFile /etc/ssl/private/{{ domain }}.key
38{% endif %}
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/apache2/ssl.crt/server-ca.crt
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                #   SSL Engine Options:
78                #   Set various options for the SSL engine.
79                #   o FakeBasicAuth:
80                #        Translate the client X.509 into a Basic Authorisation.  This means that
81                #        the standard Auth/DBMAuth methods can be used for access control.  The
82                #        user name is the `one line' version of the client's X.509 certificate.
83                #        Note that no password is obtained from the user. Every entry in the user
84                #        file needs this password: `xxj31ZMTZzkVA'.
85                #   o ExportCertData:
86                #        This exports two additional environment variables: SSL_CLIENT_CERT and
87                #        SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
88                #        server (always existing) and the client (only existing when client
89                #        authentication is used). This can be used to import the certificates
90                #        into CGI scripts.
91                #   o StdEnvVars:
92                #        This exports the standard SSL/TLS related `SSL_*' environment variables.
93                #        Per default this exportation is switched off for performance reasons,
94                #        because the extraction step is an expensive operation and is usually
95                #        useless for serving static content. So one usually enables the
96                #        exportation for CGI and SSI requests only.
97                #   o OptRenegotiate:
98                #        This enables optimized SSL connection renegotiation handling when SSL
99                #        directives are used in per-directory context.
100                #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
101                <FilesMatch "\.(cgi|shtml|phtml|php)$">
102                        SSLOptions +StdEnvVars
103                </FilesMatch>
104
105                #   SSL Protocol Adjustments:
106                #   The safe and default but still SSL/TLS standard compliant shutdown
107                #   approach is that mod_ssl sends the close notify alert but doesn't wait for
108                #   the close notify alert from client. When you need a different shutdown
109                #   approach you can use one of the following variables:
110                #   o ssl-unclean-shutdown:
111                #        This forces an unclean shutdown when the connection is closed, i.e. no
112                #        SSL close notify alert is send or allowed to received.  This violates
113                #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
114                #        this when you receive I/O errors because of the standard approach where
115                #        mod_ssl sends the close notify alert.
116                #   o ssl-accurate-shutdown:
117                #        This forces an accurate shutdown when the connection is closed, i.e. a
118                #        SSL close notify alert is send and mod_ssl waits for the close notify
119                #        alert of the client. This is 100% SSL/TLS standard compliant, but in
120                #        practice often causes hanging connections with brain-dead browsers. Use
121                #        this only for browsers where you know that their SSL implementation
122                #        works correctly.
123                #   Notice: Most problems of broken clients are also related to the HTTP
124                #   keep-alive facility, so you usually additionally want to disable
125                #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
126                #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
127                #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
128                #   "force-response-1.0" for this.
129                # BrowserMatch "MSIE [2-6]" \
130                #               nokeepalive ssl-unclean-shutdown \
131                #               downgrade-1.0 force-response-1.0
132
133                # Include service-specific site configuration
134                Include includes/{{ service_name }}.incl.conf
135        </VirtualHost>
136</IfModule>
137
138# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Note: See TracBrowser for help on using the repository browser.