mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-27 02:52:14 +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/http"
|
||||||
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
|
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
|
||||||
"github.com/go-git/go-git/v5/storage/memory"
|
"github.com/go-git/go-git/v5/storage/memory"
|
||||||
|
|
||||||
|
ssh2 "golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GoGitClient struct{}
|
type GoGitClient struct{}
|
||||||
@ -35,6 +37,15 @@ func getAuthMethod(r GitRepository) (transport.AuthMethod, error) {
|
|||||||
return nil, sshErr
|
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
|
return publicKey, sshErr
|
||||||
} else if r.Repository.SSHKey.Type == db.AccessKeyLoginPassword {
|
} else if r.Repository.SSHKey.Type == db.AccessKeyLoginPassword {
|
||||||
password := &http.BasicAuth{
|
password := &http.BasicAuth{
|
||||||
|
Loading…
Reference in New Issue
Block a user