I am creating a Certificate Authority for an intranet.
I have generated a root and intermediate CA and successfully signed a server certificate using the intermediate CA. The server certificate has CN=mysite.com
.
In the future this server certificate will expire and I will need to issue a new one. However, if I create another CSR with the same CN=mysite.com
then when I sign it I get
failed to update database
TXT_DB error number 2
This error goes away if I create a new CSR with a different CN, but the CNs have to be the same or the browser won't say it's valid, right?
How do I fix this?
EDIT: I'm following this guide -- everything's fine up until the end of the linked page, but when I try to repeat the steps on this page to create a second certificate, openssl demands that I give the new certificate a different CN.
SUBJ="/C=$C/ST=$ST/L=$L/O=$O/OU=$OU/CN=$CN"
# Generate CSR
echo "$PW" | openssl req \
-config "$CAROOT/intermediate/openssl.cnf" \
-new -sha256 -subj "$SUBJ" -passin stdin \
-key "$PRIV_ENC" -out "$CSR_INT" >/dev/null 2>&1 ||
{
>&2 echo "Could not openssl req";
exit 1;
}
# Sign CSR
openssl ca \
-config "$CAROOT/intermediate/openssl.cnf" \
-batch -extensions server_cert \
-days "$HTTP_DAYS" -notext -md sha256 \
-in "$CSR_INT" -out "$CRT_INT" ||
{
>&2 echo "Could not openssl ca";
exit 1;
}
It's the openssl ca
which fails.