Skip to content

[Enhancement] Create a Tool to extract and display the certificates from the MachineConfig #3

Description

@vlours

Is your feature request related to a problem? Please describe.
We should create a tool available in SupportShell to retrieve the kubelet-ca.crt and ca.crt content from either Must-gather or oc Inspect logs and extract the Issuer, Not Before, Not After, Subject field.
This will help associates to identify when a certificate is expired and may help to resolve most of the cases when customers are complaining about issues to connect to pods through oc rsh or access pods' logs.

Describe the solution you'd like
The solution should include the bundle extraction from the yaml file. Something like:

for rendered in $(oc get mc -o json | jq -r '.items[] | select(.metadata.name | startswith("rendered")) | .metadata.name')
do
echo -e "\n${rendered} :" && oc get mc ${rendered} -o json | jq -r '.spec.config.storage.files[] | select(.path == "/etc/kubernetes/kubelet-ca.crt") | .contents.source'
done

And after reformating the bundle it should check the validity of the certificates, using something like:

openssl crl2pkcs7 -nocrl -certfile  /etc/kubernetes/kubelet-ca.crt |openssl pkcs7 -print_certs -text -noout | grep -A4 Issuer

Additional context
This tool may also accept validating bundle certificates against valid bundle files (instead of YAML files).

This is open to discussion.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions