STAC-22970: Validate HTTPS endpoints protected by self-signed certificates or signed with private CA #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for private CA and self-signed certificates in HTTPS connections
This PR adds support for connecting to SUSE Observability instances protected with self-signed certificates or certificates signed by private CAs, providing a secure alternative to the existing --skip-ssl flag.
Summary
Instead of completely disabling SSL verification with --skip-ssl, users can now provide their own self-signed certificates or trusted CA certificates to validate HTTPS connections.
Changes
New Command Line Flags
Flag Usage Scenarios
sts context save --name staging --url https://staging.internal --api-token token123 --ca-cert-path /path/to/ca.crt
Validates certificates against the provided CA certificate file.
sts context save --name staging --url https://staging.internal --api-token token123 --ca-cert-base64-data base64-encoded-certificate-data
Validates certificates against the provided base64-encoded CA certificate.
sts context save --name test --url https://test.local --api-token token123 --ca-cert-path /path/to/ca.crt --ca-cert-base64-data ignored_data
When both flags are provided, --ca-cert-path takes precedence.
sts context save --name unsafe --url https://test.local --api-token token123 --skip-ssl --ca-cert-path /path/to/ca.crt
When --skip-ssl is set, any CA certificate flags are ignored, and SSL verification is completely disabled.
sts context savestores ca-cert data, if provided, to~/.config/stackstate-cli/config.yamlFor example
config before
go run main.go context save --name viliakov --url https://viliakov.sandbox.stackstate.io --api-token ... --ca-cert-path=/Users/viliakov/Workspace/WIP/STAC-22970/viliakov.sandbox.stackstate.io.crt ✅ Connection verified to https://viliakov.sandbox.stackstate.io (Platform version: 2.3.5) ✅ Saved context: 'viliakov'config after