Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae6cbd1

Browse files
author
Rajdeep Kaur
committedMay 22, 2021
Add: support specifying cipher suites in tls connection jaegertracing#3019
1 parent f0d0518 commit ae6cbd1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎pkg/config/tlscfg/options.go

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"crypto/tls"
1919
"crypto/x509"
2020
"fmt"
21+
"github.com/coreos/etcd/pkg/tlsutil"
2122
"io"
2223
"io/ioutil"
2324
"path/filepath"
@@ -34,6 +35,7 @@ type Options struct {
3435
ServerName string `mapstructure:"server_name"` // only for client-side TLS config
3536
ClientCAPath string `mapstructure:"client_ca"` // only for server-side TLS config for client auth
3637
SkipHostVerify bool `mapstructure:"skip_host_verify"`
38+
Ciphers string `mapstructure:"ciphers"`
3739
certWatcher *certWatcher `mapstructure:"-"`
3840
}
3941

@@ -52,6 +54,17 @@ func (p *Options) Config(logger *zap.Logger) (*tls.Config, error) {
5254
ServerName: p.ServerName,
5355
InsecureSkipVerify: p.SkipHostVerify,
5456
}
57+
if len(p.Ciphers) > 0 {
58+
cs := make([]uint16, len(p.Ciphers))
59+
for i, s := range p.Ciphers {
60+
var ok bool
61+
cs[i], ok = tlsutil.GetCipherSuite(p.Ciphers)
62+
if !ok {
63+
return nil, fmt.Errorf("unexpected TLS cipher suite %q", s)
64+
}
65+
}
66+
tlsCfg.CipherSuites = cs
67+
}
5568
if p.ClientCAPath != "" {
5669
certPool := x509.NewCertPool()
5770
if err := addCertToPool(p.ClientCAPath, certPool); err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.