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

[question] Does pkg/transport not support multiple tls root ca files? #10400

Closed
Fullstop000 opened this issue Jan 14, 2019 · 2 comments
Closed
Labels

Comments

@Fullstop000
Copy link
Contributor

Fullstop000 commented Jan 14, 2019

I'm working on a distributed system and use pkg/transport and raft. When I try to set multiple root ca files in TLSInfo, it seems we can only set one ca file because there is only a public string type field called TrustedCAFile.

After a little code digging, I find when generating a normal tls config used by crypto/tls, the cafiles() only use what is set in TrustedCAFile as the root CA

// cafiles returns a list of CA file paths.
func (info TLSInfo) cafiles() []string {
cs := make([]string, 0)
if info.TrustedCAFile != "" {
cs = append(cs, info.TrustedCAFile)
}
return cs
}

if len(cs) > 0 {
cfg.RootCAs, err = tlsutil.NewCertPool(cs)
if err != nil {
return nil, err
}
}

This behavior confuses me and I come up a few questions:

  1. It seems there is no easy way to add root CAs if I want to create a listener by NewTimeoutListener or a transport by NewTransport
  2. If I want to use the same CA for every node ( a node can be both a client and a server) and set it as TrustedCAFile, the client auth will be enabled which is not required
    cfg.ClientAuth = tls.NoClientCert
    if info.TrustedCAFile != "" || info.ClientCertAuth {
    cfg.ClientAuth = tls.RequireAndVerifyClientCert
    }
@jingyih
Copy link
Contributor

jingyih commented Mar 4, 2019

cc @wenjiaswe

@stale
Copy link

stale bot commented Apr 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

2 participants