Skip to content

cephadm: add sudo ssh user option#35606

Merged
sebastian-philipp merged 1 commit intoceph:masterfrom
Daniel-Pivonka:cephadm-45653-44866
Jul 1, 2020
Merged

cephadm: add sudo ssh user option#35606
sebastian-philipp merged 1 commit intoceph:masterfrom
Daniel-Pivonka:cephadm-45653-44866

Conversation

@Daniel-Pivonka
Copy link

@Daniel-Pivonka Daniel-Pivonka commented Jun 16, 2020

add the ability to use a non-root users for connecting to hosts, this user requires pass wordless sudo access

useful for clusters that have root ssh access disabled

Fixes: https://tracker.ceph.com/issues/44866

Fixes: [https://tracker.ceph.com/issues/45653, https://tracker.ceph.com/issues/44866]
Signed-off-by: Daniel-Pivonka dpivonka@redhat.com

@Daniel-Pivonka Daniel-Pivonka requested a review from a team as a code owner June 16, 2020 21:52
@sebastian-philipp
Copy link
Contributor

can you please add Fixes: https://tracker.ceph.com/issues/44866 do your commit message?

@sebastian-philipp
Copy link
Contributor

http://pulpito.ceph.com/swagner-2020-06-23_13:14:03-rados:cephadm-wip-swagner2-testing-2020-06-23-1057-distro-basic-smithi/5172390

INFO:cephadm:Wrote public SSH key to to /home/ubuntu/cephtest/ceph.pub
INFO:cephadm:Adding key to root@localhost's authorized_keys...
Traceback (most recent call last):
  File "/home/ubuntu/cephtest/cephadm", line 4851, in <module>
    r = args.func()
  File "/home/ubuntu/cephtest/cephadm", line 1185, in _default_image
    return func()
  File "/home/ubuntu/cephtest/cephadm", line 2716, in command_bootstrap
    with open(auth_keys_file, 'a') as f:
FileNotFoundError: [Errno 2] No such file or directory: '//root/.ssh/authorized_keys'

@Daniel-Pivonka
Copy link
Author

not sure why i never got that error in my testing but should be fixed

Copy link
Contributor

@mgfritch mgfritch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests are still failing:
http://pulpito.ceph.com/mgfritch-2020-06-24_23:08:15-rados-wip-mgfritch-testing-2020-06-24-1302-distro-basic-smithi/

2020-06-24T23:26:27.855 INFO:teuthology.orchestra.run.smithi198.stderr:INFO:cephadm:Wrote public SSH key to to /home/ubuntu/cephtest/ceph.pub
2020-06-24T23:26:27.855 INFO:teuthology.orchestra.run.smithi198.stderr:INFO:cephadm:Adding key to root@localhost's authorized_keys...
2020-06-24T23:26:27.857 INFO:teuthology.orchestra.run.smithi198.stderr:Traceback (most recent call last):
2020-06-24T23:26:27.858 INFO:teuthology.orchestra.run.smithi198.stderr:  File "/home/ubuntu/cephtest/cephadm", line 4852, in <module>
2020-06-24T23:26:27.858 INFO:teuthology.orchestra.run.smithi198.stderr:    r = args.func()
2020-06-24T23:26:27.858 INFO:teuthology.orchestra.run.smithi198.stderr:  File "/home/ubuntu/cephtest/cephadm", line 1185, in _default_image
2020-06-24T23:26:27.858 INFO:teuthology.orchestra.run.smithi198.stderr:    return func()
2020-06-24T23:26:27.858 INFO:teuthology.orchestra.run.smithi198.stderr:  File "/home/ubuntu/cephtest/cephadm", line 2717, in command_bootstrap
2020-06-24T23:26:27.859 INFO:teuthology.orchestra.run.smithi198.stderr:    with open(auth_keys_file, 'a') as f:
2020-06-24T23:26:27.859 INFO:teuthology.orchestra.run.smithi198.stderr:FileNotFoundError: [Errno 2] No such file or directory: '/root/.ssh/authorized_keys'

@sebastian-philipp
Copy link
Contributor

@mgfritch if a test run fails, can you also remove the [needs-qa] label? otherwise someone else might schedule a new run with the old code

Copy link
Contributor

@mgfritch mgfritch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still a couple issues:

  1. the group name will likely never be equal to the username for non-root users
  2. needs error handling to avoid a traceback when given a non-existent user

maybe cherry-pick/squash 57f8adc?

Copy link
Contributor

@mgfritch mgfritch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

add the ability to use a non-root users for connecting to hosts, this user requires pass wordless sudo access

useful for clusters that have root ssh access disabled

Fixes: https://tracker.ceph.com/issues/44866
Signed-off-by: Daniel-Pivonka <dpivonka@redhat.com>
@mgfritch
Copy link
Contributor

mgfritch commented Jul 1, 2020

@mgfritch
Copy link
Contributor

mgfritch commented Jul 1, 2020

retest this please

@sebastian-philipp
Copy link
Contributor

jenkins test make check

@kebyn
Copy link

kebyn commented Aug 27, 2020

@Daniel-Pivonka Hello
cephadm
I'm very sorry, I have some doubts about this change. After adding the ssh user, how to execute orch host add host with ssh user in cephadm?
Is this change correct, thank you.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants