gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
16.95k stars 1.7k forks source link

improve logs and naming in lib/reversetunnel #19164

Open fspmarshall opened 1 year ago

fspmarshall commented 1 year ago

The lib/reversetunnel package contains a lot of outdated and/or ambiguous terminology, and some fairly confusing log/error messages. This often causes confusion and wasted time during debugging/support. Addressing some of the below issues would be very helpful when reversetunnel issues come up:

In addition to the above fixes, I think a periodic INFO-level log summarizing the current cluster connectivity status would be helpful. Something like:

INFO Leaf cluster tunnels: {foo.example.com: [<proxy-id>, <proxy-id>], bar.example.com: [<proxy-id>, <proxy-id> ]}

It may also be useful to have a WARN-level log if a given leaf cluster is observed to have active tunnels to other proxies within the current cluster but not have any tunnels locally for some period of time. E.g.:

WARN Leaf cluster 'foo.example.com' appears online but this proxy has not been discovered by any of its proxy agents. Please verify that proxies in 'foo.example.com' can dial this proxy.

Care should be taken to avoid over-using this log, but if no tunnels for a given leaf are observed for more than the expiry time of the active peer tunnels, it is likely worth emitting it.

ibeckermayer commented 1 year ago

A related naming issue of note is that throughout lib/web (as well as potentially other places) we're using an interface reversetunnel.RemoteSite which is neither guaranteed to be a reverse tunnel nor a remote site (leaf cluster). It's really being used as an abstraction for a Teleport cluster, which can be either the local site (root cluster) in which case connections are not typically made through a reverse tunnel (afaik, I may be wrong about this), or else it's a remote site (leaf cluster) in which case connections are all made through a reverse tunnel.