-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Locate KDC via DNS SRV records #60228
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
base: master
Are you sure you want to change the base?
Conversation
Amplify deployment status
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're planning to release backports of the new fields in a minor version, we should indicate the minor version this will be available in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👏🏻
Not a blocker, but I notice we didn't update any tests for the actual DNS resolution. Do we have tests for that part?
@ptgott Thanks for this, good idea. I've slightly changed how this will look from a configuration point of view to the user. Instead of having a separate |
dialer := net.Dialer{} | ||
dial := func(dialCtx context.Context, network, address string) (net.Conn, error) { | ||
return dialer.DialContext(dialCtx, network, address) | ||
} | ||
|
||
// In development environments, the system's default resolver is unlikely to be | ||
// able to resolve the Active Directory SRV records needed for server location, | ||
// so we allow overriding the resolver. | ||
if resolverAddr := os.Getenv("TELEPORT_KDC_RESOLVER"); resolverAddr != "" { | ||
s.cfg.Logger.DebugContext(ctx, "Using custom DNS resolver address", "address", resolverAddr) | ||
// Check if resolver address has a port | ||
host, port, err := net.SplitHostPort(resolverAddr) | ||
if err != nil { | ||
host = resolverAddr | ||
port = "53" | ||
} | ||
|
||
customResolverAddr := net.JoinHostPort(host, port) | ||
dial = func(ctx context.Context, network, address string) (net.Conn, error) { | ||
return dialer.DialContext(ctx, network, customResolverAddr) | ||
} | ||
} | ||
|
||
resolver := &net.Resolver{ | ||
PreferGo: true, | ||
Dial: dial, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could all of this be abstracted behind some kind of "resolver" interface? One that we could initialize and pass to WindowsService
during construction?
It seems like picking a resolver strategy is a separate concern from actually using it to resolve the KDC address, and the logic for each may evolve differently.
We recently added the locating of LDAP servers through DNS SRV records. A customer requested that this same functionality be added for discovering KDC servers.
This PR adds optional configuration:
When enabled, Teleport will get the address of a KDC server from the AD domain when a user connects to a desktop.
changelog: Added auto discovery of KDC servers through SRV records