ipn/ipnlocal, wgengine/netstack: start handling ports for future serving

Updates tailscale/corp#7515

Change-Id: I966e936e72a2ee99be8d0f5f16872b48cc150258
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-11-07 15:32:53 -08:00
committed by Brad Fitzpatrick
parent acf5839dd2
commit 2daf0f146c
6 changed files with 239 additions and 9 deletions

View File

@@ -554,9 +554,8 @@ func (ns *Impl) shouldProcessInbound(p *packet.Parsed, t *tstun.Wrapper) bool {
if dport == peerAPIPort {
return true
}
// Also handle SSH connections, if enabled.
if dport == 22 && ns.lb.ShouldRunSSH() {
// Also handle SSH connections, webserver, etc, if enabled:
if ns.lb.ShouldInterceptTCPPort(dport) {
return true
}
}
@@ -894,6 +893,14 @@ func (ns *Impl) acceptTCP(r *tcp.ForwarderRequest) {
ns.lb.HandleQuad100Port80Conn(c)
return
}
if ns.lb.ShouldInterceptTCPPort(reqDetails.LocalPort) && ns.isLocalIP(dialIP) {
c := createConn()
if c == nil {
return
}
ns.lb.HandleInterceptedTCPConn(c)
return
}
}
if ns.ForwardTCPIn != nil {