Listen on loopback and tailnet by default; make the plain-HTTP LAN opt-in

The web proxy binds the wildcard and drops connections that are not
loopback or Tailscale at both ends. A LAN listener is opt-in (web.lan) and
refuses sign-in and signed-in pages over plain HTTP unless
web.lan_plain_login is set. Existing installs keep their bind address with
a warning. Without the LAN the mDNS advert carries only the tailnet and
public routes (lan=0).
This commit is contained in:
2026-11-10 01:02:02 +00:00
parent a706739088
commit ad6cdab418
18 changed files with 677 additions and 35 deletions
@@ -125,4 +125,35 @@ void main() {
expect(DiscoveredServer.isTailscaleIPv4('100.127.0.1'), isTrue);
expect(DiscoveredServer.isTailscaleIPv4('100.128.0.1'), isFalse);
});
test('lan=0 drops the LAN route and dials the tailnet first', () {
final server = DiscoveredServer.fromRecord(
instance: 'Pipelines-box',
addresses: ['100.85.25.33'],
port: 8083,
attributes: {
'name': 'box',
'path': '/connect',
'tls': '0',
'auth': 'password',
'lan': '0',
'ts': '100.85.25.33',
'public': 'https://box.tail1.ts.net:8443',
},
)!;
expect(server.addresses.map((a) => a.route), [
DiscoveredRoute.tailscale,
DiscoveredRoute.public,
]);
expect(server.endpoint, Uri.parse('ws://100.85.25.33:8083/connect'));
expect(
DiscoveredServer.fromRecord(
instance: 'Pipelines-box',
addresses: ['100.85.25.33'],
port: 8083,
attributes: {'lan': '0'},
),
isNull,
);
});
}