mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-03 00:23:27 +02:00
Use encrypted passwords while creating robot users
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
@@ -52,3 +54,9 @@ func PodSpiloRole(pod *v1.Pod) string {
|
||||
func ClusterDNSName(clusterName, teamName, hostedZone string) string {
|
||||
return fmt.Sprintf("%s.%s.%s", clusterName, teamName, hostedZone)
|
||||
}
|
||||
|
||||
func PGUserPassword(user spec.PgUser) string {
|
||||
s := md5.Sum([]byte(user.Password + user.Name))
|
||||
|
||||
return "md5" + hex.EncodeToString(s[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user