Skip to content

Commit

Permalink
Added SCRAM-SHA-256 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnl88 committed Oct 10, 2022
1 parent ce7fd99 commit b34eed4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/keeper/cmd/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,7 @@ func keeper(c *cobra.Command, args []string) {
validAuthMethods := make(map[string]struct{})
validAuthMethods["trust"] = struct{}{}
validAuthMethods["md5"] = struct{}{}
validAuthMethods["scram-sha-256"] = struct{}{}
switch cfg.LogLevel {
case "error":
slog.SetLevel(zap.ErrorLevel)
Expand Down
3 changes: 2 additions & 1 deletion internal/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (p *Manager) Init(initConfig *InitConfig) error {

name := filepath.Join(p.pgBinPath, "initdb")
cmd := exec.Command(name, "-D", p.dataDir, "-U", p.suUsername)
if p.suAuthMethod == "md5" {
if p.suAuthMethod == "md5" || p.suAuthMethod == "scram-sha-256" {
cmd.Args = append(cmd.Args, "--auth", p.suAuthMethod)
cmd.Args = append(cmd.Args, "--pwfile", pwfile.Name())
}
log.Debugw("execing cmd", "cmd", cmd)
Expand Down

0 comments on commit b34eed4

Please sign in to comment.