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

Fix #20594 : Feature - 'consul tls cert renew' command #20604

Closed

Conversation

vijayraghav-io
Copy link
Contributor

@vijayraghav-io vijayraghav-io commented Feb 13, 2024

Description

Add new cli cmd to be able to renew existing TLS Server Certificate -
consul tls cert renew

fixes #20594

The approach used to renew existing TLS certificate -

  1. New Public Key (cert file) is created with same (existing) input private key.
  2. The same CA used to generate initial cert is used to sign. CA file path to be input.

Testing & Reproduction steps

  1. Create CA with cmd consul tls ca create
  2. Create Cert with cmd consul tls cert create -server
  3. Renew Certificate created in step 2 with same private key created in step 2 - with new cmd - consul tls cert renew -server -existingkey=<key file created in step2>
  4. Replace cert file created in step 2 with new (renewed) cert file created in step3.
  5. This will avert having to distribute a new trust chain to all clients and avoid a service disruption to clients.

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@github-actions github-actions bot added theme/cli Flags and documentation for the CLI interface theme/tls Using TLS (Transport Layer Security) or mTLS (mutual TLS) to secure communication theme/certificates Related to creating, distributing, and rotating certificates in Consul labels Feb 13, 2024
@vijayraghav-io vijayraghav-io changed the title Fix #20594 : Feature - tls cert renew command Fix #20594 : Feature - 'consul tls cert renew' command Feb 13, 2024
@vijayraghav-io vijayraghav-io marked this pull request as ready for review February 14, 2024 15:45
@vijayraghav-io
Copy link
Contributor Author

Hi @david-yu,
Kindly review this PR.

@vijayraghav-io
Copy link
Contributor Author

vijayraghav-io commented Feb 15, 2024

Did one more round of self review, thought of adding an improvement -
Ideally for cert renew command the args like domain, dc, server/client/cli,.. should not be required to be input. These should be read from existing certificate. So added arg -existingcert and removed redundant args.
The updated arg list is -
-existingcert
-existingkey
-ca
-key
-days
-dnsnames
-ipaddresses

-existingcert and -existingkey are mandatory. Paths to existing cert.pem and key.pem files that have to be renewed.
-ca and -key -> Paths to CA cert and key files
-days defaults to 365
-dnsnames and -ipaddresses -> These are also read from existing cert, the additional dnsnames and ipaddresses if any can be added here while renewing.

@reskin89

Copy link

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

@github-actions github-actions bot added the meta/stale Automatically flagged for inactivity by stalebot label Apr 16, 2024
@vijayraghav-io
Copy link
Contributor Author

Reminding to review this PR

@github-actions github-actions bot removed the meta/stale Automatically flagged for inactivity by stalebot label Apr 26, 2024
Copy link

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

@github-actions github-actions bot added the meta/stale Automatically flagged for inactivity by stalebot label Aug 26, 2024
Copy link

Closing due to inactivity. If you feel this was a mistake or you wish to re-open at any time in the future, please leave a comment and it will be re-surfaced for the maintainers to review.

@github-actions github-actions bot closed this Sep 25, 2024
@reskin89
Copy link

Bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta/stale Automatically flagged for inactivity by stalebot theme/certificates Related to creating, distributing, and rotating certificates in Consul theme/cli Flags and documentation for the CLI interface theme/tls Using TLS (Transport Layer Security) or mTLS (mutual TLS) to secure communication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consul tls command should be able to renew
2 participants