mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
Merge pull request #1181 from mgukov/develop
IgnoreHostKey policy for known_hosts checking
This commit is contained in:
commit
648d945be6
@ -12,6 +12,8 @@ import (
|
||||
"github.com/go-git/go-git/v5/plumbing/transport/http"
|
||||
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
|
||||
"github.com/go-git/go-git/v5/storage/memory"
|
||||
|
||||
ssh2 "golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
type GoGitClient struct{}
|
||||
@ -35,6 +37,15 @@ func getAuthMethod(r GitRepository) (transport.AuthMethod, error) {
|
||||
return nil, sshErr
|
||||
}
|
||||
|
||||
clientCfg, err := publicKey.ClientConfig()
|
||||
if err != nil {
|
||||
r.Logger.Log("Unable to creating ssh auth method")
|
||||
return nil, sshErr
|
||||
}
|
||||
|
||||
hostKeyHelper := ssh.HostKeyCallbackHelper{HostKeyCallback: ssh2.InsecureIgnoreHostKey()}
|
||||
hostKeyHelper.SetHostKeyCallback(clientCfg)
|
||||
|
||||
return publicKey, sshErr
|
||||
} else if r.Repository.SSHKey.Type == db.AccessKeyLoginPassword {
|
||||
password := &http.BasicAuth{
|
||||
|
Loading…
Reference in New Issue
Block a user