Skip to content

feat: Add support for SSL cert modification - #697

Merged
johnramsden merged 5 commits into
canonical:mainfrom
johnramsden:john/CEPH-1162-ssl
Mar 25, 2026
Merged

johnramsden merged 5 commits into
canonical:mainfrom
johnramsden:john/CEPH-1162-ssl

Conversation

@johnramsden

@johnramsden johnramsden commented Mar 21, 2026 •

Copy link
Copy Markdown
Member

Description

Add support for SSL cert modification.

Currently there is no proper way to update certificates. This adds support for updating the existing certificates.

The design includes a new certificates subcommand leaving room for adding additional certificate types. The alternative would be moving the functionality under "enable rgw".

Unfortunately there is no current way of actually reloading certificates live. SIGHUP has no effect. There is a ssl_reload option for beast but it is only available in tentacle ceph/ceph#65842.

Note: Once we have migrated to tentacle, we can add functionality that supports auto reload. I propose what we should do here is have a reload occurring every 24 hours and issue a warning saying certificates will be updated in the background every 24 hours if the user does not issue the restart flag. I already mapped out this functionality once, it is fairly easy to add it is just not currently supported and the reload flag does nothing. Ill open an issue after merge.

Fixes #421

Type of change

Delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Documentation update (change to documentation only)

How has this been tested?

Added unit and integration tests verifying:

  • Certificate and key files are written with correct content and 0600 permissions
  • Command is rejected when RGW is not running
  • Command is rejected when RGW was not configured with SSL
  • Invalid base64 certificate or private key is rejected with descriptive errors
  • --restart causes immediate certificate pickup
  • Without --restart, the old certificate continues to be served until manual restart
  • --target rotates the certificate on a specific node (single-node self-target and
    multi-node cross-node)

Contributor checklist

Please check that you have:

  • self-reviewed the code in this PR
  • added code comments, particularly in less straightforward areas
  • checked and added or updated relevant documentation
  • checked and added or updated relevant release notes
  • added tests to verify effectiveness of this change

@johnramsden
johnramsden marked this pull request as ready for review March 21, 2026 02:02
@johnramsden
johnramsden marked this pull request as draft March 21, 2026 02:03
johnramsden and others added 3 commits March 23, 2026 09:54
Add a new CLI command to rotate RGW SSL certificates without needing to
disable and re-enable the service. The command writes the new certificate
and key to disk, and optionally restarts RGW for immediate pickup.

Without --restart, a warning is emitted advising that the service must
be restarted manually for the new certificate to take effect. The command
also validates that RGW was originally configured with SSL before
attempting to write certificates.

Refactors SSL file writing into a shared writeSSLFiles() helper used by
both EnableRGW and UpdateRGWCertificates.

Signed-off-by: John Ramsden <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add command reference and how-to guide for rotating RGW TLS
certificates using the new certificate set rgw command.

Signed-off-by: John Ramsden <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add unit tests for UpdateRGWCertificates (valid certs, invalid cert,
invalid key, RGW not active, SSL not configured) and RestartRGW
(success and failure). Update existing EnableRGW tests for refactored
error messages.

Add integration tests to CI workflow: certificate rotation with
--restart, rotation without restart, manual restart pickup, self-target
rotation, cross-node target rotation, and failure when RGW is not
running.

Signed-off-by: John Ramsden <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: John Ramsden <[email protected]>
@johnramsden
johnramsden marked this pull request as ready for review March 23, 2026 17:08
@johnramsden
johnramsden requested a review from sabaini March 23, 2026 20:36

@sabaini sabaini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @johnramsden looks good! Two notes inline

Comment thread microceph/ceph/rgw.go Resolved
Address review feedback: write SSL cert/key to temporary files first
and rename into place to prevent inconsistent state on partial failure.
Add client-side base64 validation for --ssl-certificate and
--ssl-private-key flags.

Signed-off-by: John Ramsden <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: John Ramsden <[email protected]>
@johnramsden

Copy link
Copy Markdown
Member Author

@sabaini See d78c3e9

@johnramsden
johnramsden requested a review from sabaini March 24, 2026 22:04

@sabaini sabaini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cheers, minor remark inline but nothing to block over

Add explicit empty-string validation for SSL certificate and key in both
the client-side command (validateSSLInputs) and server-side writeSSLFiles,
since empty strings pass base64 decoding silently.

Signed-off-by: John Ramsden <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
@johnramsden
johnramsden merged commit 706a3a6 into canonical:main Mar 25, 2026
26 checks passed
@johnramsden
johnramsden deleted the john/CEPH-1162-ssl branch March 25, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding easy certificate rotation for Rados Gateway in combination with LetsEncrypt Certificates

2 participants