Repository navigation
cephadm: add RGW SSL support - #32951
Conversation
|
jenkins test make check |
There was a problem hiding this comment.
this looks like as if we don't need the if extra: check?
There was a problem hiding this comment.
Yeah, it's not required, happy to remove it. I think I'm just hardwired to give a shortcut because I'm too used to dealing in WSGI frameforks where I want to minimalise needless computation. I'll remove it.
There was a problem hiding this comment.
My experience is, the orchestrator.py is the wrong place to invent any defaults. Instead if we need defaults, we should do them in the cephadm/module.py module.
There was a problem hiding this comment.
OK, fair enough. However, line 1232's else 1 never fires, and we have some defaulting going on. And then I tried to use -i in my vstart it would fail with a count being null. So just moved to it up here. Placement object actually gets recreated in the RGW spec after this anyway... so maybe more clean up is in order.
There was a problem hiding this comment.
Again, 👎 for inventing any defaults here.
There was a problem hiding this comment.
Yup good point. I'll remove defaults and just make them None.
There was a problem hiding this comment.
Last week, I stumbled across this, too. Especially as it is non-obvious that you should probably call this with default default. 👍 from my side here, except that we'Re now creating an imbalance between add and rm, as rm still requires them.
What about just marking realm as req=false?
There was a problem hiding this comment.
but then your still sending in one 'default' and we're suppose to be fully defining the RGW in json. So it's redundant. I agree the imbalance between add and update or 'rm', did make me question this. But then figured if only add supports inbuf or (-i) then that's why req=false is required.
Of course we could change the useage to:
usage = """
Usage:
ceph orchestrator rgw add <zone_name> -i <json_file>
ceph orchestrator rgw add <realm_name> <zone_name>
"""
But that just doesn't look right.
There was a problem hiding this comment.
zone_name is not None and realm_name is None should work as well, right?
There was a problem hiding this comment.
Sure, if variable: covers both None and '' both of which are illegal in this case. But sure, happy to change this if we only want to check for not None.
|
very cool! does this also make it possible to run ssl-only? ie, if you omit |
There was a problem hiding this comment.
error: Incompatible types in assignment (expression has type "str", variable has type "List[str]")
Maybe deal with the line endings while doing the file write?
| data = "\n".join(data) | |
| # There are extra files to place in the data dir | |
| for filename, data in extra.items(): | |
| host_filename = os.path.basename(filename) | |
| host_filename = os.path.join(data_dir, 'extra', host_filename) | |
| makedirs(os.path.dirname(host_filename), uid, gid, 0o755) | |
| with open(host_filename, 'w') as f: | |
| os.fchown(f.fileno(), uid, gid) | |
| os.fchmod(f.fileno(), 0o600) | |
| for line in data: | |
| line = line.strip() + '\n' | |
| f.write(line) | |
| mounts[host_filename] = filename |
There was a problem hiding this comment.
From what I've read, Python is smart enough to use the correct line endings so we only need '\n'. And I assumed if the file has line endings we want them retained (think things like authorised_hosts etc). If there wasn't suppose to be any line endings, then we'd either have 1 string in the list or just a string (which is what the isinstance(.., (list, tuple)) is catching.
There was a problem hiding this comment.
Aslo, ok so we're doing tests in string typing, so can't just reuse a variable and change it's type, good to know, I can fix these :)
|
Two high-level comments:
|
I'd have to test, but when we build up the |
I thought I was adding everything to the mon config database. I don't touch the ceph.conf added to the container. Though I'm probably just misunderstanding what your saying.
oh interesting to put it in via |
Oh I see, I didn't look at the code that closely. I think the main point is that everything that's in that json file (except teh crt) should go into the mon config db (ceph config set ...). AFAICS there's no reason for the orchestrator to have any understanding or plumbing for anything about rgw except which host it will go on and what it will be named. I think there is a lot of cleanup we can/should do in the current orchestrator.py spec!
For the cert, it should go on the 'config-key' storage area (ceph config-key dump, ceph config-key get, etc.). I think the next step is a patch to RGW that teaches it how to load the cert from there (instead of from a file). That would be a great next step, I think! |
e3fe3ce to
5b94c7e
Compare
|
Thanks @liewegas for the clarification, and introducing me to Also done the rebase. |
|
Lol, the batch commit of the github PR api I guess isn't adding the signed-off-by's, probably righly so. So will fix this when I squash all the patches together :) |
5b94c7e to
c4fea87
Compare
c4fea87 to
60bebd2
Compare
|
missed the space.. fixed now |
i don't really have an intuition here, bringing @mdw-at-linuxbox in for feedback |
|
1/ you need to store the private key for that cert somewhere too. |
Or is it sending the key through stdin through the ceph cli > orchestrator/daemon > cephadm.. though the last hop is via SSH isn't it, so that's encrypted. If it's just the cli > daemon part of the leg, then don't we have the same problem with using the mon config store? or are we encrypting the cli traffic too? or at least the json we send. I guess I could just go check this.
I'd have throught this would happen externally from ceph. Ie. we just need to provide ceph the key + cert.
For multizone envs or even just giving RGW servers different certs, would it make more sense to use the config store, as apposed to the config-key store, when you can define the who. Thereby providing a 'who'. Ie globally client, a realm or zone. I'm assuming here, that the config-key store doesn't have this granularity. We could do some playing with key names having realm or zone prefixed or some such, but that's starting to sound a little too hacky.
So long as we support the use of files, or these clever sites can just |
There was a problem hiding this comment.
While testing this, I don't see RGW picking up this rgw_frontends config option. Is there something I'm missing in setting this up? I assumed the ConfigProxy would search the mon config store, is this not the case?
I guess I could debug to find out.
There was a problem hiding this comment.
Yeah, I think this is currently the major problem in the patch. As far as I can see, RGW doesn't look for the rgw_frontends value in the mon config store. I'd just assumed this was built into the the ConfigProxy.
Should we change @yehudasa 's #33287 to make the get keys from config-key available for other RGW values. And store the rgw_frontends there too (I guess check if it's missing in ceph.conf and before defaulting to the default frontend configuration)?
ATM the only way to get this rgw_frontends working as it is, with out another RGW change is to write it into the ceph.conf in the container.. which I'd really rather not do.
Thoughts?
There was a problem hiding this comment.
But if that is correct (not search config store) then the rgw_realm and rgw_zone is also working above.
I wonder how hard it would be to add mon config support to ConfigProxy.. though I guess continual calls to the network could be problematic. Or does this actaully work and I've just missed something obvious?
There was a problem hiding this comment.
@matthewoliver there is a problem with rgw order of initialization that rgw_frontends happens before it even connects to the cluster (it seems like it). I'm not sure that changing it won't break something else. In any case I'm working on adding a default frontends configurable that will allow using the config-key the way @liewegas suggested.
There was a problem hiding this comment.
@matthewoliver my PR now added default ssl cert/key configuration for the beast frontend via config-key.
There was a problem hiding this comment.
Awesome! I'll rebase this on your PR on my dev machine and rework this one based on it. That way we can give them both a test.
60bebd2 to
b45feb1
Compare
|
Added the ability to define an SSL key file as well. Still not sure if this is the best way to pass the key file. |
|
I'd add to what @mdw-at-linuxbox wrote that the x.509 naming even interacts with DNS when we are talking about a real deployment--is the mon integration going to be limited to just some bootstrap configurations? I'm not sure it's going to be ideal for the stage where deploying a new application may bring new DNS naming and SSL cert material? |
Limiting this to just bootstrapping would make it kind of useless for cephadm's needs.
|
|
@sebastian-philipp but what is the actual scope and intent of cephadm in this? is it in fact sensible to have new secrets moving into the ceph mon or ceph config to match DNS common names being served by RGW? today, we have some one-off override style params in the Ceph conf for setting up a global DNS name or keystone server or whatever, but the actual dynamic setup (e.g., zones, as Marcus mentioned) are all represented as objects in RGW's metadata |
The goal is to make cephadm enterprise-ready. Day 1 and day 2.
Um, lack of knowledge on my side. I'll have to get back to you on this.
|
is there any way I can help you? |
|
I still think this is making things overly complicated. Right now, you can use SSL without any orch changes just by putting the cert in config-key where radosgw will automatically find it. The only downside to this is that the behavior isn't consistent with rook. I think we have a couple options:
This PR adds a bunch of extra code to copy the cert into the container, but I don't think this actually buys us anything. I have a slight preference is probably the first option above, but I'm fuzzy on what the "normal" rook CR looks like... is it normally the k8s user's job to put the cert in a secret before setting the CR, for instance? And what happens in k8s when you have a service in front of rgw... is rgw itself running unencrypted, with the SSL terminated by the service/load balancer/whatever? This might also intersect with the idea of an orch abstractions for haproxy that generalizes load balancing. In that case, there are presumably two ways to set this all up: have SSL terminate with haproxy, so that the cert goes there, or SSL terminate with radosgw itself. Both should probably(?) be allowed, and in the former case the cert wouldn't go into the radosgw config-key location. |
|
Thanks everyone. The extra parts predate rgw getting stuff from the key store. Will start reworking it to suite the new state of the world. |
0b0c3ab to
3b8581a
Compare
|
OK, cleaned up the extra files stuff. Currently the plan is to build up the frontends with the This way I hope we can do both. Just pass ssl, or optionally also pass the key and cert. At the moment, as the code currently stands, you can pass in the key/cert and ssl=False and ssl wont be enabled. But I think it probably makes more sense for the passing the key/certs in should override ssl to true. I haven't tested this code. Pushing it up here so I can pull it down on my dev server, so testing will start soon. I suspect a few more updates are coming ;) |
There was a problem hiding this comment.
ignore all this for now, will clean it up (or remove this sample) before we merge.
3b8581a to
3ad5d80
Compare
There was a problem hiding this comment.
ops, forgot to put these in variables for RGWSpec. Will be fixed in the next version
There was a problem hiding this comment.
make check is currently failing on this ...
There was a problem hiding this comment.
Do you know, if we need who as well here?
There was a problem hiding this comment.
As far as I'm aware, config needs a who. But a config-key doesn't, is just key value pairs.
There was a problem hiding this comment.
The samples in this dir are typically used with bin/cephadm --config-json <sample>.json, where this one appears to relate to mgr/cephadm?
should we move it to mgr/orchestrator/samples or mgr/cehpadm/samples ?
There was a problem hiding this comment.
doc/cephadm and mention it in the official docs?
There was a problem hiding this comment.
make check is currently failing on this ...
3ad5d80 to
2aa4191
Compare
|
@matthewoliver needs rebase |
2aa4191 to
a7e7593
Compare
|
Rebased. When I seem to deploy RGW with SSL I am now down to 3 "issues":
Anyway, getting very close. We could just remove the SSL cert/key from spec and json, and expect a user to push a cert/key into the config-key store. |
I don't know in detail how podman as root with
the mon command and
Related to https://tracker.ceph.com/issues/44934 ?
Which might actually be a valid way for now. We just need some documentation for it somewhere. (and we need to document this anyway for non-cephadm clusters) |
No idea, step 1 I'll run rgw as root just to confirm it isn't a different issue. Might add the ability to supply the port through the commandline, as it'll make it easier to test, at least temp.
yeah, when I print it out, it's defintely non empty. It's the cert as a string with a bunch of '\n'.
YES!! This looks very similar. So I wont focus too hard on solving this as it seems you might have already. Though at least I can test your patch :)
Thanks will continue pushing this. Will hopefully get something new up soon. |
There was a problem hiding this comment.
| rgw_frontend_ssl_certificate=None, # type Optional[List[str]] | |
| rgw_frontend_ssl_key=None, # type: Optional[List[str]] | |
| rgw_frontend_ssl_certificate=None, # type Optional[List[str]] | |
| rgw_frontend_ssl_key=None, # type: Optional[List[str]] |
ceph/deployment/service_spec.py:514:52: E261 at least two spaces before inline comment
ceph/deployment/service_spec.py:515:44: E261 at least two spaces before inline comment
This patch adds SSL support to RGW when using cephadm. If an SSL certificate is provided, inside the json supplied with: cpeh orchestrator rgw create -i rgw.json Then the SSL cert and/or key will be added to pushed into the mon config-key database using the key `rgw/cert/<rgw_realm>/<rgw_zone>.[crt|key]`. Which will then be referenced in the config: rgw_frontends = beast port=80 ssl_port=443 ssl_certificate=config://rgw/cert/<rgw_realm>/<rgw_zone>.crt And if an ssl key is also supplied this becomes something like: rgw_frontends = beast port=80 ssl_port=443 ssl_certificate=config://rgw/cert/<rgw_realm>/<rgw_zone>.crt ssl_key=config://rgw/cert/<rgw_realm>/<rgw_zone>.key Of course you could also just upload the cert and key yourself to config-key location, and ssl will be enabled as well. But this patch let's you either supply them via `-i` or as a manual upload step. Co-Authored-By: Michael Fritch <[email protected]> Co-Authored-By: Sebastian Wagner <[email protected]> Signed-off-by: Matthew Oliver <[email protected]>
a7e7593 to
8204b1d
Compare
|
OK this new version has:
So all working (well minus the bind on priv-port) which may or maynot be just my env. |
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]>
This patch adds SSL support to RGW when using cephadm.
If an SSL certificate is provided, inside the json supplied with:
cpeh orchestrator rgw create -i rgw.json
Then the SSL cert and/or key will be added to pushed into the mon config-key database
using the key
rgw/cert/<rgw_realm>/<rgw_zone>.[crt|key].Which will then be referenced in the config:
rgw_frontends = beast port=80 ssl_port=443 ssl_certificate=config://rgw/cert/<rgw_realm>/<rgw_zone>.crt
And if an ssl key is also supplied this becomes something like:
rgw_frontends = beast port=80 ssl_port=443 ssl_certificate=config://rgw/cert/<rgw_realm>/<rgw_zone>.crt ssl_key=config://rgw/cert/<rgw_realm>/<rgw_zone>.crt
Of course you could also just upload the cert and key yourself to
config-key location, and ssl will be enabled as well. But this patch
let's you either supply them via
-ior as a manual upload step.Co-Authored-By: Michael Fritch [email protected]
Co-Authored-By: Sebastian Wagner [email protected]
Signed-off-by: Matthew Oliver [email protected]
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins 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