[client] Rebuild the overlay listeners when the TUN is renewed (#7397)

This commit is contained in:
Viktor Liu
2026-09-03 19:22:00 +09:00
committed by GitHub
parent fbd4730f0b
commit bb233c72b6
7 changed files with 341 additions and 21 deletions

View File

@@ -3,6 +3,7 @@ package auth
import (
"errors"
"fmt"
"slices"
"sync"
log "github.com/sirupsen/logrus"
@@ -155,6 +156,24 @@ func (a *Authorizer) GetUserIDClaim() string {
return a.userIDClaim
}
// Config returns the authorization currently in force. The user list and the
// machine-user map are copies; the originals stay in use here.
func (a *Authorizer) Config() *Config {
a.mu.RLock()
defer a.mu.RUnlock()
machineUsers := make(map[string][]uint32, len(a.machineUsers))
for osUser, indexes := range a.machineUsers {
machineUsers[osUser] = slices.Clone(indexes)
}
return &Config{
UserIDClaim: a.userIDClaim,
AuthorizedUsers: slices.Clone(a.authorizedUsers),
MachineUsers: machineUsers,
}
}
// findUserIndex finds the index of a hashed user ID in the authorized users list
// Returns the index and true if found, 0 and false if not found
func (a *Authorizer) findUserIndex(hashedUserID sshuserhash.UserIDHash) (int, bool) {