Skip to content

cephadm: add RGW SSL support - #32951

Merged
sebastian-philipp merged 1 commit into
ceph:masterfrom
matthewoliver:cephadm_rgw_ssl
Apr 17, 2020
Merged

sebastian-philipp merged 1 commit into
ceph:masterfrom
matthewoliver:cephadm_rgw_ssl

Conversation

@matthewoliver

@matthewoliver matthewoliver commented Jan 29, 2020 •

Copy link
Copy Markdown
Contributor

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 -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]

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@sebastian-philipp

Copy link
Copy Markdown
Contributor

jenkins test make check

Comment thread src/cephadm/cephadm Outdated
Comment on lines 984 to 986

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks like as if we don't need the if extra: check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread src/pybind/mgr/cephadm/module.py Resolved
Comment thread src/pybind/mgr/orchestrator.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread src/pybind/mgr/orchestrator.py Outdated
Comment on lines 1276 to 1286

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, 👎 for inventing any defaults here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup good point. I'll remove defaults and just make them None.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

zone_name is not None and realm_name is None should work as well, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@cbodley

cbodley commented Jan 29, 2020

Copy link
Copy Markdown
Contributor

very cool! does this also make it possible to run ssl-only? ie, if you omit rgw_frontend_port but provide a rgw_frontend_ssl_port, do we still bind to port=80?

Comment thread src/cephadm/cephadm Resolved
Comment thread src/cephadm/cephadm Resolved
Comment thread src/cephadm/cephadm Resolved
Comment thread src/cephadm/cephadm Outdated

@mgfritch mgfritch Jan 29, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Suggested change
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 :)

@liewegas

Copy link
Copy Markdown
Member

Two high-level comments:

  1. I don't think we should be putting anything in the daemon's ceph.conf unless it is absolutely necessary. Instead, we should put options in the mon's config database, and (in most cases) apply them to the entire set/zone of rgw daemons. This puts config mostly out of scope for the orchestrator layer.
  2. IMO the SSL cert should be stored on the mon's config-key database. We should teach radosgw how to fetch it from there when it starts up instead of copying it onto each node.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

very cool! does this also make it possible to run ssl-only? ie, if you omit rgw_frontend_port but provide a rgw_frontend_ssl_port, do we still bind to port=80?

I'd have to test, but when we build up the rgw_frontends config if port is None then it wont add it. So assume it wont, ie create:
rgw_frontends = beast ssl_port=443 ssl_certificate=/etc/ceph/rgw.pem

@matthewoliver

Copy link
Copy Markdown
Contributor Author

Two high-level comments:

  1. I don't think we should be putting anything in the daemon's ceph.conf unless it is absolutely necessary. Instead, we should put options in the mon's config database, and (in most cases) apply them to the entire set/zone of rgw daemons. This puts config mostly out of scope for the orchestrator layer.

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.

  1. IMO the SSL cert should be stored on the mon's config-key database. We should teach radosgw how to fetch it from there when it starts up instead of copying it onto each node.

oh interesting to put it in via ceph config ... and then in rgw look for the cert data there. That's kinda cool. How about if RGW sees the ssl_certificate= component of rgw_frontends it looks for a cert on disk, otherwise it'll look for a config option 'rgw_ssl_cert' or something. Which I assume the config class will probe the mon config database for.
Anyway I can go work on a RGW patch for that and have a play.

@liewegas

Copy link
Copy Markdown
Member

Two high-level comments:

  1. I don't think we should be putting anything in the daemon's ceph.conf unless it is absolutely necessary. Instead, we should put options in the mon's config database, and (in most cases) apply them to the entire set/zone of rgw daemons. This puts config mostly out of scope for the orchestrator layer.

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 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!

  1. IMO the SSL cert should be stored on the mon's config-key database. We should teach radosgw how to fetch it from there when it starts up instead of copying it onto each node.

oh interesting to put it in via ceph config ... and then in rgw look for the cert data there. That's kinda cool. How about if RGW sees the ssl_certificate= component of rgw_frontends it looks for a cert on disk, otherwise it'll look for a config option 'rgw_ssl_cert' or something. Which I assume the config class will probe the mon config database for.
Anyway I can go work on a RGW patch for that and have a play.

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!

@matthewoliver

Copy link
Copy Markdown
Contributor Author

Thanks @liewegas for the clarification, and introducing me to ceph config-key, will have a play with that today :)

Also done the rebase.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

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 :)

Comment thread src/cephadm/cephadm Resolved
Comment thread src/cephadm/cephadm Resolved
@matthewoliver

