-
Notifications
You must be signed in to change notification settings - Fork 70
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
Better error message for missing intermediates #182
base: master
Are you sure you want to change the base?
Conversation
|
||
if len(intermediates.Subjects()) == 0 { | ||
// No intermediates found, maybe broken chain. Let's try AIA fetching? | ||
intermediate := fetchAIA(certs[0]) |
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.
We're only trying the first one in the chain? I guess it's pretty rare to have more than 3 certs in a chain.
for _, url := range cert.IssuingCertificateURL { | ||
resp, err := http.Get(url) | ||
if err != nil { | ||
continue |
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.
Should we log errors?
@@ -109,6 +111,30 @@ func caBundle(caPath string) *x509.CertPool { | |||
return bundle | |||
} | |||
|
|||
func fetchAIA(cert *x509.Certificate) *x509.Certificate { | |||
for _, url := range cert.IssuingCertificateURL { |
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.
rfc4325 says we should look at the file extension to see if it's .cer or .p7c. We could return if it's .p7c and only support .cer fetching
should this be merged @mcpherrinm or does it need more work? |
I think we should do the p7c/cer and recursive AIA fetching stuff in comments |
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'm going to handle updating this
If verification fails, retries using intermediate retrieved via AIA fetching and updates error message to make it clearer what the misconfiguration is.
Used to print:
But now shows:
This is best-effort.