Skip to content

Commit

Permalink
Disable TLS for proxy connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Jun 5, 2024
1 parent f70121b commit f24e18c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions harness/go/harness/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,23 @@ func NewRunner(config RunnerConfig, feature *PreparedFeature) (*Runner, error) {
}()

// Create client
var err error
tlsCfg, err := LoadTLSConfig(r.ClientCertPath, r.ClientKeyPath)
if err != nil {
return nil, err
}

r.Feature.ClientOptions.HostPort = r.ServerHostPort
if r.Feature.ClientUsesProxy {
r.Feature.ClientOptions.HostPort = r.ProxyListenHostPort
} else {
// Don't use TLS for the proxy connection
r.Feature.ClientOptions.ConnectionOptions.TLS = tlsCfg
}
r.Feature.ClientOptions.Namespace = r.Namespace
if r.Feature.ClientOptions.Logger == nil {
r.Feature.ClientOptions.Logger = r.Log
}
var err error
tlsCfg, err := LoadTLSConfig(r.ClientCertPath, r.ClientKeyPath)
if err != nil {
return nil, err
}
r.Feature.ClientOptions.ConnectionOptions.TLS = tlsCfg

if r.Feature.BeforeDial != nil {
if err = r.Feature.BeforeDial(r); err != nil {
Expand All @@ -113,6 +116,7 @@ func NewRunner(config RunnerConfig, feature *PreparedFeature) (*Runner, error) {

savedValue := r.Feature.ClientOptions.HostPort
r.Feature.ClientOptions.HostPort = r.ServerHostPort
r.Feature.ClientOptions.ConnectionOptions.TLS = tlsCfg
if r.DirectClient, err = client.Dial(r.Feature.ClientOptions); err != nil {
return nil, fmt.Errorf("failed creating client: %w", err)
}
Expand Down

0 comments on commit f24e18c

Please sign in to comment.