connection: ignore errors when parsing ssh_config

The new ssh_Config feature doesn't work on my system because the lib
fails to parse configs using Match[1]. However Fedora and RHEL based
distros seem to ship /etc/ssh/ssh_config.d/50-redhat.conf which contains
a Match line thus it always fails to parse and never uses the proper
values from my home dir config.

[1] https://github.com/kevinburke/ssh_config/issues/6

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
(cherry picked from commit 8a5ec2c505392588827d9dad847fd797578d0ffb)
This commit is contained in:
Paul Holzinger
2024-11-14 16:17:50 +01:00
parent f7877bf9db
commit c49944ea02

View File

@ -170,6 +170,7 @@ func sshClient(_url *url.URL, uri string, identity string, machine bool) (Connec
// ssh_config
alias := _url.Hostname()
cfg := ssh_config.DefaultUserSettings
cfg.IgnoreErrors = true
found := false
if val := cfg.Get(alias, "User"); val != "" {
userinfo = url.User(val)