Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ssh to private ec2 via bastion using ssh-run

Sukoon
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 18, 2022

Hello,

I am trying to login into my private ec2 host via bastion host and execute a shell script in the host using following pipeline.

 

- pipe: "atlassian/ssh-run:0.4.1"
variables:
SSH_USER: 'ec2-user'
SERVER: $SERVER
SSH_KEY: $SSH_KEY
MODE: script
COMMAND: bitbucket-pipelines.sh
EXTRA_ARGS: -o ProxyCommand='ssh -i /root/.ssh/pipelines_id ec2-user@16.210.69.43 -W %h:%p'
But I always get below error :
Bad stdio forwarding specification '%h:%p'' 

 Output:

Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.4.1

INFO: Executing the pipe...

INFO: Using passed SSH_KEY

INFO: Executing script bitbucket-pipelines.sh on 10.9.181.1

ssh -i /root/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 -o ProxyCommand='ssh -i /root/.ssh/pipelines_id ec2-user@16.210.69.43 -W %h:%p' ec2-user@10.0.141.68 bash -s

Bad stdio forwarding specification '%h:%p''

✖ Execution failed.

 

Can someone please help me with this ? 

2 answers

0 votes
Vu Ha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 6, 2022

@Sukoon for ssh-run just use JumpHost instead ProxyCommand 

EXTRA_ARGS: -J $SSH_USER@$BASTION_HOST 
for rsync-deploy use ProxyCommand
SSH_ARGS: '-v -o StrictHostKeyChecking=no -o ProxyCommand="ssh -W %h:%p -q $SSH_USER@$BASTION_HOST" -l $SSH_USER'
0 votes
lissyaka June 24, 2022

@Sukoon  hi.

This problem relates to quoting.

For complex command escaping/quotas issue could happened, because pipelines infra also do some additional escaping for all passed variables to pass them throughout a docker infra.

 

We will investigate your issue and notify you.

Cheers.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events