Skip to content

Commit 9013e52

Browse files
authored
feat(auth): Enable client certificates by default (#10102)
Implications of this change: 1. If no default certificate sources are available in the environment (i.e. no SecureConnect or ECP cert), then the before & after behavior are identical. 2. If SecureConnect cert source is available (i.e. Googlers with EndpointVerification installed), then connections are automatically upgraded to mTLS. This is deemed a safe upgrade from policy enforcement perspective. From a latency perspective, since this does not impact workload use-cases, there should be negligible impact, even if the SecureConnect cert is from a TPM. 3. ECP cert source is enabled via certificate_config.json, which is not widely rolled out at the moment. Those with certificate_config.json configured already have the intention to enable client certificates anyway, so this saves them an extra flag to manage.
1 parent 3917cca commit 9013e52

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

auth/internal/transport/cba.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ func getTransportConfig(opts *Options) (*transportConfig, error) {
216216
// A nil default source can be returned if the source does not exist. Any exceptions
217217
// encountered while initializing the default source will be reported as client
218218
// error (ex. corrupt metadata file).
219-
//
220-
// Important Note: For now, the environment variable GOOGLE_API_USE_CLIENT_CERTIFICATE
221-
// must be set to "true" to allow certificate to be used (including user provided
222-
// certificates). For details, see AIP-4114.
223219
func getClientCertificateSource(opts *Options) (cert.Provider, error) {
224220
if !isClientCertificateEnabled() {
225221
return nil, nil
@@ -230,11 +226,14 @@ func getClientCertificateSource(opts *Options) (cert.Provider, error) {
230226

231227
}
232228

229+
// isClientCertificateEnabled returns true by default, unless explicitly set to false via env var.
233230
func isClientCertificateEnabled() bool {
234-
// TODO(andyrzhao): Update default to return "true" after DCA feature is fully released.
235-
// error as false is a good default
236-
b, _ := strconv.ParseBool(os.Getenv(googleAPIUseCertSource))
237-
return b
231+
if value, ok := os.LookupEnv(googleAPIUseCertSource); ok {
232+
// error as false is OK
233+
b, _ := strconv.ParseBool(value)
234+
return b
235+
}
236+
return true
238237
}
239238

240239
type transportConfig struct {

0 commit comments

Comments
 (0)