Skip to content

Issue with using OpenSSH with Cygwin bash and Ansible (quoting issue). #1212

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

Closed
bielawb opened this issue Jul 13, 2018 · 1 comment
Closed

Comments

@bielawb
Copy link

bielawb commented Jul 13, 2018

"OpenSSH for Windows" version
7.7.1.0

Server OperatingSystem
Windows Server 2012 R2 Standard

Client OperatingSystem

$ ssh -V
OpenSSH_7.5p1 Ubuntu-10ubuntu0.1, OpenSSL 1.0.2g  1 Mar 2016

$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.10
DISTRIB_CODENAME=artful
DISTRIB_DESCRIPTION="Ubuntu 17.10"
NAME="Ubuntu"
VERSION="17.10 (Artful Aardvark)"

I think it might be related to #1206
We are trying to use sshd with default shell (DefaultShell registry setting) pointing at Cygwin bash. It seems to work fine interactively, but ansible running on Ubuntu is having issues with quoting. Following fails when run agains Windows box running Win32-OpenSSH, but works fine in OpenSSH that ships with Cygwin itself.

Actual result on Win32-OpenSSH:

$ ssh user@host '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1531390575.01-172404816163862 `" && echo ansible-tmp-1531390575.01-172404816163862="` echo /tmp/ansible-tmp-1531390575.01-172404816163862 `" ) && sleep 0'"'"''
You are about to ssh to Windows box (tadam!)
Please make sure that you use your app account to login!
echo: -c: line 0: unexpected EOF while looking for matching `''
echo: -c: line 1: syntax error: unexpected end of file

Expected results (the one observed when talking to Cygwin OpenSSH on another box):

$ ssh user@host2 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1531390575.01-172404816163862 `" && echo ansible-tmp-1531390575.01-172404816163862="` echo /tmp/ansible-tmp-1531390575.01-172404816163862 `" ) && sleep 0'"'"''
ansible-tmp-1531390575.01-172404816163862=/tmp/ansible-tmp-1531390575.01-172404816163862

You can find code responsible for generating this command here (as far as I can tell): https://github.com/ansible/ansible/blob/06f73ad578d840c7ea5875b7cd4ffd08e2d9d0e8/lib/ansible/plugins/shell/__init__.py#L152-L163

We would like to use Ansible w/ OpenSSH/ Cygwin but that issue is blocking us right now.

@manojampalam
Copy link
Contributor

This is not related to #1206, rather #1082

I believe if we can accurately implement execve() on Windows, this should go away.
@penguin359 proposed a solution in #1082, but I haven't gotten far yet to think through and validate it.

Please continue further conversation on #1082

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

No branches or pull requests

2 participants