change(docker): use step-ca for CA + cert generation

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-27 16:43:29 -08:00
parent e558e979ff
commit b98159d5b9
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
10 changed files with 160 additions and 69 deletions

View file

@ -9,6 +9,6 @@ pacman -Syu --noconfirm --noprogressbar \
mariadb mariadb-libs cgit-aurweb uwsgi uwsgi-plugin-cgi \
php php-fpm memcached php-memcached python-pip pyalpm \
python-srcinfo curl libeatmydata cronie python-poetry \
python-poetry-core
python-poetry-core step-cli step-ca
exec "$@"

7
docker/scripts/run-ca.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
STEP_DIR="$(step-cli path)"
STEP_PASSWD_FILE="$STEP_DIR/password.txt"
STEP_CA_CONFIG="$STEP_DIR/config/ca.json"
# Start the step-ca https server.
exec step-ca "$STEP_CA_CONFIG" --password-file="$STEP_PASSWD_FILE"

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import json
import sys
CA_CONFIG = sys.argv[1]
with open(CA_CONFIG) as f:
data = json.load(f)
if "authority" not in data:
data["authority"] = dict()
if "claims" not in data["authority"]:
data["authority"]["claims"] = dict()
# One year of certificate duration.
data["authority"]["claims"] = {"maxTLSCertDuration": "8800h"}
with open(CA_CONFIG, "w") as f:
json.dump(data, f)