Closed s-l-teichmann closed 2 years ago
@s-l-teichmann what kind of missconfiguration would trigger this?
@s-l-teichmann what kind of missconfiguration would trigger this?
Something not being a valid certificate file like:
./csaf_checker --client-cert=/etc/passwd --client-key=/etc/passwd
2022/07/26 17:33:25 error: tls: failed to find any PEM data in certificate input
The check is the same as before. It is only done earlier.
In my tests this already fails early, because the current check is triggered by p.httpClient() which happens to be called by checkProviderMetadata(), which is the first test. Is the change more about the right place where to check and a premature death cannot be triggered?
In my tests this already fails early, because the current check is triggered by p.httpClient() which happens to be called by checkProviderMetadata(), which is the first test. Is the change more about the right place where to check and a premature death cannot be triggered?
What ever you mean by premature death. This PR loads the configured certs before the checking machine is started ... and yes, this the right place to do this.
p.httpClient()
should not die ... if this creates an error, it should be properly handled with an error code path.
Do not die with
log.Fatalf
in the middle of checking when client certs are configured badly. Check this right at the start.