Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Can't create user that will login with a key #368

Closed

Description

When either leveraging secrets.yaml or add-user command with ssh-key to create a user with public key I am prompted for a password (which I never provided) to ssh with that user.

Tried with
aztk spark cluster add-user --id cluster1 --username stefan --ssh-key ~/.ssh/id_rsa.pub

and with this in my secrets.yaml
ssh_pub_key: ~/.ssh/id_rsa.pub

Then
aztk spark cluster ssh --id cluster1 --username stefan
prompts for a password, which of course I do not have....

If I use add-user with a user/password then I can get in.

What am I doing wrong? Using latest from master.

Activity

  1. jafreck commented on Feb 5, 2018

    @jafreck
    Member

    It doesn't appear like you are doing anything wrong. All of your steps look correct. Just to clarify, are you creating a user when you create the cluster? Or are you trying to add a user after the cluster is created?

    I just tried to reproduce this issue and was not able to do so. I can add a user and ssh into the cluster as expected using an ssh-key. Do you have a corresponding private key for the public key you are supplying?

  2. stefangordon commented on Feb 5, 2018

    @stefangordon
    Author

    So my initial create flow went like this:

    (aztk) root@DESKTOP-8SBD5UP:/mnt/e/code/aztk# aztk spark cluster create --id cluster1 --size 2
    -------------------------------------------
    spark cluster id:        cluster1
    spark cluster size:      2
    >        dedicated:      2
    >     low priority:      0
    spark cluster vm size:   Standard_NV6
    custom scripts:          [{'script': 'custom-scripts/jupyter.sh', 'runOn': 'master'}]
    subnet ID:               None
    file shares:             0
    docker repo name:        aztk/python:spark2.2.0-python3.6.2-gpu
    wait for cluster:        False
    username:                spark
    -------------------------------------------
    Cluster cluster1 is being provisioned.
    
    
    
    (aztk) root@DESKTOP-8SBD5UP:/mnt/e/code/aztk# aztk spark cluster ssh --id cluster1
    -------------------------------------------
    spark cluster id:    cluster1
    open webui:          http://localhost:8080
    open jobui:          http://localhost:4040
    open jobhistoryui:   http://localhost:18080
    open jupyter:        http://localhost:8888
    open namenodeui:     http://localhost:50070
    open rstudio server: http://localhost:8787
    ssh username:        spark
    connect:             True
    -------------------------------------------
    The authenticity of host '[20.190.59.127]:50000 ([20.190.59.127]:50000)' can't be established.
    ECDSA key fingerprint is 52:bf:d9:fa:31:ee:0f:ad:c1:1d:1c:27:eb:6e:b7:9e.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '[20.190.59.127]:50000' (ECDSA) to the list of known hosts.
    Password:
    Password:
    Password:
    Connection closed by 20.190.59.127
    

    and my secrets.yaml looks like this (excluding service principal):

    default:
        # SSH keys used to create a user and connect to a server.
        # The public key can either be the public key itself (ssh-rsa ...) or the path to the ssh key.
        ssh_pub_key: ~/.ssh/id_rsa.pub
        ssh_priv_key: ~/.ssh/id_rsa
    

    (those key files exist with RSA keys in them).

    So I assumed that was creating the spark user automatically with that key. I then tried creating a new user with the key and had a similar issue. Using bash-on-windows if relevant.

    (aztk) root@DESKTOP-8SBD5UP:/mnt/e/code/aztk# aztk spark cluster add-user --id cluster1 --username stefan --ssh-key ~/.ssh/id_rsa.pub
    -------------------------------------------
    spark cluster id:    cluster1
    username:            stefan
    -------------------------------------------
    ssh public key:      -----BEGIN PUBLIC KEY-----
    MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHU1OxsPFWYSQESHcJ6b/EaI32az
    RPCqffHsCysefAPlwH3FJ3q8jt3CpSJIPiPA9FuDmmfbapSe0+5TFnlEhO+AcBBN
    XJnVVsy7kr99Z885KX776j6CF2Tonbm6+smRg1fE6udL85vrEk6qgoHxQ2WzqgbO
    vSNy8VaSxHhcV53BAgMBAAE=
    -----END PUBLIC KEY-----
    
    -------------------------------------------
    (aztk) root@DESKTOP-8SBD5UP:/mnt/e/code/aztk# aztk spark cluster ssh --id cluster1 --username stefan
    -------------------------------------------
    spark cluster id:    cluster1
    open webui:          http://localhost:8080
    open jobui:          http://localhost:4040
    open jobhistoryui:   http://localhost:18080
    open jupyter:        http://localhost:8888
    open namenodeui:     http://localhost:50070
    open rstudio server: http://localhost:8787
    ssh username:        stefan
    connect:             True
    -------------------------------------------
    Password:
    
  3. jafreck commented on Feb 5, 2018

    @jafreck
    Member

    To rule out that this being issue with the keypair, can you generate a new pair of keys and test with those?

    Everything you've outlined looks correct, but when I follow your steps I'm still not able to reproduce. The spark user created by default should be created using the keys specified in secrets.yaml which makes me think this is an issue with the private key not matching the public key.

  4. stefangordon commented on Feb 5, 2018

    @stefangordon
    Author

    Totally makes sense, will do.

  5. stefangordon commented on Feb 6, 2018

    @stefangordon
    Author

    It was indeed a key problem (of some sort, not entirely sure what - but freshly created ones worked fine). Sorry for the trouble, thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions