Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

Cpd 101 #102

Merged
merged 3 commits into from
Apr 17, 2017
Merged

Cpd 101 #102

merged 3 commits into from
Apr 17, 2017

Conversation

ashcrow
Copy link
Collaborator

@ashcrow ashcrow commented Mar 2, 2017

For discussion per #101

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 2, 2017

/cc @gbraad

doc/cpd/101.rst Outdated
---------
The likelihood of having a ``Storage`` system that is used only for Commissaire seems
low. More than likely the same instance will be used for other applications as well.
By adding encryption to the keys we mitigate could mitigate access from those with
Copy link
Contributor

Choose a reason for hiding this comment

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

I think "keys we mitigate" is supposed to be "keys we store"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I should have been 'to the keys, we could mitigate'. Will update.

doc/cpd/101.rst Outdated
------
The server(s) would house a GnuPG configuration and keys allowing them to encrypt
and decrypt data. The servers would either need to have the same key across all
instances or each server would need a copy of other services public keys.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give more details about what the configuration might look like?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think there would be any configuration updates. However, the public/private keys for use would need to be imported into the keyring at /etc/commissaire/$PLACEWEDECIDEON

doc/cpd/101.rst Outdated
the key encrypted as long as possible.

The HTTP Server would need to handle decrypting the key back into a base64 encoded
string before handing it back to the authenticated requestor.
Copy link
Contributor

Choose a reason for hiding this comment

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

ClusterExecService, InvestigatorService and WatcherService must also be able to decrypt the keys, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hrm, that's a good point. A few things come immediately to mind. We could:

  • Have the key decrypted at the StorageService level. (Easiest but removes some of the protection since the key may flow over the same backend service)
  • Have the services request the decrypted key from the REST server
  • Have services generate and register a gpg key with the server (this would require a new endpoint but would be doable and probably cleaner)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The more I think about it the more I feel it makes sense for StorageService to do the decryption. We'd need to explicitly note in the documentation that the bus level would need to be trusted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Kombu supports SSL/TLS at the Connection layer for some transports:

SSL compatibility

SSL currently only works with the py-amqp, amqplib, and qpid transports.
For other transports you can use stunnel.

Perhaps we could pass SSL/TLS options for kombu.Connection from a config file?

source

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mbarnes Yeah, I think that would make sense. We will need to add a quick example on how to use stunnel as well but that is pretty trivial.

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 6, 2017

Updated.

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 16, 2017

Updated. I need to re-add the stunnel stuff back to it though.

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 16, 2017

⬆️

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 21, 2017

@mbarnes ⬆️

doc/cpd/101.rst Outdated
string before handing it back to the requesting service.
The StorageService would need to to know when to use Custodia versus the configured
``StorageHandler``(s). It would look at the ``_secrets`` attribute on the instance and,
if set to ``True`` would use the secrets handler.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence was confusing at first since the _secrets attribute isn't defined until a few paragraphs below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair enough. On next update I'll try to clarify.

doc/cpd/101.rst Outdated
The models would match based on their primary keys: ``address``.

The ``Model`` class would also gain a new attribute to denote the model is secret. A secret model would
denote ``_secrets = True``.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of an attribute, I suggest a class hierarchy.

       Model
         |
  +------+------+
  |             |
  |        SecretModel
  |             |
 Host       HostCreds

If nothing else, it would make for clearer documentation in APIs where we expect a secret model as opposed to any type of model.

:param secret_model: A model containing sensitive data
:type secret_model: commissaire.models.SecretModel

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like that. I'll update.

doc/cpd/101.rst Outdated
New HTTP Handler
~~~~~~~~~~~~~~~~
A new handler called ``secrets`` could be added. This would proxy requests back to the
Custodia instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, so if the "secrets" handler is using a Unix socket to proxy to Custodia, does that imply Custodia has to be running on the same machine as commissaire-server? In the example below, it looks like commissaire-storage-service has the Custodia config, and that service may be running on a different machine than commissaire-server.

Would it make sense for commissaire-storage-service to call back to our own /api/v0/secrets endpoint, instead of accessing Custodia directly?

