Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase in key rollover #920

Open
Zash opened this issue Oct 25, 2023 · 0 comments
Open

Phase in key rollover #920

Zash opened this issue Oct 25, 2023 · 0 comments

Comments

@Zash
Copy link

Zash commented Oct 25, 2023

Hi and thanks a lot for dehydrated!

I'm looking into enabling private key renewal for my email and XMPP, where I have DANE TLSA records deployed. Since these must be published to DNS before the new private key is used, I would also like use the rollover feature.

Based on my reading of

dehydrated/dehydrated

Lines 1458 to 1472 in e3ef43c

# move rolloverkey into position (if any)
if [[ -r "${certdir}/privkey.pem" && -r "${certdir}/privkey.roll.pem" && "${PRIVATE_KEY_RENEW}" = "yes" && "${PRIVATE_KEY_ROLLOVER}" = "yes" ]]; then
echo " + Moving Rolloverkey into position.... "
mv "${certdir}/privkey.roll.pem" "${certdir}/privkey-tmp.pem"
mv "${certdir}/privkey-${timestamp}.pem" "${certdir}/privkey.roll.pem"
mv "${certdir}/privkey-tmp.pem" "${certdir}/privkey-${timestamp}.pem"
fi
# generate a new private rollover key if we need or want one
if [[ ! -r "${certdir}/privkey.roll.pem" && "${PRIVATE_KEY_ROLLOVER}" = "yes" && "${PRIVATE_KEY_RENEW}" = "yes" ]]; then
echo " + Generating private rollover key..."
case "${KEY_ALGO}" in
rsa) _openssl genrsa -out "${certdir}/privkey.roll.pem" "${KEYSIZE}";;
prime256v1|secp384r1) _openssl ecparam -genkey -name "${KEY_ALGO}" -out "${certdir}/privkey.roll.pem" -noout;;
esac
fi

if you go from PRIVATE_KEY_ROLLOVER="no" and PRIVATE_KEY_RENEW="no" to both yes, dehydrated will not use the old key one last time, but throw it away, generate both a new key for immediate use and a rollover key.

It would be more convenient if, when rollover+renew is enabled and there is no rollover key, generate only the rollover key and keep using the old key until next renewal.

Possible workarounds include preemptively generating new rollover keys or delaying deployment of new keys and certificates until after new TLSA records have been published to DNS (and some time for caches to expire).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant