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

User creation script fails to create temp file on Cygwin #84

Open
jordanbtucker opened this issue Apr 29, 2016 · 9 comments
Open

User creation script fails to create temp file on Cygwin #84

jordanbtucker opened this issue Apr 29, 2016 · 9 comments

Comments

@jordanbtucker
Copy link

jordanbtucker commented Apr 29, 2016

 We are going to create an account with the following information

 Username: jordanbtucker
 Public Key: /home/Jordan/.ssh/id_rsa.pub
 Host: sf1.hashbang.sh


 Does this look correct? [Y/n]

 Creating your account...  Account Created!

 Would you like to add trusted/signed keys for our servers to your .ssh/known_hosts? [Y/n]
 Downloading GPG keys

gpg: requesting key 8FAA96F5 from hkp server keys.gnupg.net
gpg: C:/Users/Jordan/AppData/Roaming/gnupg/trustdb.gpg: trustdb created
gpg: key 8FAA96F5: public key "Hashbang Team <team@hashbang.sh>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

 Downloading key list

gpg: error creating `/tmp/hashbang.Cestkr/known_hosts': No such file or directory
gpg: handle plaintext failed: No such file or directory

 Unable to verify keys

 If you think this is a bug, please report it to
 -> https://github.com/hashbang/hashbang.sh/issues/

 The installer will not continue from here...
@KellerFuchs
Copy link
Member

@jordanbtucker Looks like the account got created:

Creating your account... Account Created!

Try running ssh jordanbtucker@sf1.hashbang.sh.

If this works, I will edit the bug report to reflect that this is an issue with failing to create a temporary file and bailing out.
What is the output of ls -l /bin/sh? (This should tell us what is the shell implementation used for sh scripts)

@jordanbtucker
Copy link
Author

Yes, the account got created, but it looks like the key was not transferred.

jordan@mara ~ $ ssh jordanbtucker@sf1.hashbang.sh
Agent admitted failure to sign using the key.
Permission denied (publickey).

jordan@mara ~ $ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Apr 29 15:30 /bin/sh -> dash

@KellerFuchs
Copy link
Member

@jordanbtucker No, creating a user and setting the key is done in a single API call.
However, the error from SSH looks like you had a public key without matching private key:

Agent admitted failure to sign using the key.

Did you modify ~/.ssh/id_rsa or ~/.ssh/id_rsa.pub in any way, and what is the output of ls -Al ~/.ssh ?

@jordanbtucker
Copy link
Author

I've verified that the keys match, and they work when SSHing from my Windows to my Linux machine.

On Linux:

# get modulus from private key and hash
jordan@mara ~ $ openssl rsa -in ~/.ssh/id_rsa -noout -modulus | openssl sha1
(stdin)= 214df9e992e945312e1b28baa83f03382c80d395

# convert public key to OpenSSL format, get modulus, and hash
jordan@mara ~ $ ssh-keygen -f ~/.ssh/id_rsa.pub -e -m PKCS8 | openssl rsa -pubin -noout -modulus | openssl sha1
(stdin)= 214df9e992e945312e1b28baa83f03382c80d395

# ~/.ssh listing
jordan@mara ~ $ ls -Al ~/.ssh/
total 20
-rw-r--r-- 1 jordan jordan  398 Apr 29 18:50 authorized_keys
-rw-r--r-- 1 jordan jordan  125 Apr 29 17:27 config
-rw------- 1 jordan jordan 1675 Apr 29 15:19 id_rsa
-rw------- 1 jordan jordan  398 Apr 29 15:19 id_rsa.pub
-rw-r--r-- 1 jordan jordan  764 Apr 29 16:57 known_hosts

On Windows:

# get modulus from private key and hash
{ ~ }  » openssl rsa -in ~/.ssh/id_rsa -noout -modulus | openssl sha1                           ~
(stdin)= 214df9e992e945312e1b28baa83f03382c80d395

# convert public key to OpenSSL format, get modulus, and hash
{ ~ }  » ssh-keygen -f ~/.ssh/id_rsa.pub -e -m PKCS8 | openssl rsa -pubin -noout -modulus | openssl sha1
(stdin)= 214df9e992e945312e1b28baa83f03382c80d395

# ~/.ssh listing
{ ~ }  » ls -Al ~/.ssh                                                                          ~
total 5
-rw-------+ 1 Jordan Jordan 1675 Apr 29 15:19 id_rsa
-rw-rwxr--+ 1 Jordan Jordan  398 Apr 29 15:19 id_rsa.pub

# ssh into Linux machine from Windows machine using keys
{ ~ }  » ssh jordan@mara                                                                        ~
Welcome to Linux Mint 17.3 Rosa (GNU/Linux 3.19.0-32-generic x86_64)

Welcome to Linux Mint
 * Documentation:  http://www.linuxmint.com
Last login: Fri Apr 29 18:53:13 2016 from vader.deathstar

@jordanbtucker
Copy link
Author

And now ssh jordanbtucker@sf1.hashbang.sh is working. I can't explain what happened.

I created a second account jordanbtucker2 since the first one wasn't working. You're welcome to delete the jordanbtucker2 user if you like. Sorry for the false alarm.

@KellerFuchs
Copy link
Member

@jordanbtucker No problem. Also, the error you get is definitely not normal.

@KellerFuchs KellerFuchs reopened this Apr 30, 2016
@KellerFuchs KellerFuchs changed the title User already exists after first failed attempt User creation script fails to create temp file Apr 30, 2016
@KellerFuchs
Copy link
Member

KellerFuchs commented Apr 30, 2016

@jordanbtucker The first run was not on Linux, right?

gpg: C:/Users/Jordan/AppData/Roaming/gnupg/trustdb.gpg: trustdb created

Which platform was that (msys? cygwin?), and how did you execute the script?

@jordanbtucker
Copy link
Author

Yes, on Windows using Cygwin, which is what the Babun shell uses. GPG was installed from Gpg4win.

I executed it just like I would in Linux:

curl https://hashbang.sh > hashbang.sh
chmod +x hashbang.sh
./hashbang.sh

@KellerFuchs KellerFuchs changed the title User creation script fails to create temp file User creation script fails to create temp file on Cygwin Apr 30, 2016
@KellerFuchs
Copy link
Member

@jordanbtucker OK. Somebody who has access to a Windows box (I don't) will have to reproduce the issue and fix it.

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