aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-01-27 17:01:32 +0100
committerAlex Auvolat <alex@adnab.me>2020-01-27 17:01:32 +0100
commit3edaad9317db280db903a18ec85a70e6c32cabf9 (patch)
treeffca975d10b64d374168e96ffe8a7fc1e5189493 /main.go
parente7ded9d6b575870a17ce58f0192cc388984dfb4a (diff)
downloadbottin-3edaad9317db280db903a18ec85a70e6c32cabf9.tar.gz
bottin-3edaad9317db280db903a18ec85a70e6c32cabf9.zip
Use better randomness
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.go b/main.go
index bc81384..d665caf 100644
--- a/main.go
+++ b/main.go
@@ -12,7 +12,7 @@ import (
"fmt"
"io/ioutil"
"log"
- "math/rand"
+ "crypto/rand"
"os"
"os/signal"
"syscall"
@@ -264,7 +264,10 @@ func (server *Server) init() error {
}
admin_pass := make([]byte, 8)
- rand.Read(admin_pass)
+ _, err = rand.Read(admin_pass)
+ if err != nil {
+ return err
+ }
admin_pass_str := base64.RawURLEncoding.EncodeToString(admin_pass)
admin_pass_hash := SSHAEncode([]byte(admin_pass_str))
@@ -286,7 +289,7 @@ func (server *Server) init() error {
}
server.logger.Printf(
- "It seems to be a new installation, we created a default user for you:\n\n dn: %s\n password: %s\n\nWe didn't use true random, you should replace it as soon as possible.",
+ "It seems to be a new installation, we created a default user for you:\n\n dn: %s\n password: %s\n\nWe recommend replacing it as soon as possible.",
admin_dn,
admin_pass_str,
)