TUN-2334: remove tlsConfig.ServerName special case
This commit is contained in:
parent
979e5be8ab
commit
a412f629c2
|
@ -5,7 +5,6 @@ import (
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -18,6 +17,8 @@ import (
|
||||||
const (
|
const (
|
||||||
OriginCAPoolFlag = "origin-ca-pool"
|
OriginCAPoolFlag = "origin-ca-pool"
|
||||||
CaCertFlag = "cacert"
|
CaCertFlag = "cacert"
|
||||||
|
|
||||||
|
edgeTLSServerName = "cftunnel.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CertReloader can load and reload a TLS certificate from a particular filepath.
|
// CertReloader can load and reload a TLS certificate from a particular filepath.
|
||||||
|
@ -126,7 +127,7 @@ func CreateTunnelConfig(c *cli.Context) (*tls.Config, error) {
|
||||||
rootCAs = append(rootCAs, c.String(CaCertFlag))
|
rootCAs = append(rootCAs, c.String(CaCertFlag))
|
||||||
}
|
}
|
||||||
|
|
||||||
userConfig := &TLSParameters{RootCAs: rootCAs}
|
userConfig := &TLSParameters{RootCAs: rootCAs, ServerName: edgeTLSServerName}
|
||||||
tlsConfig, err := GetConfig(userConfig)
|
tlsConfig, err := GetConfig(userConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -142,10 +143,6 @@ func CreateTunnelConfig(c *cli.Context) (*tls.Config, error) {
|
||||||
rootCAPool.AddCert(cert)
|
rootCAPool.AddCert(cert)
|
||||||
}
|
}
|
||||||
tlsConfig.RootCAs = rootCAPool
|
tlsConfig.RootCAs = rootCAPool
|
||||||
tlsConfig.ServerName = "cftunnel.com"
|
|
||||||
} else if edgeAddrs := c.StringSlice("edge"); len(edgeAddrs) > 0 {
|
|
||||||
// Set for development environments and for testing specific origintunneld instances
|
|
||||||
tlsConfig.ServerName, _, _ = net.SplitHostPort(edgeAddrs[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if tlsConfig.ServerName == "" && !tlsConfig.InsecureSkipVerify {
|
if tlsConfig.ServerName == "" && !tlsConfig.InsecureSkipVerify {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// TODO: Remove the above build tag and include this test when we start compiling with Golang 1.10.0+
|
|
||||||
|
|
||||||
package tlsconfig
|
package tlsconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in New Issue