Skip to content

Commit

Permalink
Fix TLS for ClientAuthMode MD5 (#1312) (#1319)
Browse files Browse the repository at this point in the history
Signed-off-by: souravbiswassanto <saurov@appscode.com>
  • Loading branch information
1gtm committed Jun 5, 2024
1 parent e65c758 commit 3ccaa70
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pkg/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin
return err
}

userName := ""
userName := must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthUsernameKey, envPostgresUser))
session.sh.SetEnv(EnvPgPassword, must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthPasswordKey, envPostgresPassword)))

if appBinding.Spec.TLSSecret != nil && appBinding.Spec.TLSSecret.Name != "" {
appBindingSecret, err = opt.kubeClient.CoreV1().Secrets(appBinding.Namespace).Get(context.TODO(), appBinding.Spec.TLSSecret.Name, metav1.GetOptions{})
if err != nil {
Expand All @@ -138,14 +140,10 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin
}
session.sh.SetEnv(EnvPGSSLKEY, filepath.Join(opt.setupOptions.ScratchDir, core.TLSPrivateKeyKey))

// TODO: this one is hard coded here but need to change later
userName = opt.user
} else {
// set env for pg_dump/pg_dumpall
session.sh.SetEnv(EnvPgPassword, must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthPasswordKey, envPostgresPassword)))
userName = must(meta_util.GetBytesForKeys(appBindingSecret.Data, core.BasicAuthUsernameKey, envPostgresUser))
if opt.user != "" {
userName = opt.user
}
}

pgSSlmode, err := getSSLMODE(appBinding)
if err != nil {
return err
Expand Down

0 comments on commit 3ccaa70

Please sign in to comment.