Copy link
Copy Markdown
Contributor Author

missed the space.. fixed now

@cbodley

cbodley commented Jan 30, 2020

Copy link
Copy Markdown
Contributor
  1. IMO the SSL cert should be stored on the mon's config-key database. We should teach radosgw how to fetch it from there when it starts up instead of copying it onto each node.

i don't really have an intuition here, bringing @mdw-at-linuxbox in for feedback

@mdw-at-linuxbox

Copy link
Copy Markdown
Contributor

1/ you need to store the private key for that cert somewhere too.
2/ the key should not be exposed on the wire.
3/ in the overall workflow, the key needs to be generated, then a cert request, then a (potentially long) delay to get the actual cert (from a 3rd party), then ceph can be given the key + cert.
4/ in a large deployment, you might have multiple rgw's with different certs. This might be for something complicated like a multi-zone setup, or something simple such as partitioning load to take better advantage of caching between different uses. If you're storing certificates in some common location, you will want some method of indirection to allow this, and not one global certificate.
also,
5/ there is another overall workflow that has to do with renewing certificates. Clever sites might have existing automation that can push certificates and keys.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

1/ you need to store the private key for that cert somewhere too.
oh yeah, I can plumb that through too.

2/ the key should not be exposed on the wire.
good point. What is your definition of on the wire? is this a reason against using the mon config store? Or do we assume messenger v2 being encrypted is ok here?

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.

3/ in the overall workflow, the key needs to be generated, then a cert request, then a (potentially long) delay to get the actual cert (from a 3rd party), then ceph can be given the key + cert.

I'd have throught this would happen externally from ceph. Ie. we just need to provide ceph the key + cert.
An advantage of using the store is there is a single place to dump the cert and key so will make the renewing process easier.

4/ in a large deployment, you might have multiple rgw's with different certs. This might be for something complicated like a multi-zone setup, or something simple such as partitioning load to take better advantage of caching between different uses. If you're storing certificates in some common location, you will want some method of indirection to allow this, and not one global certificate.
also,

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.
or is there probably a limit to value stored in the config store.

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.

5/ there is another overall workflow that has to do with renewing certificates. Clever sites might have existing automation that can push certificates and keys.

So long as we support the use of files, or these clever sites can just ceph config-key set <key> <cert_data> and be done.

Comment thread src/pybind/mgr/cephadm/module.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@matthewoliver my PR now added default ssl cert/key configuration for the beast frontend via config-key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

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.

@mattbenjamin

Copy link
Copy Markdown
Contributor

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?

@sebastian-philipp

Copy link
Copy Markdown
Contributor

is the mon integration going to be limited to just some bootstrap configurations?

Limiting this to just bootstrapping would make it kind of useless for cephadm's needs.

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?

@mattbenjamin

Copy link
Copy Markdown
Contributor

@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

@sebastian-philipp

Copy link
Copy Markdown
Contributor

@sebastian-philipp but what is the actual scope and intent of cephadm in this?

The goal is to make cephadm enterprise-ready. Day 1 and day 2.

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?

Um, lack of knowledge on my side. I'll have to get back to you on this.

...

@sebastian-philipp

Copy link
Copy Markdown
Contributor

Rebased. Because things have moved under the hood quite a bit in the rebase, will now spend sometime debugging to make sure it's working crosses fingers.

is there any way I can help you?

@liewegas

liewegas commented Apr 2, 2020

Copy link
Copy Markdown
Member

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:

  • modify rook to pull the cert out of config-key if it is not included in the ObjectStore. users for cephadm and rook will put the cert in config-key and be done with it.
  • expand the RGWSpec to include the ssl cert, and have cephadm store it in config-key, and have rook store it in a k8s secret or whatever.

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.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

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.

@matthewoliver

Copy link
Copy Markdown
Contributor Author

OK, cleaned up the extra files stuff. Currently the plan is to build up the frontends with the confing//key/path/for/cert/and/keys if ssl is passed. If you use the json file to pass the cert and key then cephadm will insert them into the config-key.

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 ;)

Comment thread src/cephadm/samples/rgw_ssl.json Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ignore all this for now, will clean it up (or remove this sample) before we merge.

Comment thread src/pybind/mgr/cephadm/module.py Resolved
Comment thread src/pybind/mgr/cephadm/module.py Resolved

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ops, forgot to put these in variables for RGWSpec. Will be fixed in the next version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

make check is currently failing on this ...

Comment thread src/pybind/mgr/cephadm/module.py Outdated
Comment on lines 2767 to 2784

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you know, if we need who as well here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I'm aware, config needs a who. But a config-key doesn't, is just key value pairs.

