diff --git a/main.go b/main.go index c66bb58..bc55a1a 100644 --- a/main.go +++ b/main.go @@ -8,8 +8,7 @@ import ( auth "github.com/korylprince/go-ad-auth/v3" ) - -const WSDCCertPem := ` +const WSDCCertPem = ` -----BEGIN CERTIFICATE----- MIIJZzCCCE+gAwIBAgIKYQTouAAAAAAABzANBgkqhkiG9w0BAQsFADCBpzELMAkG A1UEBhMCQVUxDDAKBgNVBAgTA05TVzEPMA0GA1UEBxMGU3lkbmV5MSQwIgYDVQQK @@ -73,9 +72,13 @@ func main() { password := flag.String("password", "pass", "Password to use when attempting to bind to AD") flag.Parse() - // Add custom certificate to the system cert pool - system := x509.SystemCertPool() + // Get a copy of the system defined CA's + system, err := x509.SystemCertPool() + if err != nil { + panic("failed to access system CA list") + } + // Add custom certificate to the system cert pool ok := system.AppendCertsFromPEM([]byte(WSDCCertPem)) if !ok { panic("failed to parse WSDC intermediate certificate")