[client] Replace Engine SSH host key verifier with PeerKeyLookup

Remove Engine.VerifySSHHostKey and keep GetPeerSSHKey as the only SSH
key API on the Engine. Verification now lives in the ssh package as a
PeerKeyLookup func type implementing HostKeyVerifier, shared by the
android and embed clients.
This commit is contained in:
Zoltan Papp
2026-08-14 21:50:04 +02:00
parent ceb1719f9a
commit 0bb49fa144
4 changed files with 17 additions and 15 deletions

View File

@@ -12,7 +12,6 @@ import (
firewallManager "github.com/netbirdio/netbird/client/firewall/manager"
"github.com/netbirdio/netbird/client/iface/netstack"
nftypes "github.com/netbirdio/netbird/client/internal/netflow/types"
nbssh "github.com/netbirdio/netbird/client/ssh"
sshauth "github.com/netbirdio/netbird/client/ssh/auth"
sshconfig "github.com/netbirdio/netbird/client/ssh/config"
sshserver "github.com/netbirdio/netbird/client/ssh/server"
@@ -217,16 +216,6 @@ func (e *Engine) GetPeerSSHKey(peerAddress string) ([]byte, bool) {
return nil, false
}
// VerifySSHHostKey verifies a presented SSH host key against the stored key of
// the peer at peerAddress. It implements ssh.HostKeyVerifier.
func (e *Engine) VerifySSHHostKey(peerAddress string, presentedKey []byte) error {
storedKey, found := e.GetPeerSSHKey(peerAddress)
if !found {
return nbssh.ErrPeerNotFound
}
return nbssh.VerifyHostKey(storedKey, presentedKey, peerAddress)
}
// cleanupSSHConfig removes NetBird SSH client configuration on shutdown
func (e *Engine) cleanupSSHConfig() {
if netstack.IsEnabled() {