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

feat: Support multiple active CAs in tctl auth export #51298

Merged
merged 5 commits into from
Jan 22, 2025

Conversation

codingllama
Copy link
Contributor

@codingllama codingllama commented Jan 21, 2025

Add multiple active CAs support to tctl auth export via the --out flag.

  • If a single active CA exists the behavior is the same as before
  • If multiple active CAs exist the error message is changed to refer to the --out flag
  • Any number of active CAs may be exported using --out without error

tctl before this PR:

$ tctl auth export --type=tls-user
ERROR: expected one TLS key pair, got 2

tctl after this PR:

$ tctl auth export --type=tls-user
ERROR: found 2 authorities to export, use --out to export all

$ tctl auth export --type=tls-user --out=ca
(stderr) Writing 2 files with prefix "ca"
(stdout) ca0.cer
(stdout) ca1.cer

$ cat ca?.cer
-----BEGIN CERTIFICATE-----
MIIDbTCCAlWgAwIBAgIRAIhXW7vBMC0zFynLPShxFH0wDQYJKoZIhvcNAQELBQAw
(...)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDbDCCAlSgAwIBAgIQem9J7psCMl6QSKbClOdbtTANBgkqhkiG9w0BAQsFADBQ
(...)
-----END CERTIFICATE-----

Follow up from #51189.

#35444

Changelog: Added support for multiple active CAs in tctl auth export

@codingllama
Copy link
Contributor Author

Branched from #51189:

This also borrows inspiration from Gavin's #35754, although it has my own spin on it.

tool/tctl/common/auth_command.go Outdated Show resolved Hide resolved
tool/tctl/common/auth_command.go Outdated Show resolved Hide resolved
Copy link
Contributor

@GavinFrazar GavinFrazar left a comment

Choose a reason for hiding this comment

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

LGTM, I left a couple of suggestions.

Thanks for fixing this!

tool/tctl/common/auth_command.go Outdated Show resolved Hide resolved
tool/tctl/common/auth_command.go Outdated Show resolved Hide resolved
@codingllama
Copy link
Contributor Author

Many thanks for the quick reviews! I'll queue once the base PR is in.

@codingllama
Copy link
Contributor Author

Friendly ping @avatus for g1 approval?

Base automatically changed from codingllama/export-all-funcs to master January 22, 2025 15:44
@codingllama codingllama force-pushed the codingllama/export-all-tctl branch from 3952448 to 492ba3d Compare January 22, 2025 16:44
@codingllama
Copy link
Contributor Author

Rebased on top of master, no changes. I'll prep some prereq backports then merge this one.

@codingllama codingllama enabled auto-merge January 22, 2025 19:19
@codingllama codingllama added this pull request to the merge queue Jan 22, 2025
Merged via the queue into master with commit 6181c0b Jan 22, 2025
41 checks passed
@codingllama codingllama deleted the codingllama/export-all-tctl branch January 22, 2025 19:52
@public-teleport-github-review-bot

@codingllama See the table below for backport results.

Branch Result
branch/v15 Failed
branch/v16 Failed
branch/v17 Create PR

codingllama added a commit that referenced this pull request Jan 22, 2025
* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
codingllama added a commit that referenced this pull request Jan 22, 2025
* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
github-merge-queue bot pushed a commit that referenced this pull request Jan 22, 2025
)

* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
github-merge-queue bot pushed a commit that referenced this pull request Jan 22, 2025
)

* Support multiple active CAs in `tctl auth export`

* Remove the ExportAuthoritiesSecrets func

* Mention path in the --out-prefix help

* Rename --out-prefix to --out

* Write script-friendly output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants