Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-copier not work on SSH proxy scenario #24

Open
molinacarlos opened this issue Dec 18, 2020 · 1 comment
Open

ssh-copier not work on SSH proxy scenario #24

molinacarlos opened this issue Dec 18, 2020 · 1 comment

Comments

@molinacarlos
Copy link

molinacarlos commented Dec 18, 2020

Version: openssh-node-execution-2.0.1

Using node definition that use bastion host / jump host scenario

<node name="presvricm06" hostname="10.2.235.245" osArch="amd64" osFamily="unix" osName="Linux" osVersion="Centos 7.7" username="root" ssh-authentication="privateKey" ssh-key-storage-path="keys/XXX/YYYzzz.privkey" local-ssh-agent="true" ssh-options='-o ConnectTimeout=10 -o ProxyCommand="ssh -W %h:%p [email protected]"' />

I am using the followinf job definition to test the case:

<joblist> <job> <defaultTab>output</defaultTab> <description></description> <dispatch> <excludePrecedence>true</excludePrecedence> <keepgoing>false</keepgoing> <rankOrder>ascending</rankOrder> <successOnEmptyNodeFilter>false</successOnEmptyNodeFilter> <threadcount>1</threadcount> </dispatch> <executionEnabled>true</executionEnabled> <group>POC bastion host</group> <id>17e9037b-2d35-4372-a436-f7d8cd16ec45</id> <loglevel>INFO</loglevel> <name>POC bastion host</name> <nodeFilterEditable>false</nodeFilterEditable> <nodefilters> <filter>name: server.*</filter> </nodefilters> <nodesSelectedByDefault>true</nodesSelectedByDefault> <plugins /> <scheduleEnabled>true</scheduleEnabled> <sequence keepgoing='false' strategy='parallel'> <command> <description>Ejecucion</description> <fileExtension>sh</fileExtension> <scriptargs /> <scriptfile>/datos/test.sh</scriptfile> <scriptinterpreter>/bin/bash</scriptinterpreter> </command> </sequence> <uuid>17e9037b-2d35-4372-a436-f7d8cd16ec45</uuid> </job> </joblist>

Running job, I got the following error

unknown option -- W usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2

Making some debug on /var/lib/rundeck/libext/cache/openssh-node-execution-2.0.1/ssh-copy.sh I got the following facts

'
89: SSHOPTS='-p -P 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet -o ConnectTimeout=10 -o ProxyCommand="ssh -W %h:%p [email protected]" -i /tmp/.ssh-exec/[email protected]'
94: RUNSCP='scp -p -P 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet -o ConnectTimeout=10 -o ProxyCommand="ssh -W %h:%p [email protected]" -i /tmp/.ssh-exec/[email protected] /datos/test.sh [email protected]:/tmp/13-5697-presvricm06-test.sh'
96: [[ -n '' ]]
107: [[ -n '' ]]
119: [[ password == \p\r\i\v\a\t\e\k\e\y ]]
135: [[ true == '' ]]
141: unset RD_CONFIG_SSH_KEY_STORAGE_PATH
142: unset RD_NODEEXECUTOR_SSH_KEY_STORAGE_PATH
143: unset RD_NODEEXECUTOR_SSH_KEY_PASSPHRASE_STORAGE_PATH
144: unset RD_CONFIG_SSH_PASSWORD_STORAGE_PATH
145: unset RD_NODEEXECUTOR_SSH_PASSWORD_STORAGE_PATH
148: scp -p -P 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=quiet -o ConnectTimeout=10 -o 'ProxyCommand="ssh' -W %h:%p '[email protected]"' -i /tmp/.ssh-exec/[email protected] /datos/test.sh [email protected]:/tmp/13-5697-presvricm06-test.sh
unknown option -- W
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2
148: exit 1
'
Note single quotes (') on line 148 --> o 'ProxyCommand="ssh' -W %h:%p '[email protected]"'

These single quotes are different that RUNSCP variable is built on line 94.

Any ideas to fix or address this issue?

Thanks in advance

@giancarlo100
Copy link

you need to edit the scripts in /var/lib/rundeck/libext/cache/openssh-node-execution-2.0.2

in this way

line: 150 ssh-copy.sh

#finally, execute scp but don't print to STDOUT
eval $RUNSCP

line 144 ssh-exec.sh
#finally, use exec to pass along exit code of the SSH command
eval $RUNSSH

remember to edit them also in the file /var/lib/rundeck/libext/openssh-node-execution-2.0.2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants