From cceacda5eb14f97ebbed5e79ab1f9c5a50faa674 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 24 Mar 2022 19:44:27 -0700 Subject: [PATCH] ipn/ipnstate: put SSH Host Keys in ipnstate.PeerStatus Updates #3802 Change-Id: I47ba3b4545b25988f375bd867aecd98bb0da8d79 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 1 + ipn/ipnstate/ipnstate.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 143a8d2e4..5a646c57f 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -472,6 +472,7 @@ func (b *LocalBackend) populatePeerStatusLocked(sb *ipnstate.StatusBuilder) { ShareeNode: p.Hostinfo.ShareeNode(), ExitNode: p.StableID != "" && p.StableID == b.prefs.ExitNodeID, ExitNodeOption: exitNodeOption, + SSH_HostKeys: p.Hostinfo.SSH_HostKeys().AsSlice(), }) } } diff --git a/ipn/ipnstate/ipnstate.go b/ipn/ipnstate/ipnstate.go index 9c103d379..fee2ed924 100644 --- a/ipn/ipnstate/ipnstate.go +++ b/ipn/ipnstate/ipnstate.go @@ -145,6 +145,9 @@ type PeerStatus struct { PeerAPIURL []string Capabilities []string `json:",omitempty"` + // SSH_HostKeys are the node's SSH host keys, if known. + SSH_HostKeys []string `json:"sshHostKeys,omitempty"` + // ShareeNode indicates this node exists in the netmap because // it's owned by a shared-to user and that node might connect // to us. These nodes should be hidden by "tailscale status" @@ -284,6 +287,9 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) { if v := st.OS; v != "" { e.OS = st.OS } + if v := st.SSH_HostKeys; v != nil { + e.SSH_HostKeys = v + } if v := st.Addrs; v != nil { e.Addrs = v }