From 0dd90f3d2cb1bf0273a4f2b3589c0c6c71fa2191 Mon Sep 17 00:00:00 2001 From: Paul Okstad Date: Fri, 14 Aug 2020 12:28:31 -0700 Subject: Respect x509 common name Enables the recognition of the x509 certificate common name field. This is needed due to a breaking change in Go v1.15. This workaround is intended to be removed in GitLab v14. --- client/dial.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/dial.go b/client/dial.go index 4fce2ac5b..d6a0342b8 100644 --- a/client/dial.go +++ b/client/dial.go @@ -2,9 +2,11 @@ package client import ( "context" + _ "crypto/x509" // ensure x509 package init happens after this package "fmt" "net" "net/url" + "os" "time" gitaly_x509 "gitlab.com/gitlab-org/gitaly/internal/x509" @@ -110,3 +112,16 @@ func getConnectionType(rawAddress string) connectionType { return invalidConnection } } + +// respectCommonName ensures that the deprecated common name field is not +// ignored. +// For more info: https://golang.org/doc/go1.15#commonname +// TODO: remove this hack in +func respectCommonName() { + godebug := "GODEBUG" + os.Setenv(godebug, os.Getenv(godebug)+",x509ignoreCN=0") +} + +func init() { + respectCommonName() +} -- cgit v1.2.3