Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET-1732: Remove setting of default dns, fix default enrollment key deletion #3177

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions controllers/ext_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions logic/enrollmentkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions logic/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
9 changes: 7 additions & 2 deletions pro/remote_access_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading