mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-15 17:44:37 +08:00
Merge pull request #3177 from gravitl/NET-1732
NET-1732: Remove setting of default dns, fix default enrollment key deletion
This commit is contained in:
commit
3448d634fc
4 changed files with 26 additions and 21 deletions
|
@ -287,22 +287,22 @@ func getExtClientConf(w http.ResponseWriter, r *http.Request) {
|
|||
} else if gwnode.IngressDNS != "" {
|
||||
defaultDNS = "DNS = " + gwnode.IngressDNS
|
||||
}
|
||||
if servercfg.GetManageDNS() {
|
||||
if gwnode.Address6.IP != nil {
|
||||
if defaultDNS == "" {
|
||||
defaultDNS = "DNS = " + gwnode.Address6.IP.String()
|
||||
} else {
|
||||
defaultDNS = defaultDNS + ", " + gwnode.Address6.IP.String()
|
||||
}
|
||||
}
|
||||
if gwnode.Address.IP != nil {
|
||||
if defaultDNS == "" {
|
||||
defaultDNS = "DNS = " + gwnode.Address.IP.String()
|
||||
} else {
|
||||
defaultDNS = defaultDNS + ", " + gwnode.Address.IP.String()
|
||||
}
|
||||
}
|
||||
}
|
||||
// if servercfg.GetManageDNS() {
|
||||
// if gwnode.Address6.IP != nil {
|
||||
// if defaultDNS == "" {
|
||||
// defaultDNS = "DNS = " + gwnode.Address6.IP.String()
|
||||
// } else {
|
||||
// defaultDNS = defaultDNS + ", " + gwnode.Address6.IP.String()
|
||||
// }
|
||||
// }
|
||||
// if gwnode.Address.IP != nil {
|
||||
// if defaultDNS == "" {
|
||||
// defaultDNS = "DNS = " + gwnode.Address.IP.String()
|
||||
// } else {
|
||||
// defaultDNS = defaultDNS + ", " + gwnode.Address.IP.String()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
defaultMTU := 1420
|
||||
if host.MTU != 0 {
|
||||
|
|
|
@ -52,6 +52,7 @@ func CreateEnrollmentKey(uses int, expiration time.Time, networks, tags []string
|
|||
Type: models.Undefined,
|
||||
Relay: relay,
|
||||
Groups: groups,
|
||||
Default: defaultKey,
|
||||
}
|
||||
if uses > 0 {
|
||||
k.UsesRemaining = uses
|
||||
|
|
|
@ -423,9 +423,8 @@ func SetNodeDefaults(node *models.Node, resetConnected bool) {
|
|||
}
|
||||
|
||||
node.SetLastModified()
|
||||
if node.LastCheckIn.IsZero() {
|
||||
node.SetLastCheckIn()
|
||||
}
|
||||
node.SetLastCheckIn()
|
||||
|
||||
if resetConnected {
|
||||
node.SetDefaultConnected()
|
||||
}
|
||||
|
|
|
@ -43,13 +43,18 @@ func racAutoDisableHook() error {
|
|||
currentTime := time.Now()
|
||||
validityDuration := servercfg.GetJwtValidityDuration()
|
||||
for _, user := range users {
|
||||
if user.PlatformRoleID == models.AdminRole ||
|
||||
user.PlatformRoleID == models.SuperAdminRole {
|
||||
continue
|
||||
}
|
||||
if !currentTime.After(user.LastLoginTime.Add(validityDuration)) {
|
||||
continue
|
||||
}
|
||||
for _, client := range clients {
|
||||
if client.RemoteAccessClientID == "" {
|
||||
continue
|
||||
}
|
||||
if (client.OwnerID == user.UserName) &&
|
||||
user.PlatformRoleID != models.SuperAdminRole &&
|
||||
user.PlatformRoleID != models.AdminRole &&
|
||||
client.Enabled {
|
||||
slog.Info(fmt.Sprintf("disabling ext client %s for user %s due to RAC autodisabling", client.ClientID, client.OwnerID))
|
||||
if err := disableExtClient(&client); err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue