diff --git a/cmd/keeper/cmd/keeper.go b/cmd/keeper/cmd/keeper.go index dd9b2aafa..ed88b872d 100644 --- a/cmd/keeper/cmd/keeper.go +++ b/cmd/keeper/cmd/keeper.go @@ -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) diff --git a/internal/postgresql/postgresql.go b/internal/postgresql/postgresql.go index 00c14bcd7..0ac6f2b82 100644 --- a/internal/postgresql/postgresql.go +++ b/internal/postgresql/postgresql.go @@ -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)