From 00e709d515e72ea1900b32047fea33f83632d8c7 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Tue, 9 Jan 2024 18:04:19 -0800 Subject: [PATCH] reload ssh config files when importing them (#219) The ssh_config library only loaded the config data the first time certain functions are used. After that, cached values are used instead. This library has been updated in a fork to add a method that allows the configuration files to be reloaded. This update takes advantage of that change so the config files can be updated without restarting waveterm. --- go.work.sum | 2 ++ wavesrv/go.mod | 1 + wavesrv/pkg/cmdrunner/cmdrunner.go | 1 + 3 files changed, 4 insertions(+) diff --git a/go.work.sum b/go.work.sum index e3ff478f3..132842daf 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,6 +1,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/wavetermdev/ssh_config v0.0.0-20240109090616-36c8da3d7376 h1:tFhJgTu7lgd+hldLfPSzDCoWUpXI8wHKR3rxq5jTLkQ= +github.com/wavetermdev/ssh_config v0.0.0-20240109090616-36c8da3d7376/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/wavesrv/go.mod b/wavesrv/go.mod index 2606d7354..a9864debd 100644 --- a/wavesrv/go.mod +++ b/wavesrv/go.mod @@ -30,3 +30,4 @@ require ( ) replace github.com/wavetermdev/waveterm/waveshell => ../waveshell +replace github.com/kevinburke/ssh_config => github.com/wavetermdev/ssh_config v0.0.0-20240109090616-36c8da3d7376 diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 8562ae173..96472a812 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -1627,6 +1627,7 @@ func RemoteConfigParseCommand(ctx context.Context, pk *scpacket.FeCommandPacketT localConfig := filepath.Join(home, ".ssh", "config") systemConfig := filepath.Join("/", "ssh", "config") sshConfigFiles := []string{localConfig, systemConfig} + ssh_config.ReloadConfigs() hostPatterns, hostPatternsErr := resolveSshConfigPatterns(sshConfigFiles) if hostPatternsErr != nil { return nil, hostPatternsErr