Baikal CalDAV/CardDAV Server mit Caddy-TLS-Proxy (100 Jahre Zertifikat)
- docker-compose.yml: baikal (ckulka/baikal:nginx) + caddy Reverse Proxy - Persistente Daten unter ./daten (config, data, caddy_certs) - Caddy-Image mit Entrypoint: erstellt beim Start automatisch ein selbstsigniertes 100-Jahres-Zertifikat, falls noch keins vorhanden ist - README mit Setup-, Backup- und Zertifikats-Anleitung
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
FROM caddy:2-alpine
|
||||
|
||||
# openssl wird fuer die automatische Zertifikatserstellung im Entrypoint gebraucht
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
CERT_DIR="/certs"
|
||||
CERT_FILE="$CERT_DIR/baikal.crt"
|
||||
KEY_FILE="$CERT_DIR/baikal.key"
|
||||
CN="${CADDY_CERT_CN:-baikal.local}"
|
||||
|
||||
mkdir -p "$CERT_DIR"
|
||||
|
||||
if [ ! -f "$CERT_FILE" ] || [ ! -f "$KEY_FILE" ]; then
|
||||
echo "[entrypoint] Kein Zertifikat unter $CERT_DIR gefunden - erstelle neues, 100 Jahre gueltiges Zertifikat fuer CN=$CN ..."
|
||||
|
||||
openssl req -x509 -nodes -newkey rsa:4096 -sha256 \
|
||||
-days 36500 \
|
||||
-keyout "$KEY_FILE" \
|
||||
-out "$CERT_FILE" \
|
||||
-subj "/C=DE/ST=Niedersachsen/L=Oldenburg/O=HackerSoft/CN=${CN}" \
|
||||
-addext "subjectAltName=DNS:${CN},DNS:localhost,IP:127.0.0.1"
|
||||
|
||||
chmod 600 "$KEY_FILE"
|
||||
chmod 644 "$CERT_FILE"
|
||||
|
||||
echo "[entrypoint] Zertifikat erstellt (gueltig fuer 36500 Tage / 100 Jahre)."
|
||||
else
|
||||
echo "[entrypoint] Bestehendes Zertifikat in $CERT_DIR gefunden, wird weiterverwendet."
|
||||
fi
|
||||
|
||||
exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
|
||||
Reference in New Issue
Block a user