mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-05 22:41:30 +02:00
[client] Rebuild the overlay listeners when the TUN is renewed (#7397)
This commit is contained in:
@@ -197,6 +197,12 @@ type Config struct {
|
||||
|
||||
// HostKey is the SSH server host key in PEM format
|
||||
HostKeyPEM []byte
|
||||
|
||||
// Auth is the fine-grained authorization to open with. Nil starts with an
|
||||
// empty authorizer, which authorizes nobody until UpdateSSHAuth is called.
|
||||
// Setting it here rather than afterwards means the server never accepts a
|
||||
// login before it knows who is allowed.
|
||||
Auth *sshauth.Config
|
||||
}
|
||||
|
||||
// SessionInfo contains information about an active SSH session
|
||||
@@ -220,7 +226,11 @@ func New(config *Config) *Server {
|
||||
connections: make(map[connKey]*connState),
|
||||
jwtEnabled: config.JWT != nil,
|
||||
jwtConfig: config.JWT,
|
||||
authorizer: sshauth.NewAuthorizer(), // Initialize with empty config
|
||||
authorizer: sshauth.NewAuthorizer(),
|
||||
}
|
||||
|
||||
if config.Auth != nil {
|
||||
s.authorizer.Update(config.Auth)
|
||||
}
|
||||
|
||||
return s
|
||||
@@ -461,6 +471,27 @@ func (s *Server) UpdateSSHAuth(config *sshauth.Config) {
|
||||
s.authorizer.Update(config)
|
||||
}
|
||||
|
||||
// JWTConfig returns the JWT authentication this server was built with, or nil
|
||||
// when JWT authentication is disabled.
|
||||
func (s *Server) JWTConfig() *JWTConfig {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
return s.jwtConfig
|
||||
}
|
||||
|
||||
// AuthConfig returns the fine-grained authorization currently in force, or nil
|
||||
// when the server has no authorizer.
|
||||
func (s *Server) AuthConfig() *sshauth.Config {
|
||||
s.mu.RLock()
|
||||
authorizer := s.authorizer
|
||||
s.mu.RUnlock()
|
||||
|
||||
if authorizer == nil {
|
||||
return nil
|
||||
}
|
||||
return authorizer.Config()
|
||||
}
|
||||
|
||||
// ensureJWTValidator initializes the JWT validator and extractor if not already initialized
|
||||
func (s *Server) ensureJWTValidator() error {
|
||||
s.mu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user