mirror of
https://github.com/GrapheneOS/infrastructure.git
synced 2025-11-20 06:52:44 -05:00
add initial session ticket key synchronization
This commit is contained in:
parent
f9430a1aeb
commit
9fde84c877
7 changed files with 121 additions and 1 deletions
|
|
@ -10,7 +10,9 @@ for host in ${hosts_primary[@]}; do
|
||||||
echo $host
|
echo $host
|
||||||
echo
|
echo
|
||||||
|
|
||||||
rsync --chmod=F755 certbot-replicate $remote:/usr/local/bin/
|
rsync --chmod=F755 certbot-replicate session-ticket-keys-sync $remote:/usr/local/bin/
|
||||||
rsync etc/systemd/system/certbot-renew.service.d/replicate.conf $remote:/etc/systemd/system/certbot-renew.service.d/
|
rsync etc/systemd/system/certbot-renew.service.d/replicate.conf $remote:/etc/systemd/system/certbot-renew.service.d/
|
||||||
|
rsync etc/systemd/system/session-ticket-keys-sync.{service,timer} $remote:/etc/systemd/system/
|
||||||
ssh $remote systemctl daemon-reload
|
ssh $remote systemctl daemon-reload
|
||||||
|
ssh $remote systemctl enable --now session-ticket-keys-sync.timer
|
||||||
done
|
done
|
||||||
|
|
|
||||||
14
deploy-secondary
Executable file
14
deploy-secondary
Executable file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. shared.sh
|
||||||
|
. hosts.sh
|
||||||
|
|
||||||
|
for host in ${hosts_secondary[@]}; do
|
||||||
|
remote=root@$host
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo $host
|
||||||
|
echo
|
||||||
|
|
||||||
|
rsync --chmod=F755 session-ticket-keys-sync-deploy $remote:/usr/local/bin/
|
||||||
|
done
|
||||||
10
etc/systemd/system/session-ticket-keys-sync.service
Normal file
10
etc/systemd/system/session-ticket-keys-sync.service
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Sync TLS session ticket keys
|
||||||
|
After=dnsdist.service nginx.service create-session-ticket-keys.service
|
||||||
|
Requires=create-session-ticket-keys.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/local/bin/session-ticket-keys-sync
|
||||||
|
Group=tls
|
||||||
|
Type=oneshot
|
||||||
|
UMask=0027
|
||||||
12
etc/systemd/system/session-ticket-keys-sync.timer
Normal file
12
etc/systemd/system/session-ticket-keys-sync.timer
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Run session-ticket-keys-sync.service every minute
|
||||||
|
After=create-session-ticket-keys.service
|
||||||
|
Requires=create-session-ticket-keys.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
AccuracySec=1s
|
||||||
|
OnActiveSec=0
|
||||||
|
OnUnitActiveSec=1m
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
8
hosts.sh
8
hosts.sh
|
|
@ -342,6 +342,14 @@ readonly hosts_primary=(
|
||||||
0.releases.grapheneos.org
|
0.releases.grapheneos.org
|
||||||
)
|
)
|
||||||
|
|
||||||
|
readonly hosts_secondary=(
|
||||||
|
{1..3}.ns1.grapheneos.org
|
||||||
|
{1..2}.ns2.grapheneos.org
|
||||||
|
{1..3}.grapheneos.org
|
||||||
|
{1..3}.grapheneos.network
|
||||||
|
{1..3}.releases.grapheneos.org
|
||||||
|
)
|
||||||
|
|
||||||
readonly hosts_backup=(
|
readonly hosts_backup=(
|
||||||
mail.grapheneos.org
|
mail.grapheneos.org
|
||||||
staging.attestation.app
|
staging.attestation.app
|
||||||
|
|
|
||||||
44
session-ticket-keys-sync
Executable file
44
session-ticket-keys-sync
Executable file
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
status=0
|
||||||
|
|
||||||
|
cd /etc/session-ticket-keys
|
||||||
|
|
||||||
|
if [[ ! -f syncing ]]; then
|
||||||
|
for mirror in $(cat /etc/mirrors); do
|
||||||
|
echo
|
||||||
|
echo Syncing from $mirror
|
||||||
|
echo
|
||||||
|
|
||||||
|
ssh $mirror "bash -c [[ -f /etc/session-ticket-keys/synced ]]" || continue
|
||||||
|
|
||||||
|
rm -rf sync
|
||||||
|
mkdir sync
|
||||||
|
rsync -aI $mirror:/etc/session-ticket-keys/{{next,1,2,3,4}.key,keys} sync/ || continue
|
||||||
|
rsync -aIv sync/{{next,1,2,3,4}.key,keys} . || continue
|
||||||
|
rm -r sync
|
||||||
|
|
||||||
|
if systemctl is-active --quiet nginx.service; then
|
||||||
|
nginx -s reload || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if systemctl is-active --quiet dnsdist.service; then
|
||||||
|
dnsdist -c -e 'reloadAllCertificates()' || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch syncing
|
||||||
|
break
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
for mirror in $(cat /etc/mirrors); do
|
||||||
|
echo
|
||||||
|
echo Syncing to $mirror
|
||||||
|
echo
|
||||||
|
|
||||||
|
ssh $mirror "rm -rf /etc/session-ticket-keys/sync && mkdir /etc/session-ticket-keys/sync" || continue
|
||||||
|
rsync -aI {{next,1,2,3,4}.key,keys} $mirror:/etc/session-ticket-keys/sync || continue
|
||||||
|
ssh $mirror session-ticket-keys-sync-deploy || continue
|
||||||
|
done
|
||||||
30
session-ticket-keys-sync-deploy
Executable file
30
session-ticket-keys-sync-deploy
Executable file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
cd /etc/session-ticket-keys
|
||||||
|
|
||||||
|
exec {fd}>sync-lock
|
||||||
|
flock $fd
|
||||||
|
|
||||||
|
if ! cmp --silent keys sync/keys; then
|
||||||
|
rsync -aIv sync/{{next,1,2,3,4}.key,keys} .
|
||||||
|
rm -rf sync
|
||||||
|
|
||||||
|
status=0
|
||||||
|
|
||||||
|
if systemctl is-active --quiet nginx.service; then
|
||||||
|
nginx -s reload || status=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if systemctl is-active --quiet dnsdist.service; then
|
||||||
|
dnsdist -c -e 'reloadAllCertificates()' || status=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch synced
|
||||||
|
|
||||||
|
exit $status
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf sync
|
||||||
|
touch synced
|
||||||
Loading…
Add table
Add a link
Reference in a new issue