tailscale/ipn
Adrian Dewhurst 477d5a43df ipn/ipnlocal, feature/conn25: add hook for accepting PeerAPI DNS
Currently, PeerAPI DNS is only allowed if
1. The peer is owned by the same user as this device, or
2. The node is an exit node or app connector
  a. and the peer has access to a hypothetical DNS server at 0.0.0.0:53
     (which approximately means "the peer has access to
     autogroup:internet")

None of this is useful for conn25. This adds the most basic of hooks
(and converts the existing logic to a hook, which should improve clarity
and lead to the possibility of moving the existing checks into feature
packages in future).

There is an extra filter based on the name being queried that is
performed later. It refuses names in
tailcfg.DNSConfig.ExitNodeFilteredSet. That filter is not modified by
this change.

With this change, if conn25 is configured as a connector, then all
PeerAPI DNS queries are permitted (still subject to the
ExitNodeFilteredSet as noted above).

More work is required: the goal before release (i.e. the WIPCode check
is removed) is that each query should be checked against the list of
domains in the requested conn25 app. For now, this only verifies that
conn25 is configured (and does not include the autogroup:internet
check, which is not how conn25 grants will operate when implemented,
soon).

This change has been manually tested against the scenario outlined in
tailscale/corp#40117; unfortunately the code's structure makes writing a
unit test difficult. The more comprehensive changes needed for
tailscale/corp#40076 should include an integration test that covers this
case.

The hook must go in the ipnlocal package rather than the usual extension
host to prevent a circular dependency on the ipnlocal.PeerAPIHandler
interface. Registering PeerAPI handlers uses a similar strategy, likely
because of, at least in part, this same problem.

Updates tailscale/corp#40076
Fixes tailscale/corp#40117

Change-Id: I367714170b509d7a421f62672e5824b3590c2b9c
Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
2026-06-29 16:33:33 -04:00
..
auditlog all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
conffile cmd/tailscale/cli, ipn/conffile: accept legacy serve config in set-config (#20056) 2026-06-12 18:52:17 -07:00
desktop all: don't repeat the the word "the" unnecessarily 2026-06-18 16:32:08 +01:00
ipnauth all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
ipnext net/routecheck: introduce new package for checking peer reachability (#19639) 2026-06-01 10:33:08 -07:00
ipnlocal ipn/ipnlocal, feature/conn25: add hook for accepting PeerAPI DNS 2026-06-29 16:33:33 -04:00
ipnserver ipn/ipnlocal: consolidate test-only LocalBackend methods behind ForTest 2026-06-27 16:11:42 -07:00
ipnstate all: rename NetworkLock functions/types to TailnetLock 2026-06-08 13:14:28 +01:00
lapitest ipn/ipnlocal: consolidate test-only LocalBackend methods behind ForTest 2026-06-27 16:11:42 -07:00
localapi ipn: add fmt.Stringer support to NotifyWatchOpt (#20072) 2026-06-18 10:27:16 -07:00
policy all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
store ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00
backend_test.go ipn: add fmt.Stringer support to NotifyWatchOpt (#20072) 2026-06-18 10:27:16 -07:00
backend.go ipn: add fmt.Stringer support to NotifyWatchOpt (#20072) 2026-06-18 10:27:16 -07:00
conf_test.go ipn/config: add RelayServerPort and RelayServerStaticEndpoints to config file (#18300) 2026-06-26 15:45:29 -05:00
conf.go ipn/config: add RelayServerPort and RelayServerStaticEndpoints to config file (#18300) 2026-06-26 15:45:29 -05:00
doc.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
ipn_clone.go ipn: remove the last traces of Prefs.AllowSingleHosts 2026-06-26 15:31:38 +01:00
ipn_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
ipn_view.go ipn: remove the last traces of Prefs.AllowSingleHosts 2026-06-26 15:31:38 +01:00
prefs_test.go ipn: remove the last traces of Prefs.AllowSingleHosts 2026-06-26 15:31:38 +01:00
prefs.go ipn: remove the last traces of Prefs.AllowSingleHosts 2026-06-26 15:31:38 +01:00
serve_expand_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
serve_test.go ipn,ipn/localapi: require local admin to serve Unix domain sockets 2026-06-03 09:45:02 -06:00
serve.go ipn,ipn/localapi: require local admin to serve Unix domain sockets 2026-06-03 09:45:02 -06:00
store_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
store.go ipn/store: make WriteState(id, nil) delete key instead of adding nil entry (#19920) 2026-05-29 11:22:14 -07:00