I feel like I'm not seeing a piece of this clearly.

Copy link
Collaborator Author

@ashcrow ashcrow Mar 21, 2017

Choose a reason for hiding this comment

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

commissaire-storage-service would call back to /api/v0/secrets. We'd be proxying the requests back to custodia on the server side.

Copy link
Contributor

@mbarnes mbarnes Mar 21, 2017

Choose a reason for hiding this comment

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

Got'cha. So in that case do we still need the "custodia_api_id" and "custodia_api_key" things in the storage config? It's not clear to me what those are for. Wait, I think I get it now. That's linkage with the Custodia config, right? Didn't look at that part closely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct. Those would be used as the auth into custodia through our endpoint. Since we'd just be proxying access and allowing custodia to handle it's own access we'd need to add the auth changes listed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Admittedly there are a lot of small changes to get this to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

True. I think I understand now how this all fits together, conceptually at least.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's linkage with the Custodia config, right? Didn't look at that part closely.

Yup!

Copy link
Contributor

@mbarnes mbarnes Mar 21, 2017

Choose a reason for hiding this comment

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

One other piece to this is how commissaire-storage-service learns where the /api/v0/secrets endpoint is. Might be nice if commissaire-http could slip this info to it somehow so we can avoid another line item in storage.conf.

(... or bring back the configuration-in-etcd concept from MVP ...)

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 21, 2017

⬆️

doc/cpd/101.rst Outdated
@@ -180,7 +178,7 @@ These are examples and likely will not work without modification.
handler is used. Raises KeyError if no handler is registered
for that type of model.
"""
if model._secret:
if issubclass(model.__class__, models.SecretModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

simpler: if isinstance(model, models.SecretModel):

@mbarnes
Copy link
Contributor

mbarnes commented Mar 21, 2017

Looking good! 👍

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 22, 2017

@mbarnes is there anything else you can think of that needs to be addressed in the CPD?

Of course I'd like to get another eye on it as well before it's ratified /cc @gbraad @portdirect

@mbarnes mbarnes mentioned this pull request Mar 24, 2017
@mbarnes
Copy link
Contributor

mbarnes commented Mar 29, 2017

@mbarnes
Copy link
Contributor

mbarnes commented Mar 29, 2017

@mbarnes
Copy link
Contributor

mbarnes commented Mar 29, 2017

@mbarnes
Copy link
Contributor

mbarnes commented Mar 29, 2017

  • Verify a card for installing Custodia is created

@ashcrow: About that ⬆️ ... now that I'm taking a closer look at Custodia, it's not clear to me whether the responsibility of installing Custodia and configuring it correctly falls on Commissaire or our users. Who will own Custodia's config file and how to you envision this all getting set up?

Should we create a container image for commissaire-http + Custodia, configured the way we want (Unix socket, encrypted-etcd backend, etc)? That might significantly simplify the setup instructions.

@ashcrow
Copy link
Collaborator Author

ashcrow commented Mar 29, 2017

@mbarnes I believe the version we use internally should be installed by us ... either via container, pip, or whatever. Exposing other instances would be up ops folks who want to provide them as extra services.

@ashcrow
Copy link
Collaborator Author

ashcrow commented Apr 4, 2017

Per CPD-1 let's go ahead and vote on this. I proposed it so I obviously 👍

@mbarnes PTAL

@mbarnes
Copy link
Contributor

mbarnes commented Apr 4, 2017

Some details may need clarified or changed as we get into the implementation, but I think the CPD looks good as an initial design document. 👍

@ashcrow
Copy link
Collaborator Author

ashcrow commented Apr 5, 2017

By rule this passes. @mbarnes please merge and update to accepted!

@ashcrow
Copy link
Collaborator Author

ashcrow commented Apr 12, 2017

@mbarnes ⬆️

@ashcrow
Copy link
Collaborator Author

ashcrow commented Apr 17, 2017

I'll go ahead and mark it accepted and merge since @mbarnes 👍'd it

@ashcrow ashcrow merged commit 972affd into projectatomic:master Apr 17, 2017
@mbarnes
Copy link
Contributor

mbarnes commented Jun 7, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants