Skip to content

Commit

Permalink
keep the passwords in sync
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Oct 21, 2022
1 parent dc7e4e9 commit 33ac0bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mq/dynsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions mq/dynsec_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var (
},
},
},
exporterMQClient,
},
Roles: []role{
{
Expand All @@ -66,6 +67,7 @@ var (
Rolename: NodeRole,
Acls: fetchNodeAcls(),
},
exporterMQRole,
},
DefaultAcl: defaultAccessAcl{
PublishClientSend: false,
Expand Down

0 comments on commit 33ac0bf

Please sign in to comment.