19 lines
1.0 KiB
Bash
Executable File
19 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
identity="${1:?Usage: revoke-cert.sh identity}"
|
|
[[ "$identity" =~ ^[a-z-]+$ ]] || exit 2
|
|
exec 9> secrets/operator/pki.lock
|
|
flock 9
|
|
exec 8> secrets/operator/ca/ca.lock
|
|
flock 8
|
|
# A stale leaf must never be imported into a different issuer's CRL database.
|
|
openssl verify -no_check_time -no-CApath -no-CAstore -CAfile secrets/operator/ca/issuer.crt "certs/$identity/$identity.crt" >/dev/null
|
|
openssl ca -config secrets/operator/ca/openssl.cnf -revoke "certs/$identity/$identity.crt"
|
|
openssl ca -config secrets/operator/ca/openssl.cnf -gencrl -out secrets/operator/ca/active.crl
|
|
python3 scripts/pki_state.py publish
|
|
scripts/dc.sh exec -T db psql -U postgres -d messenger -c 'SELECT pg_reload_conf()' >/dev/null
|
|
# New handshakes must use the new CRL. Existing TCP sessions close on restart.
|
|
scripts/dc.sh restart lb api-tls api2-tls otel-collector-tls tempo-tls loki-tls prometheus-tls grafana-tls
|
|
scripts/dc.sh restart api api2 worker otel-collector tempo loki prometheus grafana
|