cephadm: Allow users to provide ssh keys during bootstrap#35195
cephadm: Allow users to provide ssh keys during bootstrap#35195sebastian-philipp merged 2 commits intoceph:masterfrom
Conversation
|
@sebastian-philipp Can we assume that If yes, then we can have a single command Or maybe it's better to explicitly set both anyway, thoughts? |
src/cephadm/cephadm
Outdated
| mounts = {} | ||
| mounts[pathify(args.ssh_private_key)] = '/tmp/cephadm-ssh-key:z' | ||
| mounts[pathify(args.ssh_public_key)] = '/tmp/cephadm-ssh-key.pub:z' |
There was a problem hiding this comment.
| mounts = {} | |
| mounts[pathify(args.ssh_private_key)] = '/tmp/cephadm-ssh-key:z' | |
| mounts[pathify(args.ssh_public_key)] = '/tmp/cephadm-ssh-key.pub:z' | |
| mounts = { | |
| pathify(args.ssh_private_key): '/tmp/cephadm-ssh-key:z' | |
| pathify(args.ssh_public_key): '/tmp/cephadm-ssh-key.pub:z' | |
| } |
| parser_bootstrap.add_argument( | ||
| '--ssh-private-key', | ||
| help='SSH private key') | ||
| parser_bootstrap.add_argument( | ||
| '--ssh-public-key', | ||
| help='SSH public key') |
There was a problem hiding this comment.
?
| parser_bootstrap.add_argument( | |
| '--ssh-private-key', | |
| help='SSH private key') | |
| parser_bootstrap.add_argument( | |
| '--ssh-public-key', | |
| help='SSH public key') | |
| parser_bootstrap.add_argument( | |
| '--ssh-private-key', | |
| type=argparse.FileType('r'), | |
| help='SSH private key') | |
| parser_bootstrap.add_argument( | |
| '--ssh-public-key', | |
| type=argparse.FileType('r'), | |
| help='SSH public key') |
FileType also checks whether the file exists, is readable and can be opened, and opens these files, so the filename will be stored in args.ssh_*_key.name.
| def _set_priv_key(self, inbuf=None): | ||
| if inbuf is None or len(inbuf) == 0: | ||
| return -errno.EINVAL, "", "empty private ssh key provided" | ||
| self.set_store("ssh_identity_key", inbuf) |
There was a problem hiding this comment.
Is there any plan to remediate this? Storing private SSH keys in the clear (Is this somehow printed to the logs? Is this mon key-value store encrypted?) sounds like a serious attack vector: Dashboard's CVE-2020-1699 (or any other user-facing component breach) would expose the filesystem under ceph user, but with this data there everything else would be compromised, right?
There was a problem hiding this comment.
@epuertat AFAIK, it's not possible to encrypt "config-keys". Note that this security issue is not being introduced in this PR, it's already present for the "generated SSH key" - https://github.com/ceph/ceph/blob/master/src/pybind/mgr/cephadm/module.py#L745
@sebastian-philipp was this security issue already discussed? Should we have a separate issue for that?
FYI, a similar discussion happened here ceph/ceph-iscsi#173 (comment)
There was a problem hiding this comment.
@sebastian-philipp Rook certainly relies on K8s secrets, but not sure how cephadm could leverage something similar.
be01589 to
3d36ebe
Compare
|
can we also set the ssh config? |
epuertat
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments @ricardoasmarques !
@sebastian-philipp I've pushed a new commit that will alow users to provide ssh config during bootstrap ( |
|
Big thanks! Do you also want to amend the man page? https://docs.ceph.com/docs/master/man/8/cephadm/ |
Fixes: https://tracker.ceph.com/issues/45629 Signed-off-by: Ricardo Marques <rimarques@suse.com>
Custom ssh config can be provided by using the '--ssh-config' option Signed-off-by: Ricardo Marques <rimarques@suse.com>
c1ac09f to
84c390f
Compare
@sebastian-philipp Good catch. Man page is now updated. |
With this PR user will be able to provide their own SSH keys:
Even for the bootstrap:
Fixes: https://tracker.ceph.com/issues/45629
Signed-off-by: Ricardo Marques rimarques@suse.com
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox