Repository navigation
iscsi: Attempt to pull SSL crt and key's from mon config-key store - #173
Conversation
|
This is still a WIP, just wanted to post it somewhere. Still needs debugging, testing, docs and well tests :P But thought better it was done from the beginning in the open, so here it is :) If someone could add the DNM tag then that'll be great. |
| if not ret: | ||
| return temp_files | ||
|
|
||
| cmd["key"] = "iscsi/{}/iscsi-gateway.key".format(client_name) |
There was a problem hiding this comment.
I would need to double-check from the cephadm-side, but for security reasons, is the private key locked down so only the iSCSI user can read them?
There was a problem hiding this comment.
I don't think it's limited to the iscsi user unfortunately. Though you would need a keyring with I guess mon read caps.. I haven't tested this. So you'd at least need to be authenticated.
But a very interesting point
There was a problem hiding this comment.
using mon caps you could limit access to this prefix for just the iscsi user though. We use similar things for the mgr, for instance, although we achieve that in particular by hardcoding those caps via the mgr profile.
In https://docs.ceph.com/docs/master/rados/operations/user-management/#authorization-capabilities you will find a few examples of this, but I would imagine you'd want to limit access to that key via
mon 'allow command "config-key get" with key prefix iscsi/$client_name/iscsi-gateway.key,allow command "config-key set" with key prefix iscsi/$client_name/iscsi-gateway.key"
If you want to see a lot more examples of how this could be achieved, you can take a look at qa/workunits/mon/test_config_key_caps.sh.
61f6348 to
b678e8a
Compare
This if the first draft of the ceph-iscsi in cephadm.
There are a few gotchas when running `rbd-target-api` in a container:
1. We need both the ceph.conf and iscsi-gateway.cfg, so needed to
ability to pass extra config. This latter is based off the spec, so now
the daemon config func api allows you to return a dict of configs:
{ 'config': '<str>' # will be appended to the ceph.conf
'<conf name>': 'str', # Will be dumped in datadir/<conf name>
...
}
It will be up to cephadm to know to bind mount it to the right location.
The first 'config' isn't used by this patch, but makes it possible for
specs or config funcs to append anything? maybe it's overkill.
2. We need the kernel's configfs in the container so we can configure
LIO. There is a chicken and egg problem, configfs isn't mounted on the
host to bind mount when the container starts. So now a check is added to
the `unit.run` and cleanup in the `unit.poststop` scripts for
daemon_type iscsi.
3. rbd-target-api is python and hardcodes a few things, like logging
through `/dev/log` which happens to be a domain socket. So `/dev/log`
also needed to be bind mounted into the continer.
4. The daemon expects the keyring to be in `/etc/ceph` so this needed to
be specifically bind mounted to the correct location too.
As this currently stands this is deploying and starting the api on port
5000, so seems to be "working", also gateway.conf does exist in the
pool. I have yet to set up an iscsi device, but will test that next.
The `rbd-target-api` daemon expects the ssl key and cert to be named a
certain name in the contianer. So SSL isn't working yet. However, I do
hav a PR in ceph-iscsi to look in the mon config-key store for them[0].
[0] - ceph/ceph-iscsi#173
Signed-off-by: Matthew Oliver <[email protected]>
|
ping @ricardoasmarques + @matthewoliver anything I can do to unstuck this? |
This if the first draft of the ceph-iscsi in cephadm.
There are a few gotchas when running `rbd-target-api` in a container:
1. We need both the ceph.conf and iscsi-gateway.cfg, so needed to
ability to pass extra config. This latter is based off the spec, so now
the daemon config func api allows you to return a dict of configs:
{ 'config': '<str>' # will be appended to the ceph.conf
'<conf name>': 'str', # Will be dumped in datadir/<conf name>
...
}
It will be up to cephadm to know to bind mount it to the right location.
The first 'config' isn't used by this patch, but makes it possible for
specs or config funcs to append anything? maybe it's overkill.
2. We need the kernel's configfs in the container so we can configure
LIO. There is a chicken and egg problem, configfs isn't mounted on the
host to bind mount when the container starts. So now a check is added to
the `unit.run` and cleanup in the `unit.poststop` scripts for
daemon_type iscsi.
3. rbd-target-api is python and hardcodes a few things, like logging
through `/dev/log` which happens to be a domain socket. So `/dev/log`
also needed to be bind mounted into the continer.
4. The daemon expects the keyring to be in `/etc/ceph` so this needed to
be specifically bind mounted to the correct location too.
As this currently stands this is deploying and starting the api on port
5000, so seems to be "working", also gateway.conf does exist in the
pool. I have yet to set up an iscsi device, but will test that next.
The `rbd-target-api` daemon expects the ssl key and cert to be named a
certain name in the contianer. So SSL isn't working yet. However, I do
hav a PR in ceph-iscsi to look in the mon config-key store for them[0].
[0] - ceph/ceph-iscsi#173
Signed-off-by: Matthew Oliver <[email protected]>
This if the first draft of the ceph-iscsi in cephadm.
There are a few gotchas when running `rbd-target-api` in a container:
1. We need both the ceph.conf and iscsi-gateway.cfg, so needed to
ability to pass extra config. This latter is based off the spec, so now
the daemon config func api allows you to return a dict of configs:
{ 'config': '<str>' # will be appended to the ceph.conf
'<conf name>': 'str', # Will be dumped in datadir/<conf name>
...
}
It will be up to cephadm to know to bind mount it to the right location.
The first 'config' isn't used by this patch, but makes it possible for
specs or config funcs to append anything? maybe it's overkill.
2. We need the kernel's configfs in the container so we can configure
LIO. There is a chicken and egg problem, configfs isn't mounted on the
host to bind mount when the container starts. So now a check is added to
the `unit.run` and cleanup in the `unit.poststop` scripts for
daemon_type iscsi.
3. rbd-target-api is python and hardcodes a few things, like logging
through `/dev/log` which happens to be a domain socket. So `/dev/log`
also needed to be bind mounted into the continer.
4. The daemon expects the keyring to be in `/etc/ceph` so this needed to
be specifically bind mounted to the correct location too.
As this currently stands this is deploying and starting the api on port
5000, so seems to be "working", also gateway.conf does exist in the
pool. I have yet to set up an iscsi device, but will test that next.
The `rbd-target-api` daemon expects the ssl key and cert to be named a
certain name in the contianer. So SSL isn't working yet. However, I do
hav a PR in ceph-iscsi to look in the mon config-key store for them[0].
[0] - ceph/ceph-iscsi#173
Signed-off-by: Matthew Oliver <[email protected]>
(cherry picked from commit 4179b96)
This if the first draft of the ceph-iscsi in cephadm.
There are a few gotchas when running `rbd-target-api` in a container:
1. We need both the ceph.conf and iscsi-gateway.cfg, so needed to
ability to pass extra config. This latter is based off the spec, so now
the daemon config func api allows you to return a dict of configs:
{ 'config': '<str>' # will be appended to the ceph.conf
'<conf name>': 'str', # Will be dumped in datadir/<conf name>
...
}
It will be up to cephadm to know to bind mount it to the right location.
The first 'config' isn't used by this patch, but makes it possible for
specs or config funcs to append anything? maybe it's overkill.
2. We need the kernel's configfs in the container so we can configure
LIO. There is a chicken and egg problem, configfs isn't mounted on the
host to bind mount when the container starts. So now a check is added to
the `unit.run` and cleanup in the `unit.poststop` scripts for
daemon_type iscsi.
3. rbd-target-api is python and hardcodes a few things, like logging
through `/dev/log` which happens to be a domain socket. So `/dev/log`
also needed to be bind mounted into the continer.
4. The daemon expects the keyring to be in `/etc/ceph` so this needed to
be specifically bind mounted to the correct location too.
As this currently stands this is deploying and starting the api on port
5000, so seems to be "working", also gateway.conf does exist in the
pool. I have yet to set up an iscsi device, but will test that next.
The `rbd-target-api` daemon expects the ssl key and cert to be named a
certain name in the contianer. So SSL isn't working yet. However, I do
hav a PR in ceph-iscsi to look in the mon config-key store for them[0].
[0] - ceph/ceph-iscsi#173
Signed-off-by: Matthew Oliver <[email protected]>
I'm looking at attempting to add iscsi to cephadm, but frankly having to place the crt and key inside the container makes things a little harder. While working on adding RGW SSL support to cephadm sage et al, suggested we should use the mon config-key store the certs[0][1]. So thought why not fo the same here. This will mean when setting up service in cephadm, an op can either place the certs: ceph config-key put 'iscsi/<client-name>/iscsi-gateway.crt -i <file> ceph config-key put 'iscsi/<client-name>/iscsi-gateway.key -i <file> Or if given the files via cephadm we can place them on their behalf. [0]- ceph/ceph#32951 [1]- ceph/ceph#33287 Signed-off-by: Matthew Oliver <[email protected]>
b678e8a to
3a67e30
Compare
|
I've finally had a chance to test, and with the latest force push it is now getting the SSL and key out of the config-key store. So @jschmid1 you might need to update what your testing in ci. had a few bool checks the wrong way. And the mon_command slightly wrong. So from that point of view the code is working. I mean with the security questions aside. |
|
(I left a comment for addressing the |
|
anything we can do to get this in? |
This if the first draft of the ceph-iscsi in cephadm.
There are a few gotchas when running `rbd-target-api` in a container:
1. We need both the ceph.conf and iscsi-gateway.cfg, so needed to
ability to pass extra config. This latter is based off the spec, so now
the daemon config func api allows you to return a dict of configs:
{ 'config': '<str>' # will be appended to the ceph.conf
'<conf name>': 'str', # Will be dumped in datadir/<conf name>
...
}
It will be up to cephadm to know to bind mount it to the right location.
The first 'config' isn't used by this patch, but makes it possible for
specs or config funcs to append anything? maybe it's overkill.
2. We need the kernel's configfs in the container so we can configure
LIO. There is a chicken and egg problem, configfs isn't mounted on the
host to bind mount when the container starts. So now a check is added to
the `unit.run` and cleanup in the `unit.poststop` scripts for
daemon_type iscsi.
3. rbd-target-api is python and hardcodes a few things, like logging
through `/dev/log` which happens to be a domain socket. So `/dev/log`
also needed to be bind mounted into the continer.
4. The daemon expects the keyring to be in `/etc/ceph` so this needed to
be specifically bind mounted to the correct location too.
As this currently stands this is deploying and starting the api on port
5000, so seems to be "working", also gateway.conf does exist in the
pool. I have yet to set up an iscsi device, but will test that next.
The `rbd-target-api` daemon expects the ssl key and cert to be named a
certain name in the contianer. So SSL isn't working yet. However, I do
hav a PR in ceph-iscsi to look in the mon config-key store for them[0].
[0] - ceph/ceph-iscsi#173
Signed-off-by: Matthew Oliver <[email protected]>
I'm looking at attempting to add iscsi to cephadm, but frankly having
to place the crt and key inside the container makes things a little
harder. While working on adding RGW SSL support to cephadm sage et al,
suggested we should use the mon config-key store the certs[0][1].
So thought why not fo the same here. This will mean when setting up
service in cephadm, an op can either place the certs:
ceph config-key put 'iscsi//iscsi-gateway.crt -i
ceph config-key put 'iscsi//iscsi-gateway.key -i
Or if given the files via cephadm we can place them on their behalf.
[0]- ceph/ceph#32951
[1]- ceph/ceph#33287
Signed-off-by: Matthew Oliver [email protected]