Skip to content

Commit 1c9b62a

Browse files
authored
CA-399260: Keep both new and old certs during the switchover (#6223)
In host-refresh-server-certificate, host generates and applies new pool certificate after stunnel restart. There is 5s that other hosts don't trust the new certificate. Then operations related with xapi:pool SNI tls connection will fail. Both the old and new certificates shall be trusted during the switchover to avoid this. At the end of the refresh procedure, remove_stale_cert will rename the new pem to pem and update ca bundle.
2 parents 7abefc4 + 3406a64 commit 1c9b62a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/update-ca-bundle.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ regen_bundle () {
1111

1212
mkdir -p "$CERTS_DIR"
1313
CERTS=$(find "$CERTS_DIR" -not -name '*.new.pem' -name '*.pem')
14+
NEW_CERTS=$(find "$CERTS_DIR" -name '*.new.pem')
1415

1516
rm -f "$BUNDLE.tmp"
1617
touch "$BUNDLE.tmp"
18+
for NEW_CERT in $NEW_CERTS; do
19+
# If cat new cert command fails, do not error and exit, just skip it
20+
if cat "$NEW_CERT" >> "$BUNDLE.tmp"; then
21+
echo "" >> "$BUNDLE.tmp"
22+
fi
23+
done
1724
for CERT in $CERTS; do
1825
cat "$CERT" >> "$BUNDLE.tmp"
1926
echo "" >> "$BUNDLE.tmp"

0 commit comments

Comments
 (0)