Comment thread src/cephadm/samples/rgw_ssl.json Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

doc/cephadm and mention it in the official docs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

make check is currently failing on this ...

@mgfritch

mgfritch commented Apr 8, 2020

Copy link
Copy Markdown
Contributor

@matthewoliver needs rebase

@matthewoliver

Copy link
Copy Markdown
Contributor Author

Rebased.

When I seem to deploy RGW with SSL I am now down to 3 "issues":

  1. now that we default to port 80 and 443. RGW fails to bind to this address, as it doesn't have permission to bind to priv ports. Do we drop user perms before we setup (bind) the frontend in RGW or is this more a container level thing? (I guess I could try and run rgw as root in the container and see what happens).

  2. When I specify the SSL cert and key in a json, the config-key set mon-command sends the file contents as a string value in the json. Ofter deploy the key value is ''. So need to figure out why? is there a limit to what we send. If I manaully use ceph config-key set <key> -i <cert> it's fine.

  3. When I do deploy, and the certs are there, because I've added them manually and just use: ceph orch daemon add rgw default default <host> (on a non priv port). The daemon is then removed as an orphan daemon. So need to figure out why the orch doesn't like it. Maybe the service name or ID needs a tweak?

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.

@sebastian-philipp

Copy link
Copy Markdown
Contributor

Rebased.

When I seem to deploy RGW with SSL I am now down to 3 "issues":

  1. now that we default to port 80 and 443. RGW fails to bind to this address, as it doesn't have permission to bind to priv ports. Do we drop user perms before we setup (bind) the frontend in RGW or is this more a container level thing? (I guess I could try and run rgw as root in the container and see what happens).

I don't know in detail how podman as root with --net=host and rgw as non-root within the container interacts with each other.

  1. When I specify the SSL cert and key in a json, the config-key set mon-command sends the file contents as a string value in the json. Ofter deploy the key value is ''. So need to figure out why? is there a limit to what we send. If I manaully use ceph config-key set <key> -i <cert> it's fine.

the mon command and ceph config-key set is basically the same thing. Maybe you could assert that the cert is non-empty?

  1. When I do deploy, and the certs are there, because I've added them manually and just use: ceph orch daemon add rgw default default <host> (on a non priv port). The daemon is then removed as an orphan daemon. So need to figure out why the orch doesn't like it. Maybe the service name or ID needs a tweak?

Related to https://tracker.ceph.com/issues/44934 ?

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.

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)

@matthewoliver

Copy link
Copy Markdown
Contributor Author

Rebased.
When I seem to deploy RGW with SSL I am now down to 3 "issues":

  1. now that we default to port 80 and 443. RGW fails to bind to this address, as it doesn't have permission to bind to priv ports. Do we drop user perms before we setup (bind) the frontend in RGW or is this more a container level thing? (I guess I could try and run rgw as root in the container and see what happens).

I don't know in detail how podman as root with --net=host and rgw as non-root within the container interacts with each other.

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.

  1. When I specify the SSL cert and key in a json, the config-key set mon-command sends the file contents as a string value in the json. Ofter deploy the key value is ''. So need to figure out why? is there a limit to what we send. If I manaully use ceph config-key set <key> -i <cert> it's fine.

the mon command and ceph config-key set is basically the same thing. Maybe you could assert that the cert is non-empty?

yeah, when I print it out, it's defintely non empty. It's the cert as a string with a bunch of '\n'.

  1. When I do deploy, and the certs are there, because I've added them manually and just use: ceph orch daemon add rgw default default <host> (on a non priv port). The daemon is then removed as an orphan daemon. So need to figure out why the orch doesn't like it. Maybe the service name or ID needs a tweak?

Related to https://tracker.ceph.com/issues/44934 ?

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 :)

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.

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)

Thanks will continue pushing this. Will hopefully get something new up soon.

Comment on lines 514 to 515

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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]>
@matthewoliver

Copy link
Copy Markdown
Contributor Author

OK this new version has:

  • working cert/ssl via json working
  • fixed another can't find cert/key error because we needed more maps on mon to execute commands
  • Added the spec to the spec cache so it wont get cleaned up as an orphan daemon.

So all working (well minus the bind on priv-port) which may or maynot be just my env.

@sebastian-philipp
sebastian-philipp merged commit fe91dfa into ceph:master Apr 17, 2020
matthewoliver added a commit to matthewoliver/ceph-iscsi that referenced this pull request Apr 20, 2020
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]>
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.

9 participants