-
Notifications
You must be signed in to change notification settings - Fork 0
RE-implemented starlord + vault #649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8115b6e
8d6e685
9bbc130
084f934
ada2d63
2a90780
fa6fdbd
9163d32
daf8b10
754973d
53f3a4c
f757a01
7632b90
d759c1c
50ccb43
fe44f97
89f0b2f
ee103bd
4a943d8
6db539a
ee564dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: starlord | ||
|
|
||
| container_image: "{{ registry_host }}/runnable/{{ name }}" | ||
| container_tag: "{{ git_branch }}" | ||
| inject_ca: false | ||
| repo: [email protected]:CodeNow/{{ name }}.git | ||
| node_version: "6.10.2" | ||
|
|
||
| container_envs: | ||
| - name: NODE_ENV | ||
| value: "{{ node_env }}" | ||
| - name: VAULT_ENDPOINT | ||
| value: "http://{{ user_vault_host_address }}:{{ user_vault_port }}" | ||
| - name: VAULT_TOKEN | ||
| value: "{{starlord_vault_token}}" | ||
| - name: RABBITMQ_HOSTNAME | ||
| value: "{{ rabbit_host_address }}" | ||
| - name: RABBITMQ_PASSWORD | ||
| value: "{{ rabbit_password }}" | ||
| - name: RABBITMQ_PORT | ||
| value: "{{ rabbit_port }}" | ||
| - name: RABBITMQ_USERNAME | ||
| value: "{{ rabbit_username }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: user-vault | ||
|
|
||
| container_image: vault | ||
| container_tag: 0.7.0 | ||
| hosted_ports: ["{{ user_vault_port }}"] | ||
|
|
||
| volume_mounts: | ||
| - name: "{{ name }}" | ||
| path: /config | ||
| kind: configMap | ||
|
|
||
| container_run_args: > | ||
| vault server | ||
| -log-level=warn | ||
| -config=/config/vault.hcl | ||
|
|
||
| add_capabilities: | ||
| - IPC_LOCK |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Configuring Vault | ||
|
|
||
| Vault is specifically designed to be manually setup. This is not automated for a reason. | ||
|
|
||
| ``` | ||
| kubectl port-forward INSTERT_VAULT_ID 8300:8200 | ||
| export VAULT_ADDR=http://localhost:8300 | ||
| ``` | ||
|
|
||
| The first time you setup vault we need to manually configure a bunch | ||
| of things so we don't pass around the root token. | ||
|
|
||
| `vault init` | ||
|
|
||
| Grab the keys, put them in 1password | ||
|
|
||
| `vault unseal $key1` | ||
|
|
||
| `vault unseal $key2` | ||
|
|
||
| `vault unseal $key3` | ||
|
|
||
| Verify the vault unsealed | ||
|
|
||
| `vault auth` | ||
| Paste in the $rootToken | ||
|
|
||
|
|
||
| Now to setup the policies: | ||
|
|
||
| ``` | ||
| vault policy-write organizations-writeonly roles/vault/additional-files/user-vault/policies/organizations-writeonly.hcl | ||
| vault policy-write organizations-readonly roles/vault/additional-files/user-vault/policies/organizations-readonly.hcl | ||
| vault policy-write dock-user-creator roles/vault/additional-files/user-vault/policies/dock-user-creator.hcl | ||
| ``` | ||
|
|
||
| Now to setup the roles | ||
|
|
||
| `vault write auth/token/roles/organizations-readonly allowed_policies="organizations-readonly"` | ||
|
|
||
| Now to setup new token for starlord: | ||
|
|
||
| `vault token-create -policy="organizations-writeonly" -ttl="8760h"` | ||
|
|
||
| Take the response of this and save it in the configuration for the environment you want as the `starlord_vault_token` | ||
|
|
||
| Create a new token for the docks, so they can create readonly tokens. | ||
|
|
||
| `vault token-create -policy="dock-user-creator" -ttl="8760h"` | ||
|
|
||
| Save that token as the `dock_vault_user_creation_access_token` | ||
|
|
||
| This allows the vault user to create a new user using: | ||
| vault write -f auth/token/create/organizations-readonly |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| path "auth/token/create/organizations-readonly" { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like these files are not currently on the host and have to be manually uploaded. Can we turn this into config map and load it into vault as a volume? (Make installation easier)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, you run these locally against the host.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using the README above
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This if fine for now, but we'll have to automate everything after the init + unseal of the vault in order to make installation easier.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't automate it unless we have the scripts modify devops-scripts repo directly itself. |
||
| capabilities = ["create", "update"] | ||
| } | ||
| path "sys/policy" { | ||
| capabilities = ["create", "update"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| path "secret/organization/*" { | ||
| capabilities = ["read"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| path "secret/organization/*" { | ||
| capabilities = ["create","update"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ name }} | ||
| data: | ||
| vault.hcl: | | ||
| storage "s3" { | ||
| access_key = "{{ user_vault_s3_access_key }}" | ||
| secret_key = "{{ user_vault_s3_secret_key }}" | ||
| bucket = "{{ user_vault_s3_bucket }}" | ||
| region = "{{ aws_region }}" | ||
| } | ||
|
|
||
| listener "tcp" { | ||
| address = "0.0.0.0:{{ user_vault_port }}" | ||
| tls_disable = 1 | ||
| } | ||
|
|
||
| max_lease_ttl = "8760h" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| - hosts: starlord | ||
| vars_files: | ||
| - group_vars/alpha-starlord.yml | ||
| roles: | ||
| - role: notify | ||
| - role: builder | ||
| - role: k8-deployment |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| - hosts: user-vault | ||
| vars_files: | ||
| - group_vars/alpha-user-vault.yml | ||
| roles: | ||
| - role: notify | ||
| - role: vault | ||
| - role: k8-deployment | ||
| - role: k8-service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we should move all of these to kuberentes secrets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And probably use: https://www.vaultproject.io/docs/auth/approle.html