Skip to content

Commit

Permalink
Merge pull request #437 from openziti/use-env-proxy-settings
Browse files Browse the repository at this point in the history
use env proxy settings for HTTP calls. Fixes #436
  • Loading branch information
plorenz authored Oct 11, 2023
2 parents 24ea613 + 5946b41 commit eaaa922
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ziti/enroll/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ func enrollUpdb(username, password string, token *ziti.EnrollmentClaims, caPool
TLSClientConfig: &tls.Config{
RootCAs: caPool,
},
Proxy: http.ProxyFromEnvironment,
},
}

Expand Down Expand Up @@ -345,6 +346,7 @@ func enrollOTT(token *ziti.EnrollmentClaims, cfg *ziti.Config, caPool *x509.Cert
TLSClientConfig: &tls.Config{
RootCAs: caPool,
},
Proxy: http.ProxyFromEnvironment,
},
}
resp, err := client.Post(token.EnrolmentUrl(), "application/x-pem-file", bytes.NewReader(csrPem))
Expand Down Expand Up @@ -426,6 +428,7 @@ func enrollCA(token *ziti.EnrollmentClaims, cfg *ziti.Config, caPool *x509.CertP
RootCAs: caPool,
Certificates: []tls.Certificate{*clientCert},
},
Proxy: http.ProxyFromEnvironment,
},
}
resp, err := client.Post(token.EnrolmentUrl(), "text/plain", bytes.NewReader([]byte{}))
Expand Down Expand Up @@ -461,6 +464,7 @@ func enrollCAAuto(enFlags EnrollmentFlags, cfg *ziti.Config, caPool *x509.CertPo
RootCAs: caPool,
Certificates: []tls.Certificate{*clientCert},
},
Proxy: http.ProxyFromEnvironment,
},
}

Expand Down Expand Up @@ -507,6 +511,7 @@ func enrollCAAuto(enFlags EnrollmentFlags, cfg *ziti.Config, caPool *x509.CertPo
func FetchServerCert(urlRoot string) (*x509.Certificate, error) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
Proxy: http.ProxyFromEnvironment,
}
client := &http.Client{Transport: tr}

Expand Down Expand Up @@ -542,6 +547,7 @@ func FetchCertificates(urlRoot string, rootCaPool *x509.CertPool) []*x509.Certif
httpClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{RootCAs: rootCaPool},
Proxy: http.ProxyFromEnvironment,
},
}

Expand Down

0 comments on commit eaaa922

Please sign in to comment.