Skip to content

Commit

Permalink
Sanju/remove pg password from a2 platform file (#8674)
Browse files Browse the repository at this point in the history
* Storing password in secret helper

Signed-off-by: “SanjuPal01” <[email protected]>

* Adding Dex Component Changes

Signed-off-by: “SanjuPal01” <[email protected]>

* Reading password from secret helper in notification-service

Signed-off-by: “SanjuPal01” <[email protected]>

---------

Signed-off-by: “SanjuPal01” <[email protected]>
  • Loading branch information
SanjuPal01 committed Feb 4, 2025
1 parent a54a4d0 commit 594a5f7
Show file tree
Hide file tree
Showing 13 changed files with 1,022 additions and 626 deletions.
154 changes: 151 additions & 3 deletions api/config/pg_gateway/config_request.pb.a2svc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions api/config/shared/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (c *GlobalConfig) Validate() error { // nolint gocyclo
"show",
"userconfig.es_password",
}
execGetPass := exec.Command(getLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
execGetPass := exec.Command(GetLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
getPass, err := execGetPass.Output()
if err != nil || string(getPass) == "" {
cfgErr.AddMissingKey("global.v1.external.elasticsearch.auth.basic_auth.password")
Expand Down Expand Up @@ -314,7 +314,7 @@ func (c *GlobalConfig) Validate() error { // nolint gocyclo
"show",
"userconfig.os_password",
}
execGetPass := exec.Command(getLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
execGetPass := exec.Command(GetLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
getPass, err := execGetPass.Output()
if err != nil || string(getPass) == "" {
cfgErr.AddMissingKey("global.v1.external.opensearch.auth.basic_auth.password")
Expand Down Expand Up @@ -348,7 +348,15 @@ func (c *GlobalConfig) Validate() error { // nolint gocyclo
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.superuser.username")
}
if sp == "" {
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.superuser.password")
args := []string{
"show",
"userconfig.pg_superuser_password",
}
execGetPass := exec.Command(GetLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
getPass, err := execGetPass.Output()
if err != nil || string(getPass) == "" {
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.superuser.password")
}
}

// dbuser username and password
Expand All @@ -358,7 +366,15 @@ func (c *GlobalConfig) Validate() error { // nolint gocyclo
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.dbuser.username")
}
if dp == "" {
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.dbuser.password")
args := []string{
"show",
"userconfig.pg_dbuser_password",
}
execGetPass := exec.Command(GetLatestPlatformToolsPath()+"/bin/secrets-helper", args...)
getPass, err := execGetPass.Output()
if err != nil || string(getPass) == "" {
cfgErr.AddMissingKey("global.v1.external.postgresql.auth.password.dbuser.password")
}
}
}
}
Expand Down Expand Up @@ -448,7 +464,7 @@ func (c *GlobalConfig) ValidateReDirectSysLogConfig() error {
return nil
}

func getLatestPlatformToolsPath() string {
func GetLatestPlatformToolsPath() string {
cmd, err := exec.Command("/bin/sh", "-c", habPkgPlatformToolsPath).Output()
if err != nil {
fmt.Printf("error %s", err)
Expand Down
120 changes: 120 additions & 0 deletions api/config/shared/global.pb.a2svc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 594a5f7

Please sign in to comment.