Skip to content
Snippets Groups Projects
Commit f0382112 authored by ale's avatar ale
Browse files

Add option to sso-proxy to set SSL server_name explicitly

parent ff7a1048
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
type Backend struct { type Backend struct {
Host string `yaml:"host"` Host string `yaml:"host"`
Upstream []string `yaml:"upstream"` Upstream []string `yaml:"upstream"`
ServerName string `yaml:"tls_server_name"`
ClientTLSConfig *clientutil.TLSClientConfig `yaml:"client_tls"` ClientTLSConfig *clientutil.TLSClientConfig `yaml:"client_tls"`
AllowedGroups []string `yaml:"allowed_groups"` AllowedGroups []string `yaml:"allowed_groups"`
...@@ -45,6 +46,13 @@ func (b *Backend) newHandler(ssow *httpsso.SSOWrapper) (http.Handler, error) { ...@@ -45,6 +46,13 @@ func (b *Backend) newHandler(ssow *httpsso.SSOWrapper) (http.Handler, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
// By setting the ServerName on the tls.Config, we
// hope to decouple TLS certificate verification from
// the details of the HTTP Host header included in the
// request, so that the transport layer will work
// regardless of the HTTP request details.
tlsConfig.ServerName = b.ServerName
} }
proxy.Transport = clientutil.NewTransport(b.Upstream, tlsConfig, nil) proxy.Transport = clientutil.NewTransport(b.Upstream, tlsConfig, nil)
......
package proxy package proxy
import ( import (
"crypto/rand"
"crypto/tls" "crypto/tls"
"io" "io"
"io/ioutil" "io/ioutil"
...@@ -32,7 +31,7 @@ func TestProxy(t *testing.T) { ...@@ -32,7 +31,7 @@ func TestProxy(t *testing.T) {
} }
defer os.RemoveAll(tmpdir) defer os.RemoveAll(tmpdir)
pub, priv, err := ed25519.GenerateKey(rand.Reader) pub, priv, err := ed25519.GenerateKey(nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment