| 7 | | tbd. |
| 8 | | |
| | 7 | === neuen V-Host erstellen mit SSL-Cert und getssl |
| | 8 | |
| | 9 | ==== Apache und Datenverzeichnis konfigurieren |
| | 10 | |
| | 11 | 1. auf Laubfrosch anmelden, `root` werden |
| | 12 | 1. im Verzeichnis `/var/www` |
| | 13 | a. für eine Web-Service: \\ ein neues Verzeichnis mit dem Hostnamen anlegen: `mkdir twiki.mtronig.de` |
| | 14 | a. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...): \\ einen Sym-Link auf `localhost` anlegen: `mkdir ln -s localhost murmur.vpn21.net` |
| | 15 | 1. SSL Verzeichnis erstellen |
| | 16 | a. mit eigenem SSL-Cert oder als zentrale Stelle für ein Sammel-Cert: \\ ein Unterverzeichnis `ssl` anlegen: `mkdir -p twiki.mtronig.de/ssl` |
| | 17 | a. zu einem Sammel-Cert hinzufügen: \\ einen Symlink auf das `ssl` Verzeichnis des Sammel-Cert-Halters legen: `ln -s ../usvn/ssl twiki.mtronig.de/ssl` |
| | 18 | a. für einen Nicht-Web-Server (z.B. IMAP, murmur, ...) ist das im `localhost` geregelt. |
| | 19 | Im `ssl` Verzeichnis (Link oder physisch) werden folgende Dateien für die nachfolgende Konfigruation benötigt und müssen durch getssl.sh erstellt werden: |
| | 20 | * `ca-bundle.pem` |
| | 21 | * `server.crt` |
| | 22 | * `server.key_decrypted` |
| | 23 | 1. im Host-Verzeichnis die Web-Daten unterbringen, für einen Forwarder auf einen anderen Web-Service via `http` oder `https` kommen keine Daten hier hinein. \\ Die Web-Daten hier sollten dem `apache` User gehören: `chown -R apache:apache twiki.mtronig.de`. |
| | 24 | 1. im Konfigurations-Verzeichnis `/etc/apache2/vhosts.d` eine neue Host-Konfiguration erstellen nach dem Namensmuster `nn-hostname.mit.domaine.tld.conf`. Jeder V-Host bekommt eine eigene Nummer, die vor `99` und auch vor `78` einsortiert wird, normalerweise aufsteigend ab `21` die nächste freie Nummer. Die Konfigurationsdatei richtet sich nach den Eigenschaften des Web-Service, soll aber auf jeden Fall die Teile der SSL-Konfiguration enthalten: |
| | 25 | {{{ |
| | 26 | ### Section 3: Virtual Hosts |
| | 27 | # |
| | 28 | # VirtualHost: If you want to maintain multiple domains/hostnames on your |
| | 29 | # machine you can setup VirtualHost containers for them. Most configurations |
| | 30 | # use only name-based virtual hosts so the server doesn't need to worry about |
| | 31 | # IP addresses. This is indicated by the asterisks in the directives below. |
| | 32 | # |
| | 33 | # Please see the documentation at |
| | 34 | # <URL:http://httpd.apache.org/docs-2.0/vhosts/> |
| | 35 | # for further details before you try to setup virtual hosts. |
| | 36 | # |
| | 37 | # You may use the command line option '-S' to verify your virtual host |
| | 38 | # configuration. |
| | 39 | |
| | 40 | # |
| | 41 | # Use name-based virtual hosting. |
| | 42 | # |
| | 43 | #NameVirtualHost *:80 |
| | 44 | |
| | 45 | # |
| | 46 | # Almost any Apache directive may go into a VirtualHost container. |
| | 47 | # The first VirtualHost section is used for requests without a known |
| | 48 | # server name. |
| | 49 | # |
| | 50 | <VirtualHost *:80> |
| | 51 | ServerName wrp.vpn21.net |
| | 52 | RedirectMatch permanent "^(/(?!.well-known/acme-challenge?).*)" https://wrp.vpn21.net$1 |
| | 53 | </VirtualHost> |
| | 54 | |
| | 55 | <VirtualHost *:443> |
| | 56 | ServerName wrp.vpn21.net |
| | 57 | # SSLProxyEngine On |
| | 58 | # RequestHeader set Front-End-Https "On" |
| | 59 | |
| | 60 | RequestHeader edit Destination https://wrp.vpn21.net/ http://172.18.2.3:8080/ |
| | 61 | ProxyRequests Off |
| | 62 | ProxyPass /.well-known ! |
| | 63 | ProxyPass / http://172.18.2.3:8080/ |
| | 64 | ProxyPassReverse / http://172.18.2.3:8080/ |
| | 65 | |
| | 66 | SSLEngine on |
| | 67 | |
| | 68 | ## Server Certificate: |
| | 69 | # Point SSLCertificateFile at a PEM encoded certificate. If the certificate |
| | 70 | # is encrypted, then you will be prompted for a pass phrase. Note that a |
| | 71 | # kill -HUP will prompt again. Keep in mind that if you have both an RSA |
| | 72 | # and a DSA certificate you can configure both in parallel (to also allow |
| | 73 | # the use of DSA ciphers, etc.) |
| | 74 | SSLCertificateFile /var/www/wrp.vpn21.net/ssl/server.crt |
| | 75 | |
| | 76 | ## Server Private Key: |
| | 77 | # If the key is not combined with the certificate, use this directive to |
| | 78 | # point at the key file. Keep in mind that if you've both a RSA and a DSA |
| | 79 | # private key you can configure both in parallel (to also allow the use of |
| | 80 | # DSA ciphers, etc.) |
| | 81 | SSLCertificateKeyFile /var/www/wrp.vpn21.net/ssl/server.key_decrypted |
| | 82 | |
| | 83 | ## Server Certificate Chain: |
| | 84 | # Point SSLCertificateChainFile at a file containing the concatenation of |
| | 85 | # PEM encoded CA certificates which form the certificate chain for the |
| | 86 | # server certificate. Alternatively the referenced file can be the same as |
| | 87 | # SSLCertificateFile when the CA certificates are directly appended to the |
| | 88 | # server certificate for convinience. |
| | 89 | SSLCertificateChainFile /var/www/wrp.vpn21.net/ssl/ca-bundle.pem |
| | 90 | |
| | 91 | Header always add Strict-Transport-Security "max-age=15768000" |
| | 92 | </VirtualHost> |
| | 93 | }}} |
| | 94 | 1. Apache neu starten/laden, um die Konfiguration zu übernehmen |
| | 95 | |
| | 96 | ==== getssl einrichten |
| | 97 | |
| | 98 | a. für einen Web-Host mit eigenem SSL-Cert: |
| | 99 | 1. in das Verzeichnis `~root/.getssl` wechseln |
| | 100 | 1. Host-/Domain-Verzeichnis anlegen: `mkdir twiki.mtronig.de` |
| | 101 | 1. Konfigurationsdatei `twiki.mtronig.de/getssl.cfg` erstellen: |
| | 102 | {{{ |
| | 103 | # Uncomment and modify any variables you need |
| | 104 | # see https://github.com/srvrco/getssl/wiki/Config-variables for details |
| | 105 | # see https://github.com/srvrco/getssl/wiki/Example-config-files for example configs |
| | 106 | # |
| | 107 | # The staging server is best for testing |
| | 108 | CA="https://acme-staging-v02.api.letsencrypt.org/directory" |
| | 109 | # This server issues full certificates, however has rate limits |
| | 110 | #CA="https://acme-v02.api.letsencrypt.org" |
| | 111 | |
| | 112 | #PRIVATE_KEY_ALG="rsa" |
| | 113 | |
| | 114 | # Additional domains - this could be multiple domains / subdomains in a comma separated list |
| | 115 | # Note: this is Additional domains - so should not include the primary domain. |
| | 116 | #SANS="trac.mtronig.de" |
| | 117 | |
| | 118 | # Acme Challenge Location. The first line for the domain, the following ones for each additional domain. |
| | 119 | # If these start with ssh: then the next variable is assumed to be the hostname and the rest the location. |
| | 120 | # An ssh key will be needed to provide you with access to the remote server. |
| | 121 | # Optionally, you can specify a different userid for ssh/scp to use on the remote server before the @ sign. |
| | 122 | # If left blank, the username on the local server will be used to authenticate against the remote server. |
| | 123 | # If these start with ftp: then the next variables are ftpuserid:ftppassword:servername:ACL_location |
| | 124 | # These should be of the form "/path/to/your/website/folder/.well-known/acme-challenge" |
| | 125 | # where "/path/to/your/website/folder/" is the path, on your web server, to the web root for your domain. |
| | 126 | #ACL=('/var/www/twiki.mtronig.de/web/.well-known/acme-challenge' |
| | 127 | # 'ssh:server5:/var/www/usvn.vpn21.net/web/.well-known/acme-challenge' |
| | 128 | # 'ssh:sshuserid@server5:/var/www/usvn.vpn21.net/web/.well-known/acme-challenge' |
| | 129 | # 'ftp:ftpuserid:ftppassword:usvn.vpn21.net:/web/.well-known/acme-challenge') |
| | 130 | |
| | 131 | #Set USE_SINGLE_ACL="true" to use a single ACL for all checks |
| | 132 | #USE_SINGLE_ACL="false" |
| | 133 | |
| | 134 | # Location for all your certs, these can either be on the server (full path name) |
| | 135 | # or using ssh /sftp as for the ACL |
| | 136 | DOMAIN_CERT_LOCATION="/var/www/twiki.mtronig.de/ssl/server.crt" |
| | 137 | DOMAIN_KEY_LOCATION="/var/www/twiki.mtronig.de/ssl/server.key_decrypted" |
| | 138 | CA_CERT_LOCATION="/var/www/twiki.mtronig.de/ssl/ca-bundle.pem" |
| | 139 | #DOMAIN_CHAIN_LOCATION="" # this is the domain cert and CA cert |
| | 140 | #DOMAIN_PEM_LOCATION="" # this is the domain_key, domain cert and CA cert |
| | 141 | |
| | 142 | # The command needed to reload apache / nginx or whatever you use |
| | 143 | #RELOAD_CMD="" |
| | 144 | |
| | 145 | # Define the server type. This can be https, ftp, ftpi, imap, imaps, pop3, pop3s, smtp, |
| | 146 | # smtps_deprecated, smtps, smtp_submission, xmpp, xmpps, ldaps or a port number which |
| | 147 | # will be checked for certificate expiry and also will be checked after |
| | 148 | # an update to confirm correct certificate is running (if CHECK_REMOTE) is set to true |
| | 149 | #SERVER_TYPE="https" |
| | 150 | #CHECK_REMOTE="true" |
| | 151 | }}} |
| | 152 | 1. `getssl` Konfiguration testen: \\ `getssl twiki.mtronig.de` |
| | 153 | |