Skip to content
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

Make Intermediate CA optional in TLS configuration #166

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

keremdndr
Copy link

  • Ensure that Root CA is always added to the cert pool.
  • If the Intermediate CA file is present, add it to the cert pool.
  • Log a warning and skip Intermediate CA if the file is missing or invalid.

tls.go Outdated
interCA, err := os.ReadFile(c.IntermediateCAPath)
if err != nil {
return nil, fmt.Errorf("Error while reading Intermediate CA file: " + c.IntermediateCAPath + " error: " + err.Error())
fmt.Printf("Warning: Unable to read Intermediate CA file: %s, error: %v", c.IntermediateCAPath, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using fmt.Printf, can we use our log implementation?

tls.go Outdated
interCA, err := os.ReadFile(c.IntermediateCAPath)
if err != nil {
return nil, fmt.Errorf("Error while reading Intermediate CA file: " + c.IntermediateCAPath + " error: " + err.Error())
fmt.Printf("Warning: Unable to read Intermediate CA file: %s, error: %v", c.IntermediateCAPath, err)
fmt.Println("Intermediate CA will be skipped.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use our log implementation, we can arrange level. Not required to add prefix Warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants