vendredi 24 avril 2015

Troubleshooting public key denied from github

Trying to run a capistrano deploy using ssh agent forwarding but we're getting a permission denied publickey error when capistrano tries to clone from github.

Connecting to github with ssh -t git@github.com authenticates fine.

Deploy script:

set :ssh_options, { :forward_agent => true }

Looks like forwarding is working:

COMMAND='env|grep -i SSH' cap dev invoke
triggering load callbacks
* ←[32m2015-04-24 10:09:45 executing `dev'←[0m
triggering start callbacks for `invoke'
* ←[32m2015-04-24 10:09:45 executing `multistage:ensure'←[0m
* ←[32m2015-04-24 10:09:45 executing `invoke'←[0m
* ←[33mexecuting "env|grep -i SSH"←[0m
servers: ["dev.dataraptor.qa"]
[dev.dataraptor.qa] executing command
** [out :: dev.dataraptor.qa] SSH_CLIENT=10.71.16.49 53872 22
** [out :: dev.dataraptor.qa] SSH_TTY=/dev/pts/1
** [out :: dev.dataraptor.qa]
** [out :: dev.dataraptor.qa] SSH_AUTH_SOCK=/tmp/ssh-vEeuMFQIQj/agent.1474
** [out :: dev.dataraptor.qa] SSH_CONNECTION=10.71.16.49 53872 10.71.17.30 22
←[2;37mcommand finished in 219ms←[0m

Capistrano not forwarding agent:

COMMAND='ssh -Tv git@github.com' cap dev invoke
triggering load callbacks
* ←[32m2015-04-24 10:20:13 executing `dev'←[0m
triggering start callbacks for `invoke'
* ←[32m2015-04-24 10:20:13 executing `multistage:ensure'←[0m
* ←[32m2015-04-24 10:20:13 executing `invoke'←[0m
* ←[33mexecuting "ssh -Tv git@github.com"←[0m
servers: ["dev.dataraptor.qa"]
[dev.dataraptor.qa] executing command
** [out :: dev.dataraptor.qa] OpenSSH_6.0p1 Debian-4+deb7u1, OpenSSL 1.0.1e 11 Feb 2013
** [out :: dev.dataraptor.qa] debug1: Reading configuration data /etc/ssh/ssh_config
** [out :: dev.dataraptor.qa] debug1: /etc/ssh/ssh_config line 19: Applying options for *
** [out :: dev.dataraptor.qa] debug1: Connecting to github.com [192.30.252.130] port 22.
** [out :: dev.dataraptor.qa] debug1: Connection established.
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_rsa type 1
** [out :: dev.dataraptor.qa] debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
** [out :: dev.dataraptor.qa] debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_rsa-cert type -1
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_dsa type -1
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_dsa-cert type -1
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_ecdsa type -1
** [out :: dev.dataraptor.qa] debug1: identity file /home/deploy/.ssh/id_ecdsa-cert type -1
** [out :: dev.dataraptor.qa] debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
** [out :: dev.dataraptor.qa] debug1: no match: libssh-0.6.0
** [out :: dev.dataraptor.qa] debug1: Enabling compatibility mode for protocol 2.0
** [out :: dev.dataraptor.qa] debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u1
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_KEXINIT sent
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_KEXINIT received
** [out :: dev.dataraptor.qa] debug1: kex: server->client aes128-ctr hmac-sha1 none
** [out :: dev.dataraptor.qa] debug1: kex: client->server aes128-ctr hmac-sha1 none
** [out :: dev.dataraptor.qa] debug1: sending SSH2_MSG_KEX_ECDH_INIT
** [out :: dev.dataraptor.qa] debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
** [out :: dev.dataraptor.qa]
** [out :: dev.dataraptor.qa] debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
** [out :: dev.dataraptor.qa] debug1: Host 'github.com' is known and matches the RSA host key.
** [out :: dev.dataraptor.qa] debug1: Found key in /home/deploy/.ssh/known_hosts:10
** [out :: dev.dataraptor.qa]
** [out :: dev.dataraptor.qa] debug1: ssh_rsa_verify: signature correct
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_NEWKEYS sent
** [out :: dev.dataraptor.qa] debug1: expecting SSH2_MSG_NEWKEYS
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_NEWKEYS received
** [out :: dev.dataraptor.qa] debug1: Roaming not allowed by server
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_SERVICE_REQUEST sent
** [out :: dev.dataraptor.qa] debug1: SSH2_MSG_SERVICE_ACCEPT received
** [out :: dev.dataraptor.qa] Error reading response length from authentication socket.
** [out :: dev.dataraptor.qa]
** [out :: dev.dataraptor.qa] debug1: Authentications that can continue: publickey
** [out :: dev.dataraptor.qa] debug1: Next authentication method: publickey
** [out :: dev.dataraptor.qa] debug1: Offering RSA public key: /home/deploy/.ssh/id_rsa
** [out :: dev.dataraptor.qa] debug1: Authentications that can continue: publickey
** [out :: dev.dataraptor.qa] debug1: Trying private key: /home/deploy/.ssh/id_dsa
** [out :: dev.dataraptor.qa] debug1: Trying private key: /home/deploy/.
** [out :: dev.dataraptor.qa] debug1: No more authentication methods to try.
** [←[31mout :: dev.dataraptor.qa←[0m] ←[31mPermission denied (publickey).←[0m
←[2;37mcommand finished in 1043ms←[0m
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell '1.9.3-p448@mygems' -c 'ssh -Tv git@github.com'" o
n dev.dataraptor.qa

Capistrano error msg:

* ←[33mexecuting "git clone -q -b develop ssh://git@github.com:22/pic-development/dataraptor.git /var/www/dev.
dataraptor/releases/20150424180531 && cd /var/www/dev.dataraptor/releases/20150424180531 && git checkout -q -   b d
eploy 7c95d118c9837f801f4e314732c593e25feba3b1 && (echo 7c95d118c9837f801f4e314732c593e25feba3b1 > /var/www/dev.
dataraptor/releases/20150424180531/REVISION)"←[0m
servers: ["dev.dataraptor.qa"]
[dev.dataraptor.qa] executing command
** [dev.dataraptor.qa :: out] Error reading response length from authentication socket.
** ←[31m[dev.dataraptor.qa :: out] Permission denied (publickey).←[0m
** ←[31m[dev.dataraptor.qa :: out] fatal: Could not read from remote repository.
**
** Please make sure you have the correct access rights
** and the repository exists.←[0m
←[2;37mcommand finished in 1214ms←[0m
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell '1.9.3-p448@mygems' -c 'git clone -q -b develop ss
h://git@github.com:22/pic-development/dataraptor.git /var/www/dev.dataraptor/releases/20150424180531 && cd /var/
www/dev.dataraptor/releases/20150424180531 && git checkout -q -b deploy 7c95d118c9837f801f4e314732c593e25feba3b1
&& (echo 7c95d118c9837f801f4e314732c593e25feba3b1 > /var/www/dev.dataraptor/releases/20150424180531/REVISION)'"
on dev.dataraptor.qa

Aucun commentaire:

Enregistrer un commentaire