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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

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

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

Join @ethanndickson and the rest of your teammates on Graphite Graphite

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.

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.

2 participants