{"id":24698581,"url":"https://github.com/faradayio/add-vault-tokens","last_synced_at":"2026-05-17T00:05:50.467Z","repository":{"id":62552993,"uuid":"44973937","full_name":"faradayio/add-vault-tokens","owner":"faradayio","description":"Given a docker-compose.yml file and master token for vault, generate individual, restricted tokens for each app in the docker-compose.yml file.","archived":false,"fork":false,"pushed_at":"2016-04-21T21:03:02.000Z","size":18,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-02T17:55:41.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faradayio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T14:31:51.000Z","updated_at":"2020-09-10T18:53:12.000Z","dependencies_parsed_at":"2022-11-03T04:15:27.157Z","dependency_job_id":null,"html_url":"https://github.com/faradayio/add-vault-tokens","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/faradayio/add-vault-tokens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Fadd-vault-tokens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Fadd-vault-tokens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Fadd-vault-tokens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Fadd-vault-tokens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faradayio","download_url":"https://codeload.github.com/faradayio/add-vault-tokens/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Fadd-vault-tokens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004577,"owners_count":26083735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-27T04:29:22.849Z","updated_at":"2025-10-11T09:04:31.785Z","avatar_url":"https://github.com/faradayio.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `add-vault-tokens`\n\nThis is a short script for use with [vault](https://vaultproject.io/) and\n[docker-compose](https://docs.docker.com/compose/).  Given a\n`docker-compose.yml` file and a `VAULT_MASTER_TOKEN` as input, this script\nwill generate a new, limited vault token for each application described in\nthe `docker-compose.yml` file.\n\nYou can install this as:\n\n```sh\ngem install add-vault-tokens\n```\n\n## Usage\n\nAssume you have a `docker-compose.yml` containing:\n\n```yml\napp:\n  image: \"example/app\"\n\nservice:\n  image: \"example/service\"\n```\n\nFirst, you need to create a security policy `master-token.hcl` for the\nmaster token:\n\n```hcl\n# Mandatory for all policies.\npath \"auth/token/lookup-self\" {\n  policy = \"read\"\n}\n\n# Allow listing all available policies, so we can decide which child tokens\n# to generate.\npath \"sys/policy\" {\n  policy = \"sudo\"\n}\n\n# Allow creation of child tokens.\npath \"auth/token/create\" {\n  policy = \"write\"\n}\n\n# Allow renewal of this token.\n#\n# SECURITY - HACK - We can't just allow renewal via `renew-self` in 0.3, so\n# allow renewal of _any_ token as the next best substitute.\npath \"auth/token/renew/*\" {\n  policy = \"sudo\"\n}\n```\n\nThis can be loaded using:\n\n```sh\nvault policy-write master-token master-token.hcl\n```\n\nThen you need to define two new policies, `app` and `service`, specifying\nwhich secrets can be accessed by each container.  Once this is done, you\ncan create your `VAULT_MASTER_TOKEN` for use with `add-vault-tokens`:\n\n```sh\nvault token-create -policy=master-token -policy=app -policy=service\n```\n\nThen you run `add-vault-tokens` as follows:\n\n```\n# The URL of your vault server.\nexport VAULT_ADDR=https://...\n\n# The master token you just generated.\nexport VAULT_MASTER_TOKEN=...\n\n# Generate tokens\nadd-vault-tokens docker-compose.yml\n```\n\nThis will update `docker-compose.yml` to include new environment variables:\n\n```yml\napp:\n  image: \"example/app\"\n  environment:\n    VAULT_ADDR=\"https://...\"\n    # A new token with policy \"app\":\n    VAULT_TOKEN=\"...\"\n\nservice:\n  image: \"example/service\"\n  environment:\n    VAULT_ADDR=\"https://...\"\n    # A new token with policy \"service\":\n    VAULT_TOKEN=\"...\"\n```\n\nIf a `VAULT_ENV` environment variable is present, it will also be added to\nthe `docker-compose.yml` file, and the policy names will be prefixed by\n`$VAULT_ENV-`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/faradayio/add-vault-tokens.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaradayio%2Fadd-vault-tokens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaradayio%2Fadd-vault-tokens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaradayio%2Fadd-vault-tokens/lists"}