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

chore: use coder DNS service address #64

Merged
merged 1 commit into from
Jan 29, 2025
Merged

chore: use coder DNS service address #64

merged 1 commit into from
Jan 29, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Nov 8, 2024

Relates to coder/coder#14718

This enables the Tailscale built-in DNS nameserver (Resolver) to listen on the pre-determined Coder DNS address, [fd60:627a:a42b::53]:53.

Note that there's currently a hardcoded check in the DNS manager that ignores the hosts on dns.Config unless goos= "windows". This means the platform specific part of CoderVPN won't get the specific host mappings, only the address of the Tailscale nameserver. If we need to modify the hosts file on Windows, we'll need to change that (answer pending dean's return) .

For example, this in: dns.Config produces the following OS config, and Resolver config:

in: Config{
	OnlyIPv6: true,
	Routes: map[dnsname.FQDN][]*dnstype.Resolver{
		"coder.": nil,
	},
	Hosts: hosts(
		"agent.myws.me.coder.", "fd60:627a:a42c::53",
	),
},
os: OSConfig{
	Nameservers: mustIPs("fd60:627a:a42b::53"),
},
rs: resolver.Config{
	Routes: upstreams(
		".", "",
	),
	Hosts: hosts(
		"agent.myws.me.coder.", "fd60:627a:a42c::53",
	),
	LocalDomains: fqdns("coder."),
},

Copy link
Member Author

ethanndickson commented Nov 8, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

rs: resolver.Config{
Routes: upstreams(
".", "",
"coder.", "fd60:627a:a42b::53",
Copy link
Member Author

@ethanndickson ethanndickson Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't totally understand the purpose of routes on resolver.Config. This just points to itself and it just works?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for allowing the DNS service to query external DNS servers. We don't need it for our purposes since the local DNS will be authoritative for all **.coder. names, and we'll use split-DNS so that the OS only asks us for these names in the first place.

For OSes which don't support split DNS, Tailscale becomes the default resolver, and then gets configured with upstream DNS servers for queries it can't handle locally. We don't need to do this so we won't ever have upstream routes.

@spikecurtis spikecurtis self-requested a review January 21, 2025 16:00
@ethanndickson ethanndickson marked this pull request as ready for review January 21, 2025 16:41
@ethanndickson
Copy link
Member Author

I realised I can test this locally, gonna do that before merging

@deansheather
Copy link
Member

From my testing on Windows it seems to do the trick:

PS C:\> nslookup - [fd60:627a:a42b::53]
Default Server:  UnKnown
Address:  fd60:627a:a42b::53

> pog.coder
Server:  UnKnown
Address:  fd60:627a:a42b::53

Name:    pog.coder
Address:  fd60:627a:a42b:4738:9e9d:b69:984b:29e0

@ethanndickson ethanndickson merged commit 8086c87 into main Jan 29, 2025
7 of 36 checks passed
ethanndickson added a commit to coder/coder that referenced this pull request Jan 29, 2025
These were somehow missed when I wrote the router..

Also updates `coder/tailscale` to bring in the DNS changes
coder/tailscale#64
aslilac pushed a commit to coder/coder that referenced this pull request Jan 29, 2025
These were somehow missed when I wrote the router..

Also updates `coder/tailscale` to bring in the DNS changes
coder/tailscale#64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants