graphene-os-server-infrastr.../rotate-session-ticket-keys
Daniel Micay 17f0ec527d cleanly phase in new TLS session ticket keys
This closes a small window where new workers could give keys not
accepted by the old workers before they're gracefully shut down. This
will also be needed when syncing keys across a cluster.
2025-10-28 02:48:49 -04:00

27 lines
510 B
Bash
Executable file

#!/bin/bash
set -o errexit -o nounset -o pipefail
cd /etc/session-ticket-keys
rsync -tI 2.key 1.key
rsync -tI 3.key 2.key
rsync -tI 4.key 3.key
rsync -tI next.key 4.key
head -c 80 </dev/random >tmp.key
mv tmp.key next.key
cat next.key {1..4}.key > keys.new
mv keys.new keys
status=0
if systemctl is-enabled nginx.service >/dev/null; then
nginx -s reload || status=1
fi
if systemctl is-enabled dnsdist.service >/dev/null; then
dnsdist -c -e 'reloadAllCertificates()' || status=1
fi
exit $status