Hi Trevor,
> I'm aware that this isn't the normal or apparently even intended usage.
You'd be surprised at how often things that "weren't intended usage"
have turned into officially-supported enhancements/features :-)
> I'm
> proposing that a front-end process gather the unseal keys and then use them
> to a) unseal the vault and then b) generate a root token, which it will use
> for any operation that handles secrets no single person is allowed to
> access. The root token is ephemeral in the sense that the one generated at
> init time is immediately revoked, and the subsequent ones are only held in
> memory by the front-end process. Is there a reason this wouldn't work?
This would work, but just keep in mind that anyone that manages to
gain access/control over this process can do _anything_.
> Does
> generating a new root token automatically invalidate the previous one, or
> would it need to be explicitly revoked?
The latter.
> If the latter, perhaps the token
> accessor could be stored so that the process could revoke the previous
> (inaccessible) root token before creating a new one.
Yep. Keep in mind that root tokens never expire. Rather than holding
it in memory, you may want to use it to create a token with a policy
that has full access to *, but has an expiration. Then immediately
revoke the root token and use the new one instead. That way there
isn't a valid token sitting around that has no expiration if the token
isn't properly revoked (e.g. due to a crash).
> It sounds like you're recommending using the root token only to grant
> subsets of administrative access to various users (analogous to a Unix
> system where root is used to provide sudo access to administrators at
> install time and then disabled). The problem is that we have secrets that no
> single user may be allowed to access. We're looking for a way to have a
> privileged process, which gains full access to the Vault using a shared
> secret (ideally the unseal shared secret), perform the secret handling. In
> other words, we'd like to have custom policy logic in the same security
> domain as the vault, since I don't think Vault can/should anticipate every
> policy need. If a plug-in facility existed, that would also solve the
> problem.
Plugins are on our long term roadmap. We have a plugin system for
other HC products (notably Terraform) but we need to have a more
secure facility for plugins before we support them in Vault. I'm going
to email you separately about the other part of this...
> That's exactly what we'd do except for the part about "allow administrators
> to gain access to the full system", which can't be allowed to happen.
> Partitioning the Vault across different administrators doesn't help -- some
> secrets need to be accessible only by a program and never by a person.
Yep, that totally makes sense.
>> Transit has a helper feature to generate high-quality AES keys that
>> are wrapped by a transit key, so you can distribute encrypted
>> encryption keys to your instances but control at any given time what
>> machines are allowed to decrypt those keys into memory.
>
>
> You're referring to "/transit/datakey"? That seems like a potentially useful
> way to generate our keys.
Yep. You can do exactly what datakey does by reading from your crypto
source and sending those bytes through transit -- it's purely a helper
function.
> I don't understand the purpose of encrypting them
> though, if they're already exchanged over an encryption channel.
The idea is that you can distribute the datakey in the open (for
instance, via config management, or baked into images), then give the
correct services the ability to perform the decryption. It's nothing
magic -- really, just a helper!
> Cool, that does seem like it would save us a step. However, I think we still
> need a trusted service because the token we need to create for the worker
> service must have access to parts of the vault that the ops person
> authorizing the service can't access.
Sure -- but, if the trusted service is sending that information to
someone/something else over an insecure channel, but itself doesn't
need to actually see the data inside, it can do this without the data
ever being exposed in its memory.
> In other words, since a token can't be
> used to generate a token with more privilege
It can! in one specific way: token roles. See
https://www.vaultproject.io/docs/auth/token.html -- among other
things, this is a facility that lets trusted services (or users)
create tokens with other sets of permissions than a subset of its own.
It's not dissimilar to a trusted service/user configuring any other
authentication backend in Vault and setting the policies that should
be granted on generated tokens, but does not require outside
authentication mechanisms.
Best,
Jeff