问题原文
原帖链接 · spraff · CC BY-SA 3.0
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.
社区高分解答
原帖链接 · phanaz · CC BY-SA 3.0
If you want to create multiple certificates with the same subject, you can change your configuration like that:
You can change in the CA section (probably [CA_default]) in your openssl.cnf the setting
unique_subject = no
But this setting is also saved in file index.txt.attr, you have to change this, too. Otherwise it will not work.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
