-
Notifications
You must be signed in to change notification settings - Fork 94
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: save YAML spec used to generate support bundle/preflight #1713
Conversation
c24a3a1
to
8d3d641
Compare
while testing this I noticed that the output spec gets wrapped oddly: input spec:
spec.yaml from output bundle:
|
The YAML wrapping and structure ordering differences are expected - we're re-using the same method as the troubleshoot/pkg/loader/loader.go Lines 111 to 136 in 0113624
Regarding the missing troubleshoot/pkg/apis/troubleshoot/v1beta2/outcome.go Lines 3 to 13 in 10a34c2
Please let me know if this is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this clean approach of reusing redactors. It however comes with limitations of missing some cases such as redacting TLS certs & keys, complex commands in runPod
, exec
or run
collectors
I tested using this spec and TLS params were not redacted. For this specific case, I think we can add a redactor similar to https://troubleshoot.sh/docs/redact/aws-credentials/ to redact this
---
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
spec:
collectors:
- postgres:
collectorName: pg
uri: postgresql://user:password@hostname:5432/defaultdb?sslmode=require
tls:
cacert: |
-----BEGIN CERTIFICATE-----
MIIC0zCCAbugAwIBAgIUFfxLmF5NnpsVWjZZEYMsOziWLJ0wDQYJKoZIhvcNAQEL
BQAwEjEQMA4GA1UEAwwHUm9vdCBDQTAeFw0yNTAxMDIxMjM0MjZaFw0yNjAxMDIx
MjM0MjZaMBIxEDAOBgNVBAMMB1Jvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQDz9qD7kebmAMODM/nZapSKxzR3Zmfiyej3ZIpUNsx+J1iVnMY0
du8Nd/coCvrl3zWMNp0o3aC3asf/9pYdluq9nhzlhJ/4lEc3d1O+cvrChB6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lL23eFQZh3bz9VCgk1KPPvi7
21oKuJczAlJoSRVTcFUHP+3hs1qtbTDk3nKkw+kCgYBEe0N6HgveemCVf7SM4wHK
EoajmtOXlieCCEcWha/NsdaleXQmFhOgJkjirBj6XGFxEXX8+W2yy8DD027XgR5k
D5fuQkMNOmIzIKtgRML+W+vC5UUH0i9DIYNxJ5QAk++388bIrvd7ZLvUxIpW+JH/
2Qi6wSRvRTbThG6ZL93YKw==
-----END PRIVATE KEY-----
I'm however not sure if we can find a good enough way to redact user crafted commands. Perhaps we would just redact entire commands and environment variables.
- http:
collectorName: healthz
get:
url: http://api:3000/healthz
timeout: 5s
headers:
Authorization: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' The auth token here does not get redacted as well |
This is a gap in the redactors, which would block this change - there's no way we can or should store private keys and there's no way to supply them to Troubleshoot otherwise.
Let's be very mindful of adding complexity if we can. This task is getting more complex the more we look at it, and we may need to divert and get a design review before adding more code. |
As discussed, I've updated the PR to have extra TLS private key redactor for the final YAML file. Please let me know how it goes. |
57601cc
to
9e6affc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more little issue needed still
Description, Motivation and Context
As of now, it is not possible to know which final YAML spec is used to generate a support bundle.
Knowing the spec used to generate a support bundle will aid with further troubleshooting, to understand the content of a support bundle, e.g. which collectors, analyzers are used, any render, conditional error?
Demo: https://asciinema.org/a/rTzxKjMRQezLAfNpTLEqJGESZ
Checklist
Does this PR introduce a breaking change?