mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-21 07:46:04 +08:00
keep the passwords in sync
This commit is contained in:
parent
dc7e4e919f
commit
33ac0bfdb9
17
mq/dynsec.go
17
mq/dynsec.go
|
@ -132,19 +132,20 @@ func encodePasswordToPBKDF2(password string, salt string, iterations int, keyLen
|
|||
|
||||
// Configure - configures the dynamic initial configuration for MQ
|
||||
func Configure() error {
|
||||
logger.Log(0, "Configuring MQ...")
|
||||
path := functions.GetNetmakerPath() + ncutils.GetSeparator() + dynamicSecurityFile
|
||||
if logic.CheckIfFileExists(path) {
|
||||
logger.Log(0, "MQ Is Already Configured, Skipping...")
|
||||
return nil
|
||||
}
|
||||
if servercfg.Is_EE {
|
||||
dynConfig.Clients = append(dynConfig.Clients, exporterMQClient)
|
||||
dynConfig.Roles = append(dynConfig.Roles, exporterMQRole)
|
||||
}
|
||||
|
||||
password := servercfg.GetMqAdminPassword()
|
||||
if password == "" {
|
||||
return errors.New("MQ admin password not provided")
|
||||
}
|
||||
if logic.CheckIfFileExists(path) {
|
||||
data, err := os.ReadFile(path)
|
||||
if err == nil {
|
||||
json.Unmarshal(data, &dynConfig)
|
||||
}
|
||||
}
|
||||
|
||||
for i, cI := range dynConfig.Clients {
|
||||
if cI.Username == mqAdminUserName || cI.Username == mqNetmakerServerUserName {
|
||||
salt := logic.RandomString(12)
|
||||
|
|
|
@ -52,6 +52,7 @@ var (
|
|||
},
|
||||
},
|
||||
},
|
||||
exporterMQClient,
|
||||
},
|
||||
Roles: []role{
|
||||
{
|
||||
|
@ -66,6 +67,7 @@ var (
|
|||
Rolename: NodeRole,
|
||||
Acls: fetchNodeAcls(),
|
||||
},
|
||||
exporterMQRole,
|
||||
},
|
||||
DefaultAcl: defaultAccessAcl{
|
||||
PublishClientSend: false,
|
||||
|
|
Loading…
Reference in a new issue