INNER CODE UNIT · Go
remoteRun
bliporg/blip · ci/lua_docs_deploy_prod/main.go:269
func remoteRun(user, addr, port, privateKey, knownhostsFilepath, cmd string) (string, error) {
// privateKey could be read from a file, or retrieved from another storage
// source, such as the Secret Service / GNOME Keyring
key, err := ssh.ParsePrivateKey([]byte(privateKey))
if err != nil {
return "", err
}
hostKeyCallback, err := knownhosts.New(knownhostsFilepath)
if err != nil {
return "", err
}
// Authentication
config := &ssh.ClientConfig{
User: user,
HostKeyCallback: hostKeyCallback, // ssh.InsercureIgnoreHostKey to allow any host
Auth: []ssh.AuthMethod{