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

Backport PKI Intermediate Revocation bug fix and test improvements #16054

Merged
merged 2 commits into from
Jun 17, 2022

Commits on Jun 17, 2022

  1. Refactor PKI tests for speed (#15999)

    * Refactor role issuance tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	5.879s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	1.063s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor role key bit tests to use direct backend
    
    Also removes redundant cases.
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	136.605s
    
    After:
    
    	github.com/hashicorp/vault/builtin/logical/pki	24.713s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor common name test to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.767s
    
    After:
    
    	github.com/hashicorp/vault/builtin/logical/pki	0.611s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor device cert tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.725s
    
    After:
    
    	github.com/hashicorp/vault/builtin/logical/pki	0.402s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor invalid parameter test to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	3.777s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.021s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor Alt Issuer tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.560s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.111s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor root idempotency tests to use direct backend
    
    As a result, we've had to import a root cert from elsewhere in the test
    suite, rather than using the one off the cluster.
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.399s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.523s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Move PKI direct backend helpers to common location
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor OID SANs test to direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	5.284s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.808s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor allowed serial numbers test to direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.789s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.600s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor URI SANs to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.245s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.600s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor Full Chain CA tests to direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	14.503s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	2.082s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Update Allow Past CA tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.323s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.322s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Convert existing-key root test to direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.430s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.370s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor CRL enable/disable tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	5.738s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	2.482s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Update intermediate existing key tests to use direct backend
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	4.182s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	0.416s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Refactor Issuance TTL verification tests to use direct backend
    
    Also shorten sleep duration slightly by precisely calculating it
    relative to the actual cert life time.
    
    Before:
    	github.com/hashicorp/vault/builtin/logical/pki	19.755s
    
    After:
    	github.com/hashicorp/vault/builtin/logical/pki	11.521s
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    cipherboy committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    b09f65d View commit details
    Browse the repository at this point in the history
  2. Fix leaf revocation under intermediate CAs (#16052)

    * Add test for revocation under intermediate CA
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    
    * Allow revocation of certs with key-less issuers
    
    In Vault 1.11's multiple issuer functionality, we incorrectly fetched
    the full CA signing bundle for validating revocation of leaf certs (when
    attempting to prohibit revocation of issuers in the mount). When the
    issuer lacked a key (such as the root issuer on an intermediate mount),
    this signing bundle creation failed.
    
    Instead of fetching the full CA signing bundle, fetch instead the raw
    certutil.CertBundle and parse it (to x509.Certificate form) ourselves.
    
    This manifests as the error on revocation:
    
    > URL: PUT http://127.0.0.1:8200/v1/pki_int/revoke
    > * could not fetch the CA certificate for issuer id 156e1b99-4f04-5b5e-0036-cc0422c0c0d3: unable to fetch corresponding key for issuer 156e1b99-4f04-5b5e-0036-cc0422c0c0d3; unable to use this issuer for signing
    
    Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
    cipherboy committed Jun 17, 2022
    Configuration menu
    Copy the full SHA
    8f414a1 View commit details
    Browse the repository at this point in the history