Use encrypted passwords while creating robot users

This commit is contained in:
Murat Kabilov
2017-05-12 11:41:28 +02:00
parent 48ba6adf8a
commit 3aaa05fb96
2 changed files with 12 additions and 3 deletions
+8
View File
@@ -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[:])
}