renew-ca command does not copy subject from old CA

Open
#1,488 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
shell

Research direction

Start from the easyrsa shell entry point and the renew-ca command path, then follow where the new CA request is built and where the old subject is read from the archived certificate. Reproduce by creating a CA with EASYRSA_DN=org, switching to cn_only, and running ./easyrsa renew-ca; compare the new subject with pki/expired-ca.list. Done looks like the renewed CA preserves the full old subject, or the command warns before replacing it, with existing leaf certificates still verifying.

Written by the indexing model from the issue text.

Description

question renew

When renewing a CA generated using org after changing EASYRSA_DN to cn_only, the renewed CA only inherits the CN from the old CA, breaking the chain of trust for leaves.

Seems like a saner default to inherit the entire subject by default to avoid this? Or at least issue a warning that the renewed CA will not work for existing leaf certificates, and all leaf certificates will need to be regenerated as well.

$ sudo easyrsa renew-ca
Using Easy-RSA 'vars' configuration:
* /etc/easy-rsa/vars
SHA2-256(/etc/easy-rsa/pki/ca.crt)= <...>
Enter pass phrase for /etc/easy-rsa/pki/private/ca.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Common Name (eg: your user, host, or server name) [Henry Tung (CA)]:

NEW CA CERTIFICATE:

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            <...>
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=Henry Tung (CA)
        Validity
            Not Before: Nov 18 00:32:39 2026 GMT
            Not After : Nov 15 00:32:39 2036 GMT
        Subject: CN=Henry Tung (CA)
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    <...>
                Exponent: <...>
        X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Subject Key Identifier:
                <...>
            X509v3 Authority Key Identifier:
                <...>
            X509v3 Key Usage:
                Certificate Sign, CRL Sign
    Signature Algorithm: sha256WithRSAEncryption
    Signature Value:
        <...>

WARNING !!!

Your CA certificate is ready to be renewed. (Details above)

This new CA certificate will completely replace the old one.
The old CA will be archived to the 'expired-ca.list' file.

Please check the details above are correct, before continuing.

Type the word 'yes' to continue, or any other input to abort.
  Install the new CA certificate ? yes


Notice
------
CA certificate has been successfully renewed.

Your old CA certificate has been added to the expired CA list at:
* /etc/easy-rsa/pki/expired-ca.list

Your renewed CA certificate is at:
* /etc/easy-rsa/pki/ca.crt

$ cat pki/expired-ca.list
# Easy-RSA expired CA certificate list:
# =====================================

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            <...>
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=<...>, ST=<...>, L=<...>, O=<...>, OU=<...>, CN=Henry Tung (CA), emailAddress=<...>
        Validity
            Not Before: Dec 28 05:31:55 2016 GMT
            Not After : Dec 26 05:31:55 2026 GMT
        Subject: C=<...>, ST=<...>, L=<...>, O=<...>, OU=<...>, CN=Henry Tung (CA), emailAddress=<...>
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    <...>
                Exponent: <...>
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                <...>
            X509v3 Authority Key Identifier:
                <...>
            X509v3 Basic Constraints:
                CA:TRUE
            X509v3 Key Usage:
                Certificate Sign, CRL Sign
    Signature Algorithm: sha256WithRSAEncryption
    Signature Value:
        <...>
-----BEGIN CERTIFICATE-----
<...>
-----END CERTIFICATE-----
$
Dominant language
Shell
Stars
4.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenVPN/easy-rsa

All issues in OpenVPN/easy-rsa

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.