git: Add git.HostKeyAlgos
Enables the setting of HostKey algorithms to be used from a client perspective. This implementation supports go-git and libgit2 when in ManagedTransport. Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
parent
d425923a54
commit
4e3e62923b
|
@ -103,5 +103,9 @@ func (a *CustomPublicKeys) ClientConfig() (*gossh.ClientConfig, error) {
|
||||||
if len(git.KexAlgos) > 0 {
|
if len(git.KexAlgos) > 0 {
|
||||||
config.Config.KeyExchanges = git.KexAlgos
|
config.Config.KeyExchanges = git.KexAlgos
|
||||||
}
|
}
|
||||||
|
if len(git.HostKeyAlgos) > 0 {
|
||||||
|
config.HostKeyAlgorithms = git.HostKeyAlgos
|
||||||
|
}
|
||||||
|
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -421,6 +421,9 @@ func cacheKeyAndConfig(remoteAddress string, cred *git2go.Credential) (string, *
|
||||||
if len(git.KexAlgos) > 0 {
|
if len(git.KexAlgos) > 0 {
|
||||||
cfg.Config.KeyExchanges = git.KexAlgos
|
cfg.Config.KeyExchanges = git.KexAlgos
|
||||||
}
|
}
|
||||||
|
if len(git.HostKeyAlgos) > 0 {
|
||||||
|
cfg.HostKeyAlgorithms = git.HostKeyAlgos
|
||||||
|
}
|
||||||
|
|
||||||
return ck, cfg, nil
|
return ck, cfg, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,14 @@ type AuthOptions struct {
|
||||||
CAFile []byte
|
CAFile []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of custom key exchange algorithms to be used for ssh connections.
|
// KexAlgos hosts the key exchange algorithms to be used for ssh connections.
|
||||||
|
// If empty, golang's default is used instead.
|
||||||
var KexAlgos []string
|
var KexAlgos []string
|
||||||
|
|
||||||
|
// HostKeyAlgos holds the HostKey algorithms that the ssh client will advertise
|
||||||
|
// to the server. If empty, golang's default is used instead.
|
||||||
|
var HostKeyAlgos []string
|
||||||
|
|
||||||
// Validate the AuthOptions against the defined Transport.
|
// Validate the AuthOptions against the defined Transport.
|
||||||
func (o AuthOptions) Validate() error {
|
func (o AuthOptions) Validate() error {
|
||||||
switch o.Transport {
|
switch o.Transport {
|
||||||
|
|
Loading…
Reference in New Issue