keep the passwords in sync

This commit is contained in:
Abhishek Kondur 2022-10-21 12:10:12 +05:30
parent dc7e4e919f
commit 33ac0bfdb9
2 changed files with 11 additions and 8 deletions

View file

@ -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)

View file

@ -52,6 +52,7 @@ var (
},
},
},
exporterMQClient,
},
Roles: []role{
{
@ -66,6 +67,7 @@ var (
Rolename: NodeRole,
Acls: fetchNodeAcls(),
},
exporterMQRole,
},
DefaultAcl: defaultAccessAcl{
PublishClientSend: false,