encrypt and save hostpass on HostCreate

This commit is contained in:
Matthew R. Kasun
2022-12-21 14:43:46 -05:00
parent b07504c286
commit bc47ef4868
3 changed files with 22 additions and 13 deletions

View File

@@ -20,7 +20,6 @@ import (
"github.com/gravitl/netmaker/netclient/ncutils"
"github.com/gravitl/netmaker/servercfg"
"github.com/gravitl/netmaker/validation"
"golang.org/x/crypto/bcrypt"
)
const (
@@ -191,13 +190,6 @@ func CreateNode(node *models.Node) error {
return err
}
//encrypt that password so we never see it
hash, err := bcrypt.GenerateFromPassword([]byte(host.HostPass), 5)
if err != nil {
return err
}
//set password to encrypted password
host.HostPass = string(hash)
if !node.DNSOn {
if servercfg.IsDNSMode() {
node.DNSOn = true