I am deploying through pm2 and a proxy server (BitbucketPipeline -> authentication to B -> deploying to C)
Here is my pipeline
- npm run test
- mkdir -p ~/.ssh
- cat bitbucket-ssh-config >> ~/.ssh/config
- npm install -g pm2
- npm run deploy-development # triggers pm2 deployment
Here is my bitbucket-ssh-config :
ProxyCommand ssh -i ~/.ssh/id_rsa -W %h:%p USER@B
It seems to work perfectly but i get the following error :
Warning: Identity file /root/.ssh/id_rsa not accessible: No such file or directory.
I could generate my own private key but I prefer to use the default one, how can I do ?
I finally tried to use "/opt/atlassian/pipelines/agent/ssh/id_rsa"
I was successfully connecting to the server "B" directly but getting an error after:
ssh_exchange_identification: Connection closed by remote host
So I tried to re-generate the key pair. And I append it to ".ssh/authorized_keys" of both servers (B & C) and now it doesn't work anymore and i can't even ssh to the server B ?
EDIT 2 :
I finally tried with a custom key pair by adding this script step
- (umask 077 ; echo $DEV_PIPELINE_KEY | base64 --decode > ~/.ssh/id_rsa)
It suvccessfully authenticate through the gateway but then it's blocked and I don't get why as I use th exact same way from my computer
Warning: Permanently added the RSA host key for IP address 'xxxxxx' to the list of known hosts.
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Authentication succeeded (publickey).
Authenticated to xxxxx.com ([xxxxxxxx]:22).
debug1: channel_connect_stdio_fwd xxxxxx:22
debug1: channel 0: new [stdio-forward]
debug1: getpeername failed: Bad file descriptor
debug1: Requesting email@example.com
debug1: Entering interactive session.
debug1: client_input_global_request: rtype firstname.lastname@example.org want_reply 0
Host key verification failed.
debug1: channel 0: free: direct-tcpip: listening port 0 for xxxxxx port 22, connect from 127.0.0.1 port 65535 to UNKNOWN port 65536, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Killed by signal 1.
...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events