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

Exposes additional configuration knobs for TLS and updates docker-config so they can be set using env variables #869

Merged
merged 11 commits into from
Oct 16, 2020

Conversation

mastermanu
Copy link
Member

@mastermanu mastermanu commented Oct 16, 2020

  • Adds support for specifying Server/Internode related TLS certificates using base64
  • Updates docker-compose so TLS and Cassandra can be injected using environment variables

Tested via unit tests and a private deployment

@mastermanu mastermanu marked this pull request as draft October 16, 2020 14:25
common/service/config/config.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
@@ -77,57 +92,142 @@ func (s *localStoreCertProvider) FetchServerCertificate() (*tls.Certificate, err
return s.serverCert, nil
}

func (s *localStoreCertProvider) fetchServerCertificateFromInline() (*tls.Certificate, error) {
if s.tlsSettings.Server.CertData == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we return an error here?

if !s.tlsSettings.Server.InlineData && len(s.tlsSettings.Server.ClientCAFiles) == 0 {
return nil, nil
}
if s.tlsSettings.Server.InlineData && len(s.tlsSettings.Server.ClientCaData) == 0 {
return nil, nil
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we return an error here?

Copy link
Member Author

Choose a reason for hiding this comment

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

we were not returning an error before my change, but am not opposed to returnong one here given that a user who requires mutual authentication and doesn't set this has a broken environment

Copy link
Member

Choose a reason for hiding this comment

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

Disregard. My mistake, sorry.

common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
common/rpc/encryption/localStoreCertProvider.go Outdated Show resolved Hide resolved
for _, ca := range caFiles {
if ca == "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

did this so that we are not forced to create pass redundant variables as we did in the tls sample

s.RLock()
if s.serverCAs != nil {
defer s.RUnlock()
return s.clientCAs, nil
return s.serverCAs, nil
Copy link
Member Author

Choose a reason for hiding this comment

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

this looks like this was an existing bug?

certBytes, err = ioutil.ReadFile(cfg.TLS.CertFile)
if err != nil {
return nil, fmt.Errorf("error reading client certificate file: %w", err)
}
}

if cfg.TLS.CertData != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Would putting this inside an else from the previous if increase readability?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, i can do else if.

@mastermanu mastermanu marked this pull request as ready for review October 16, 2020 19:04
}

if cfg.TLS.CaData != "" && cfg.TLS.CaFile != "" {
return nil, errors.New("Cannot specify both caData and caFile properties")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be additive though? Because users may want multiple CA with some being intermediate and some specified in files with others in bytes?

Copy link
Member Author

Choose a reason for hiding this comment

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

talked offline. we'll keep it simple for now (also removed merging behavior for the regular TLS specifications), but if there is user interest, then we can add in merging fairly easily

@mastermanu mastermanu merged commit 7d065a2 into temporalio:master Oct 16, 2020
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.

No way to set cassandra configs (creds, tls option, etc) via docker-compose
3 participants