2023-01-27 21:37:20 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2020-04-01 04:48:33 +00:00
|
|
|
|
|
|
|
// Package policy contains various policy decisions that need to be
|
|
|
|
// shared between the node client & control server.
|
|
|
|
package policy
|
|
|
|
|
2021-04-01 18:57:24 +00:00
|
|
|
import (
|
|
|
|
"tailscale.com/tailcfg"
|
|
|
|
)
|
2020-04-01 04:48:33 +00:00
|
|
|
|
|
|
|
// IsInterestingService reports whether service s on the given operating
|
|
|
|
// system (a version.OS value) is an interesting enough port to report
|
|
|
|
// to our peer nodes for discovery purposes.
|
|
|
|
func IsInterestingService(s tailcfg.Service, os string) bool {
|
2021-12-03 20:31:16 +00:00
|
|
|
switch s.Proto {
|
2023-11-10 00:54:55 +00:00
|
|
|
case tailcfg.PeerAPI4, tailcfg.PeerAPI6, tailcfg.PeerAPIDNS, tailcfg.AppConnector:
|
2021-04-01 18:57:24 +00:00
|
|
|
return true
|
|
|
|
}
|
2020-04-01 04:48:33 +00:00
|
|
|
if s.Proto != tailcfg.TCP {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if os != "windows" {
|
|
|
|
// For non-Windows machines, assume all TCP listeners
|
|
|
|
// are interesting enough. We don't see listener spam
|
|
|
|
// there.
|
|
|
|
return true
|
|
|
|
}
|
2023-04-04 15:00:59 +00:00
|
|
|
// Windows has tons of TCP listeners. We need to move to a denylist
|
|
|
|
// model later, but for now we just allow some common ones:
|
2020-04-01 04:48:33 +00:00
|
|
|
switch s.Port {
|
|
|
|
case 22, // ssh
|
|
|
|
80, // http
|
|
|
|
443, // https (but no hostname, so little useless)
|
|
|
|
3389, // rdp
|
|
|
|
5900, // vnc
|
|
|
|
32400, // plex
|
|
|
|
|
2021-10-13 00:28:44 +00:00
|
|
|
// And now some arbitrary HTTP dev server ports:
|
2020-04-01 04:48:33 +00:00
|
|
|
// Eventually we'll remove this and make all ports
|
|
|
|
// work, once we nicely filter away noisy system
|
|
|
|
// ports.
|
|
|
|
8000, 8080, 8443, 8888:
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|