Repository navigation
Description
Motivation
There are so many credentials flowing through a Concourse server at the moment that it's keeping me up at night. Some of this risk can be mitigated by fetching the secrets as late as possible and using pipeline templates to insert them into the pipeline. This at least means that you'll never have the pipeline secrets stored on local workstations.
This isn't good enough.
Credentials are still stored in the Concourse database, aren't internally rotated, and do not have any audit trail as to which jobs and builds used them. Let's fix these things.
Goals
- Build credentials are never stored on a disk (apart from in Vault where they are stored encrypted).
- Build credentials are never stored locally when setting the pipeline using
fly. - An audit trail of which build used a secret and when it used it should be visible.
Proposal
I don't want to have to build a secret management system. This means that we're looking to use one of the existing ones. There are a few to choose from in this regard but I'd like to go forward by using Vault. Vault seems to strike the right balance of confidence in implementation, good technical decisions, and generically usable. I'm not ruling out the ability to use a different secret store in the future. In fact, a good implementation of this proposal would allow pluggable secret stores with minimal effort.
So, what would this look like?
resources:
- name: s3-file
type: s3
source:
access_key_id: {{!vault.s3-file.access_key_id}}
secret_access_key: {{!vault.s3-file.secret_access_key}}Here we have a snippet of pipeline configuration. Everything looks normal except the secrets on the last 2 lines. This would be a new syntactic convention that the regular templating would ignore and pass directly up to the server. When the server needed to do something that required a realized value of one of these references it would fetch it as late as possible from the server and then handle revoking it once it isn't required anymore. This means that (assuming Vault is set up correctly) each check run and each build would get a single use credential that would become invalid immediately. This is rad. 💯
The syntax shown above is not finalized but needs to have a few components:
vaultrefers to the name of the secret store from which the credential should be fetched. This would allow multiple stores per Concourse server as long as they were all named uniquely. A secret store should probably belong to a team rather than being global.s3-filerefers to the name of the secret inside Vault.access_key_idandsecret_access_keyrefer to the attributes on the secret.
Open Questions
- What if the server goes down in the middle of using one of these secrets. Who revokes it?
- How does Concourse authenticate with the secret store? Does this just move the problem?
Risks
- Yet another thing to deploy next to Concourse in order to use the feature. This moves away from secure by default. This could be partially mitigated by making it easy for people to get started with Vault. (BOSH release, adding something to the monolithic binaries)
Activity
concourse-bot commentedon Feb 17, 2016
Hi there!
We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.
The current status is as follows:
This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.
cppforlife commentedon Mar 1, 2016
one thing to think about is pipeline scoped creds e.g. two pipelines with same config but different creds. (same problem exists for similar style of creds in bosh where each deployment may need different scope of creds).
zachgersh commentedon Apr 11, 2016
Hey @xoebus I've been thinking about this question:
Why doesn't fly handle unsealing / sealing the secret store? Each ATC could also be provided with a read-only token to the secret store. The secret store could be resealed and the token could be set to expire after a reasonable time period (don't know whether the ATC handles these things). Even though you've "moved the problem" you still have made the pipelines more secure by default.
robdimsdale commentedon Apr 11, 2016
@zachgersh if the ATC can't renew its token automatically it could potentially be a poor user experience: "my builds all stopped working after a month". If it can renew its token, how much more secure is it? I think I agree with you that it's probably more secure, but it doesn't feel like the final answer in security to me.
eddiewebb commentedon Jun 15, 2016
thanks for starting this conversation! I love the potential that concourse brings, but it's not viable in our environment until we address the encryption and management of secrets.
@cppforlife - agree on need for pipeline scoped credentials. Seems plausible to align to vaults tree concept.
@xoebus - is the revocation risk not addressable with reasonable lease windows in vault? I would prefer to trust a lease to destroy cred than a final type task in pipeline.
holstvoogd commentedon Jun 21, 2016
I have been thinking about how this could be set up with the App ID auth backend. I would say each worker should have an unique User ID and each Pipeline should have an unique App ID. Builds get access to secrets based on their App ID and User ID, so they would be scope-able per pipeline and it ensures only known workers are used.
This all would require some manual configuration whenever you add a new pipeline and/or worker. But I guess that is kind of the point of ensuring it is secure: all secrets are managed out of band in vault as well as the access to it.
I've considered some setups where ATC manages App & User IDs for you, but this just seems to break the security model of vault and it becomes very complicated fast ;-)
eddiewebb commentedon Jun 27, 2016
ANyone know how Stark & Wayne's planned summit topic relates?
https://cfsummit2016.sched.org/event/6Zld/air-marshal-no-more-secrets-in-your-manifests-michael-brodhead-stark-wayne
CC: @mkb
xoebus commentedon Jun 27, 2016
It's an interesting, pragmatic, and novel solution but doesn't solve the core problem of the credentials being stored in plain text in the system.
eddiewebb commentedon Jun 27, 2016
Yeah, i agree @xoebus,
I reviewed the video with my team today, might be suitable for some use cases, but not the enterprise ready solution that moves away from assuming such frequent human access over CLI.
We'd like a system (or user) to configure the pipeline independent of cipher values, which should be decrypted at time of use, not time of configuration. This is important to allow key rotation and the like.
So any solution that depends on fly interaction to replace values in manifest is not viable.
freelock commentedon Jun 27, 2016
I've come up with a similar solution -- I have a bot in a Matrix chat room that listens for git commits, and when it sees them, it uses fly to update the pipeline to the latest version. The bot has access to the secrets, regular users don't. So this allows our regular users that the bot authorizes to update the pipeline without having access to the secrets.
I'm still interested in how secrets may be stored in the ATC, though, especially as we add clients that may have more governance issues to address than we currently have, and might need to have different sets of secrets for different clients/pipelines.
eddiewebb commentedon Jul 8, 2016
The use of variables is one area that has pretty wide impact. Validation in fly cli for instance doesn't like {{!secret}} and using {{secret}} requires vars provided at config time.
So do we want to invade fly and other points to tolerate a new format, or find something that flies under the radar of yaml validation, or more simply use a hack of forcing quotes of an alternate format
Playing a bit all components support that pattern without validation or configuration errors.
That also lets the altered manifest go unnoticed by all existing systems, and would let us focus enhancements in ATC as the place to trade out properties for actual values (I think -- ATC is aware of pipeline config, assigns workers, and could grant and revoke secrets based on lifecycle of workers.).
I'm still learning/exploring concourse architecture, would love feedback on those thoughts.
137 remaining items
vito commentedon Jun 26, 2017
Slight change from before: we went ahead and just made the auth fully generic. So you specify
--vault-auth-backendand--vault-auth-param.For example, to use TLS auth, you'd just say
--vault-auth-backend cert(or whatever you named yourcertauth backend mount) and specify a client cert/key. To configureapproleyou'd do something like--vault-auth-backend approle --vault-auth-param role_id=db02de05-fa39-4855-059b-67221c5c2f63 --vault-auth-param secret_id=6a174c20-f6de-a53c-74d2-6018fcceff64.We also now test cert, approle, and direct token configurations, and also test that they're renewed by the ATC automatically (using a periodic token for direct token configuration).
Next step is to try dogfooding again now that we've got the auth flow fleshed out.
patch in variables when they're needed
bump topgun
bump atc
bump atc topgun
vito commentedon Jun 27, 2017
I've converted all our pipelines over to Vault, and all is going well so far. I wrote a little tool to make the migration easier.
vito commentedon Jun 28, 2017
Looks good so far; calling this done as of now! The remaining bits of work will be modeled as separate issues.
rkoster commentedon Jul 6, 2017
@vito what is the timeline for credhub support?
defer custom resource type interpolation
bump atc
SleeperSmith commentedon Aug 6, 2019
Hi Guys. Tinkering around with Concourse.
I am running concourse workers on ECS and ECS Task Role doesn't seem to be working. From concourse/docker-image-resource#109 it seems that the preference is to explicitly define the credential is it?
I just find it odd the worker can access the ec2 task role while not the ecs task role.