mt created page: docs:hosting authored by mt's avatar mt
......@@ -88,23 +88,37 @@ Wir nutzen `acme_tiny` für Let's Encrypt. Zertifikate sind in `/etc/ssl/letsenc
[Ausführliche Dokumentation auf GitHub](https://github.com/drdaeman/acme-tiny/blob/f995b09b67498ef6fc538867eeeb63643cba5702/README.md)
## Private Key für Domain erstellen (RSA)
```
# cd /etc/ssl/letsencrypt
// Private Key für Domain erstellen (RSA)
# openssl genrsa 4096 > subdomain.bau-ha.us.key
```
## CSR Request erstellen
```
# openssl req -new -sha256 \
-key subdomain.bau-ha.us.key \
-subj "/CN=subdomain.bau-ha.us" \
> subdomain.bau-ha.us.csr
// mehrere Domains in einem Zertikat
// (www.meinedomain.de, meinedomain.de, foobar.meinedomain.de..)
# openssl req -new -sha256 \
-key subdomain.bau-ha.us.key \
-subj "/" -reqexts SAN \
-config <(cat /etc/ssl/openssl.cnf } \
<(printf "[SAN]\nsubjectAltName=DNS:subdomain.bau-ha.us,DNS:www.subdomain.de")) \
> subdomain.bau-ha.us.csr
```
// CSR Request erstellen
# openssl req -new -sha256 -key subdomain.bau-ha.us.key -subj "/CN=subdomain.bau-ha.us" > subdomain.bau-ha.us.csr
// mehrere Domains in einem Zertikat (www.meinedomain.de, meinedomain.de, foobar.meinedomain.de..)
# openssl req -new -sha256 -key subdomain.bau-ha.us.key \
-subj "/" -reqexts SAN \
-config <(cat /etc/ssl/openssl.cnf } \
<(printf "[SAN]\nsubjectAltName=DNS:subdomain.bau-ha.us,DNS:www.subdomain.de")) \
> subdomain.bau-ha.us.csr
## Challenges Verzeichnis in nginx Konfiguration einbinden
// Challenges Verzeichnis in nginx Konfiguration einbinden
// /etc/nginx/sites-available/subdomain.bau-ha.us
```
# /etc/nginx/sites-available/subdomain.bau-ha.us
server {
listen 80;
server_name subdomain.bau-ha.us foobarbaz.subdomain.bau-ha.us;
......@@ -118,15 +132,17 @@ server {
return 301 https://$host$request_uri;
}
}
```
// Zertifikat von Let's Encrypt unterschreiben lassen.
## Zertifikat von Let's Encrypt unterschreiben lassen.
// Automatisch
### Per Script
# /etc/letsencrypt/ssl/renew.sh subdomain.bau-ha.us
# /etc/letsencrypt/ssl/renew.sh subdomain.bau-ha.us
// Manuell
### Manuell
```
# acme_tiny --account-key ./account.key --csr ./subdomain.bau-ha.us.csr --acme-dir /var/www/challenges/ > ./subdomain.bau-ha.us.crt
// Let's Encrypt Intermediate Zertifikat hinzufügen
......@@ -134,11 +150,11 @@ server {
# cat subdomain.bau-ha.us.crt /tmp/intermediate.pem > subdomain.bau-ha.us.chained.pem
```
## nginx
Jetzt kann man die Zertifikate in den nginx Virtualhost einbinden:
``
```
server {
listen 443 ssl http2;
server_name subdomain.bau-ha.us;
......@@ -154,8 +170,10 @@ server {
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
...
}
```
## Erneuerung mit cron
Jetzt noch die `crontab` für das monatliche erneuern der Zertifikate:
......
......