mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
ipn/ipnlocal: send RST when serving an actionless TCPPortHandler
Updates tailscale/corp#7515 Change-Id: I790f1b5d1e8a887e39bb573b4610b8f37a3f5963 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
2111357568
commit
4797bacb7c
@ -37,6 +37,24 @@ func (b *LocalBackend) HandleInterceptedTCPConn(dport uint16, srcAddr netip.Addr
|
||||
return
|
||||
}
|
||||
|
||||
if tcph.HTTPS() {
|
||||
conn, ok := getConn()
|
||||
if !ok {
|
||||
b.logf("localbackend: getConn didn't complete from %v to port %v", srcAddr, dport)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO(bradfitz): look up how; sniff SNI if ambiguous
|
||||
hs := &http.Server{
|
||||
TLSConfig: &tls.Config{
|
||||
GetCertificate: b.getTLSServeCert,
|
||||
},
|
||||
Handler: http.HandlerFunc(b.serveWebHandler),
|
||||
}
|
||||
hs.ServeTLS(netutil.NewOneConnListener(conn, nil), "", "")
|
||||
return
|
||||
}
|
||||
|
||||
if backDst := tcph.TCPForward(); backDst != "" {
|
||||
if tcph.TerminateTLS() {
|
||||
b.logf("TODO(bradfitz): finish")
|
||||
@ -76,19 +94,8 @@ func (b *LocalBackend) HandleInterceptedTCPConn(dport uint16, srcAddr netip.Addr
|
||||
return
|
||||
}
|
||||
|
||||
conn, ok := getConn()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
// TODO(bradfitz): look up how; sniff SNI if ambiguous
|
||||
hs := &http.Server{
|
||||
TLSConfig: &tls.Config{
|
||||
GetCertificate: b.getTLSServeCert,
|
||||
},
|
||||
Handler: http.HandlerFunc(b.serveWebHandler),
|
||||
}
|
||||
hs.ServeTLS(netutil.NewOneConnListener(conn, nil), "", "")
|
||||
b.logf("closing TCP conn to port %v (from %v) with actionless TCPPortHandler", dport, srcAddr)
|
||||
sendRST()
|
||||
}
|
||||
|
||||
func (b *LocalBackend) getServeHandler(r *http.Request) (_ ipn.HTTPHandlerView, ok bool) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user