Skip to content

Commit ba0bdf4

Browse files
authored
Merge pull request #649 from CodeNow/SAN-6926-starlord-3
RE-implemented starlord + vault
2 parents bf2e0e5 + ee564dd commit ba0bdf4

17 files changed

Lines changed: 188 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ It is the custom at Runnable to play a song to the entire team when deploying. F
143143
| sauron | [Sauron theme song from LOTR](https://www.youtube.com/watch?v=V_rk9VBrXMY) |
144144
| Security Groups | [Out of the Woods - Tayor Swift](https://www.youtube.com/watch?v=JLf9q36UsBk)
145145
| shiva | [FFXIV Shiva Theme](https://www.youtube.com/watch?v=noJiH8HLZw4) |
146+
| starlord | [Blue Swede - Hooked on a Feeling](https://www.youtube.com/watch?v=NrI-UBIB8Jk) |
146147
| swarm-deamon | [Pink Floyd - Another Brick In The Wall](https://www.youtube.com/watch?v=5IpYOF4Hi6Q) |
147148
| swarm-manager | [Eric Prydz VS Pink Floyd - 'Proper Education'](https://www.youtube.com/watch?v=IttkDYE33aU) |
148149
| varnish | [Karate Kid Theme Song](https://www.youtube.com/watch?v=VIYqtkdMxQg) |

ansible/delta-hosts/hosts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ delta-consul-a
3434
delta-consul-b
3535
delta-consul-c
3636

37+
[user-vault]
38+
localhost
39+
3740
[worker]
3841
localhost
3942

@@ -104,6 +107,9 @@ localhost
104107
[sauron]
105108
localhost
106109

110+
[starlord]
111+
localhost
112+
107113
[swarm-manager]
108114
localhost
109115

@@ -162,7 +168,9 @@ sauron
162168
shiva
163169
socket-server
164170
socket-server-proxy
171+
starlord
165172
swarm-manager
173+
user-vault
166174
userland
167175
web
168176
worker

ansible/delta-hosts/variables

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,18 @@ sauron_rollbar_key=83157ae2d50d4b6398e404c0b9978d26
142142
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q
143143
aws_secret_access_key=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
144144

145+
[starlord:vars]
146+
starlord_vault_token=319ff979-b066-87c7-1172-6f3b5305d749
147+
145148
[swarm-manager:vars]
146149
environment_name=delta
147150

151+
[user-vault:vars]
152+
user_vault_s3_access_key=AKIAJRB2ERCOLHGNYAFQ
153+
user_vault_s3_secret_key=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
154+
user_vault_s3_bucket=delta-user-vault
155+
vault_config_file=user-vault.yml
156+
148157
[vault:vars]
149158
vault_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
150159
vault_aws_access_key_id=AKIAJ7R4UIM45KH2WGWQ
@@ -192,6 +201,7 @@ vault_token_03=47f3cb74f5374fa3c51c90fd25e3d4cc851034de97584995fce5fc5382342f1f0
192201
rabbit_port=54321
193202
registry_username=runnable+deltapush
194203
registry_token=4PX2AU9QIJSCDLZEXILYX6ZP2RCXY1HR10WVZKWVR0JW8DS5IIY87D96V0RACMK5
204+
dock_vault_user_creation_access_token=ddf20c34-019c-5b24-9c0d-1b44e3edf29a
195205

196206
[web:vars]
197207
web_intercom_id=wqzm3rju

ansible/gamma-hosts/hosts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ gamma-consul-a
3838
gamma-consul-b
3939
gamma-consul-c
4040

41+
[user-vault]
42+
localhost
43+
4144
[worker]
4245
localhost
4346

@@ -95,6 +98,9 @@ localhost
9598
[shiva]
9699
localhost
97100

101+
[starlord]
102+
localhost
103+
98104
[socket-server]
99105
localhost
100106

@@ -161,7 +167,9 @@ sauron
161167
shiva
162168
socket-server
163169
socket-server-proxy
170+
starlord
164171
swarm-manager
172+
user-vault
165173
userland
166174
web
167175
worker

ansible/gamma-hosts/variables

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,18 @@ sauron_rollbar_key=83157ae2d50d4b6398e404c0b9978d26
120120
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q
121121
aws_secret_access_key=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
122122

123+
[starlord:vars]
124+
starlord_vault_token=8d6b414a-2e6d-65fb-f0b8-c6200ae688ad
125+
123126
[swarm-manager:vars]
124127
environment_name=gamma
125128

129+
[user-vault:vars]
130+
user_vault_s3_access_key=AKIAIOTM4MKOJJVUL7IQ
131+
user_vault_s3_secret_key=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
132+
user_vault_s3_bucket=gamma-user-vault
133+
vault_config_file=user-vault.yml
134+
126135
[vault:vars]
127136
vault_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
128137
vault_aws_access_key_id=AKIAJ7R4UIM45KH2WGWQ
@@ -173,6 +182,7 @@ vault_token_02=3489b87c913058740537bbbd4503f3720d74f7cb0f4e0c30a9436e1e52a18d700
173182
vault_token_03=ac4e1e9800cbf77283298d08172a2f0e46d0b7cbc457c47788d04768af12584a02
174183
registry_username=runnable+gamma
175184
registry_token=8G0NT1HZQZHYXU7OB1QAI8HA1560V6R68DE6R6B8YJWQAED82JAFCD057ZWIDT76
185+
dock_vault_user_creation_access_token=137f441f-db71-40a2-8448-10a565323b1e
176186

177187
[web:vars]
178188
web_intercom_id=xs5g95pd

ansible/group_vars/all.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ drake_port: 80
127127
# ec2
128128
aws_access_key: "AKIAIWRXWZ4P3MIMY3LA"
129129
aws_secret_key: "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"
130+
aws_region: "us-west-2"
130131

131132
# eru
132133
eru_http_port: 5501
@@ -217,6 +218,10 @@ npm_token: c76363e9-78e0-4667-82ac-e2ac01efcfe2
217218
# remote vault
218219
vault_port: 8200
219220

221+
# user-vault
222+
user_vault_port: 8200
223+
user_vault_host_address: user-vault
224+
220225
# local-vault
221226
vault_local_port: 31836
222227
vault_addr: http://127.0.0.1:{{ vault_local_port }}

ansible/group_vars/alpha-api-base.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,5 @@ api_base_container_envs:
118118
value: "{{ api_intercom_app_id | default('ansible_undefined') }}"
119119
- name: INTERCOM_API_KEY
120120
value: "{{ api_intercom_api_key | default('ansible_undefined') }}"
121+
- name: USER_VAULT_ENDPOINT
122+
value: "http://{{ user_vault_host_address }}:{{ user_vault_port }}"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: starlord
2+
3+
container_image: "{{ registry_host }}/runnable/{{ name }}"
4+
container_tag: "{{ git_branch }}"
5+
inject_ca: false
6+
repo: git@github.com:CodeNow/{{ name }}.git
7+
node_version: "6.10.2"
8+
9+
container_envs:
10+
- name: NODE_ENV
11+
value: "{{ node_env }}"
12+
- name: VAULT_ENDPOINT
13+
value: "http://{{ user_vault_host_address }}:{{ user_vault_port }}"
14+
- name: VAULT_TOKEN
15+
value: "{{starlord_vault_token}}"
16+
- name: RABBITMQ_HOSTNAME
17+
value: "{{ rabbit_host_address }}"
18+
- name: RABBITMQ_PASSWORD
19+
value: "{{ rabbit_password }}"
20+
- name: RABBITMQ_PORT
21+
value: "{{ rabbit_port }}"
22+
- name: RABBITMQ_USERNAME
23+
value: "{{ rabbit_username }}"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: user-vault
2+
3+
container_image: vault
4+
container_tag: 0.7.0
5+
hosted_ports: ["{{ user_vault_port }}"]
6+
7+
volume_mounts:
8+
- name: "{{ name }}"
9+
path: /config
10+
kind: configMap
11+
12+
container_run_args: >
13+
vault server
14+
-log-level=warn
15+
-config=/config/vault.hcl
16+
17+
add_capabilities:
18+
- IPC_LOCK
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Configuring Vault
2+
3+
Vault is specifically designed to be manually setup. This is not automated for a reason.
4+
5+
```
6+
kubectl port-forward INSTERT_VAULT_ID 8300:8200
7+
export VAULT_ADDR=http://localhost:8300
8+
```
9+
10+
The first time you setup vault we need to manually configure a bunch
11+
of things so we don't pass around the root token.
12+
13+
`vault init`
14+
15+
Grab the keys, put them in 1password
16+
17+
`vault unseal $key1`
18+
19+
`vault unseal $key2`
20+
21+
`vault unseal $key3`
22+
23+
Verify the vault unsealed
24+
25+
`vault auth`
26+
Paste in the $rootToken
27+
28+
29+
Now to setup the policies:
30+
31+
```
32+
vault policy-write organizations-writeonly roles/vault/additional-files/user-vault/policies/organizations-writeonly.hcl
33+
vault policy-write organizations-readonly roles/vault/additional-files/user-vault/policies/organizations-readonly.hcl
34+
vault policy-write dock-user-creator roles/vault/additional-files/user-vault/policies/dock-user-creator.hcl
35+
```
36+
37+
Now to setup the roles
38+
39+
`vault write auth/token/roles/organizations-readonly allowed_policies="organizations-readonly"`
40+
41+
Now to setup new token for starlord:
42+
43+
`vault token-create -policy="organizations-writeonly" -ttl="8760h"`
44+
45+
Take the response of this and save it in the configuration for the environment you want as the `starlord_vault_token`
46+
47+
Create a new token for the docks, so they can create readonly tokens.
48+
49+
`vault token-create -policy="dock-user-creator" -ttl="8760h"`
50+
51+
Save that token as the `dock_vault_user_creation_access_token`
52+
53+
This allows the vault user to create a new user using:
54+
vault write -f auth/token/create/organizations-readonly

0 commit comments

Comments
 (0)