fix: harden SSH trust and dependency security
This commit is contained in:
@@ -596,12 +596,7 @@ func (c *Client) connectViaJumpHosts(sc models.SSHConfig, finalConfig *ssh.Clien
|
||||
jumpAuth = append(jumpAuth, ssh.PublicKeys(signer))
|
||||
}
|
||||
|
||||
jumpConfig := &ssh.ClientConfig{
|
||||
User: jump.Username,
|
||||
Auth: jumpAuth,
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: finalConfig.Timeout,
|
||||
}
|
||||
jumpConfig := jumpHostClientConfig(jump, jumpAuth, finalConfig)
|
||||
|
||||
if currentClient == nil {
|
||||
client, err := ssh.Dial("tcp", jumpAddr, jumpConfig)
|
||||
@@ -648,6 +643,15 @@ func (c *Client) connectViaJumpHosts(sc models.SSHConfig, finalConfig *ssh.Clien
|
||||
return ssh.NewClient(ncc, chans, reqs), nil
|
||||
}
|
||||
|
||||
func jumpHostClientConfig(jump models.JumpHost, auth []ssh.AuthMethod, finalConfig *ssh.ClientConfig) *ssh.ClientConfig {
|
||||
return &ssh.ClientConfig{
|
||||
User: jump.Username,
|
||||
Auth: auth,
|
||||
HostKeyCallback: finalConfig.HostKeyCallback,
|
||||
Timeout: finalConfig.Timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// parsePrivateKey loads and parses an SSH private key file. If the key is
|
||||
// encrypted and getPassphrase is provided, it will attempt decryption.
|
||||
func (c *Client) parsePrivateKey(path string, getPassphrase func() (string, error)) (ssh.Signer, error) {
|
||||
|
||||
Reference in New Issue
Block a user