TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
183 stars 49 forks source link

sdc-docker-setup.sh script does not work on OS X 10.10 #39

Closed hairyhenderson closed 8 years ago

hairyhenderson commented 9 years ago
$ sh sdc-docker-setup.sh https://us-east-1.api.joyentcloud.com myuser ~/.ssh/id_rsa 
Setting up Docker client for SDC using:
    CloudAPI:        https://us-east-1.api.joyentcloud.com
    Account:         myuser
    Key:             /Users/epoch/.ssh/id_rsa

$ echo $?
1

Digging into the script, it looks like the sshGetMD5Fingerprint function is at fault, specifically this command:

    s=$(ssh-keygen -E md5 -l -f "$sshPubKeyPath" 2> /dev/null)

The version of ssh-keygen that I have on my Mac doesn't have a -E option.

$ ssh -V
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011

Based on the comment above the sshGetMD5Fingerprint function, it looks like this was written assuming OpenSSH 6.8 or above. This is going to be a problem for other OS X users with the default SSH client...

dwlf commented 9 years ago

@hairyhenderson there is a fallback for older OpenSSH right under that in the script: https://github.com/joyent/sdc-docker/blob/master/tools/sdc-docker-setup.sh#L121

    s=$(ssh-keygen -E md5 -l -f "$sshPubKeyPath" 2> /dev/null)
    if [[ $? -eq  0 ]]; then
        echo "$s" | awk '{print $2}' | tr -d '\n' | cut -d: -f2-;
    else
        # OpenSSH version < 6.8
        ssh-keygen -l -f "$sshPubKeyPath" | awk '{print $2}' | tr -d '\n';
    fi
dwlf commented 9 years ago

hmm, I am also able to reproduce the failure now though.

dwlf commented 9 years ago

@hairyhenderson could you test with bash, bash sdc-docker-setup.sh instead of sh sdc-docker-setup.sh?

dwlf commented 9 years ago

Fun, "If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well."

hairyhenderson commented 9 years ago

@lloydde - ah, sneaky... bash works. I see you've got a commit to fix this so I'll leave this open until that gets merged. Thank you!

rmustacc commented 9 years ago

@hairyhenderson were there instructions that indicated that you should use sh? If so, we should get them fixed, as the script is unlikely to turn into a proper sh script anytime soon. sh almost works by fluke on OS X because sh is a link to bash and bash isn't that strict with sh compat.

ryanpuck commented 9 years ago

It states to use sh at https://apidocs.joyent.com/docker/

dwlf commented 9 years ago

Also in the blog posts, I'll make those changes now.

trentm commented 9 years ago

@lloydde thanks!

dwlf commented 9 years ago

Jira ticket: https://smartos.org/bugview/DOCKER-442.

andrew-wharton commented 9 years ago

please also fix https://my.joyent.com/main/#!/docker/intro, stopped me in my tracks... :-(

dwlf commented 9 years ago

@andrew-wharton sorry about that, I have a pull request for that joyent/piranha#3218 and the team lead, @dan-luk hopes to get it merged and hopefully online tomorrow. /cc @eviking , @tysonhom .

dwlf commented 9 years ago

sdc-docker-setup.sh will now complain and give correct command to run, joyent/sdc-docker@0d9733db6e0a96b0af3b97e41098541f7d608b92 . Thanks @trentm !

Keeping open pending JPC portal fix deployed.

xer0x commented 8 years ago

Closing. This has been deployed to the JPC portal.