Skip to content

Commit 3ec755a

Browse files
committed
implement oauth providers in the dashboard with goth
Replacing vault oidc config dependency Also cleaned up customer secret vault clients
1 parent 254d2a4 commit 3ec755a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1781
-941
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ COPY --from=frontend /app/static/js/main.bundle.js ./web/static/js/main.bundle.j
6767

6868
COPY openapi/ ./openapi/
6969

70+
RUN chown -R goapp . && \
71+
find . -type d -exec chmod 550 {} \; && \
72+
find . -type f -exec chmod 440 {} \; && \
73+
chmod +x /app/binary
74+
7075
EXPOSE 8080
7176

7277
HEALTHCHECK CMD /bin/bash -c 'curl -sf http://localhost:8080/health'

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ integration-test-bulk: generate-bulk-seed ## Run integration tests with bulk see
7878
@echo "Integration tests with bulk data complete"
7979

8080
integration-test-logs: ## View integration test logs
81-
@cd ci && docker compose logs -f
81+
@docker compose -f docker-compose.yaml -f docker-compose.ci.yaml logs -f
8282

8383
integration-test-clean: ## Clean up integration test environment
8484
@echo "Cleaning integration test environment..."
85-
@cd ci && docker compose down -v
85+
@docker compose -f docker-compose.yaml -f docker-compose.ci.yaml down -v
8686
@echo "Integration test environment cleaned"
8787

8888
integration-test-db: ## Access integration test database
89-
@cd ci && docker compose exec mariadb mysql -u libops -plibops-test-pass libops
89+
@docker compose -f docker-compose.yaml -f docker-compose.ci.yaml exec mariadb mysql -u libops -plibops-test-pass libops
9090

9191
##@ Cleanup
9292

ci/docker-compose.bulk.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/docker-compose.yml

Lines changed: 0 additions & 167 deletions
This file was deleted.

ci/mdb-root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-root-password

ci/run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ if [ "$BULK" = true ]; then
6565
exit 1
6666
fi
6767
echo -e "${YELLOW}Using bulk seed data (200+ organizations)${NC}"
68-
COMPOSE_FILES="-f docker-compose.yml -f docker-compose.bulk.yml"
68+
COMPOSE_FILES="-f ../docker-compose.yaml -f ../docker-compose.ci.yaml -f ../docker-compose.bulk.yaml"
6969
else
7070
echo -e "${YELLOW}Using core seed data (3 organizations)${NC}"
71-
COMPOSE_FILES="-f docker-compose.yml"
71+
COMPOSE_FILES="-f ../docker-compose.yaml -f ../docker-compose.ci.yaml"
7272
fi
7373

7474
# Build images if requested

ci/testdata/vault-init.sh

Lines changed: 97 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ enable_secrets() {
1414
fi
1515
}
1616

17-
# Enable KV v2 secrets engine for organization secrets
1817
enable_secrets "secret-organization"
19-
enable_secrets "secret-global"
2018
enable_secrets "secret-project"
2119
enable_secrets "secret-site"
2220

@@ -43,50 +41,127 @@ vault write identity/oidc/client/libops-api redirect_uris='http://api:8080/auth/
4341
vault write identity/oidc/provider/libops-api allowed_client_ids='*' scopes='openid,email,profile' issuer_host='http://vault:8200'
4442
vault write identity/oidc/role/libops-api key='libops-api' template='{"account_id": {{identity.entity.metadata.account_id}},"email": {{identity.entity.metadata.email}},"name": {{identity.entity.name}}}' ttl='1h'
4543

44+
# Create a token role that allows the API to create entity tokens with specific policies
45+
vault write auth/token/roles/entity-token \
46+
allowed_policies="default,libops-user" \
47+
allowed_entity_aliases="*" \
48+
orphan=true \
49+
renewable=true \
50+
token_type="service"
51+
4652
# Create libops-user policy
4753
vault policy write libops-user - <<EOF
4854
path "identity/oidc/token/libops-api" {
4955
capabilities = ["read", "update"]
5056
}
57+
path "keys/{{identity.entity.metadata.account_uuid}}/*" {
58+
capabilities = ["create", "update", "read", "delete", "list"]
59+
}
60+
path "secret-organization/*" {
61+
capabilities = ["create", "update", "read", "delete", "list"]
62+
}
63+
path "secret-project/*" {
64+
capabilities = ["create", "update", "read", "delete", "list"]
65+
}
66+
path "secret-site/*" {
67+
capabilities = ["create", "update", "read", "delete", "list"]
68+
}
69+
70+
EOF
71+
72+
vault policy write api - <<EOF
5173
path "keys/*" {
52-
capabilities = ["create", "update", "read"]
74+
capabilities = ["create", "read", "update", "delete", "list"]
75+
}
76+
77+
path "identity/oidc/client/libops-api" {
78+
capabilities = [ "read" ]
79+
}
80+
81+
path "identity/entity" {
82+
capabilities = [ "create", "update" ]
83+
}
84+
85+
path "identity/entity/id/*" {
86+
capabilities = [ "create", "read", "update", "delete" ]
87+
}
88+
89+
path "identity/entity-alias" {
90+
capabilities = [ "create", "update" ]
5391
}
5492
93+
path "identity/entity-alias/id/*" {
94+
capabilities = [ "read", "update", "delete", "list" ]
95+
}
96+
97+
path "auth/userpass/users/*" {
98+
capabilities = [ "create", "read", "update", "delete", "list" ]
99+
}
100+
101+
path "auth/token/create/entity-token" {
102+
capabilities = [ "create", "update"]
103+
}
104+
105+
path "sys/auth" {
106+
capabilities = ["read", "list"]
107+
}
108+
109+
path "secret/libops-api" {
110+
capabilities = ["read", "list"]
111+
}
112+
113+
path "secret/libops-api/*" {
114+
capabilities = ["read"]
115+
}
116+
117+
path "secret-organization/*" {
118+
capabilities = ["create", "update", "read", "delete", "list"]
119+
}
120+
path "secret-project/*" {
121+
capabilities = ["create", "update", "read", "delete", "list"]
122+
}
123+
path "secret-site/*" {
124+
capabilities = ["create", "update", "read", "delete", "list"]
125+
}
55126
EOF
56127

57128
create_test_user() {
58129
email=$1
59130
password=$2
60131
account_id=$3
61132
entity_name=$4
133+
account_uuid=$5
134+
135+
# Convert UUID to lowercase no-dashes format for account_uuid metadata
136+
account_uuid_no_dashes=$(echo "$account_uuid" | tr -d '-' | tr '[:upper:]' '[:lower:]')
62137

63138
vault_username=$(echo "$email" | tr '@' '_')
64139
vault write "auth/userpass/users/$vault_username" password="$password" policies="libops-user"
65-
vault write identity/entity name="$entity_name" metadata="email=$email" metadata="account_id=$account_id"
140+
vault write identity/entity name="$entity_name" metadata="email=$email" metadata="account_id=$account_id" metadata="account_uuid=$account_uuid_no_dashes"
66141
entity_id=$(vault read -field=id identity/entity/name/$entity_name)
67142
accessor=$(vault auth list | grep "^userpass/" | awk '{print $3}')
68143
vault write identity/entity-alias name="$vault_username" canonical_id="$entity_id" mount_accessor=$accessor
69-
echo "Created user: $vault_username ($entity_id)"
144+
echo "Created user: $vault_username ($entity_id) with account_uuid=$account_uuid_no_dashes"
70145
}
71146

72147
echo 'Creating users...'
73-
create_test_user "admin@libops.io" "password123" "1" "entity-admin@libops.io"
74-
create_test_user "art.vandelay@vandelay.com" "password123" "2" "entity-art.vandelay@vandelay.com"
75-
create_test_user "jerry.seinfeld@vandelay.com" "password123" "3" "entity-jerry.seinfeld@vandelay.com"
76-
create_test_user "elaine.benes@vandelay.com" "password123" "4" "entity-elaine.benes@vandelay.com"
77-
create_test_user "george.costanza@vandelay.com" "password123" "5" "entity-george.costanza@vandelay.com"
78-
create_test_user "cosmo.kramer@vandelay.com" "password123" "6" "entity-cosmo.kramer@vandelay.com"
79-
create_test_user "h.e.pennypacker@pennypacker.com" "password123" "7" "entity-h.e.pennypacker@pennypacker.com"
80-
create_test_user "newman@pennypacker.com" "password123" "8" "entity-newman@pennypacker.com"
81-
create_test_user "bob.sacamano@vandelay.com" "password123" "9" "entity-bob.sacamano@vandelay.com"
82-
create_test_user "joe.davola@vandelay.com" "password123" "10" "entity-joe.davola@vandelay.com"
83-
create_test_user "soup.nazi@vandelay.com" "password123" "11" "entity-soup.nazi@vandelay.com"
84-
create_test_user "babu.bhatt@vandelay.com" "password123" "12" "entity-babu.bhatt@vandelay.com"
85-
create_test_user "jackie.chiles@pennypacker.com" "password123" "13" "entity-jackie.chiles@pennypacker.com"
86-
create_test_user "j.peterman@pennypacker.com" "password123" "14" "entity-j.peterman@pennypacker.com"
87-
create_test_user "david.puddy@vandelay.com" "password123" "15" "entity-david.puddy@vandelay.com"
88-
create_test_user "uncle.leo@vandelay.com" "password123" "16" "entity-uncle.leo@vandelay.com"
89-
create_test_user "noaccess@test.com" "password123" "17" "entity-noaccess@test.com"
148+
create_test_user "admin@libops.io" "password123" "1" "entity-admin@libops.io" "01052d4d-93be-51a3-9684-c357297533cd"
149+
create_test_user "art.vandelay@vandelay.com" "password123" "2" "entity-art.vandelay@vandelay.com" "fdf35d32-bbb3-5ea3-abf2-410da575e169"
150+
create_test_user "jerry.seinfeld@vandelay.com" "password123" "3" "entity-jerry.seinfeld@vandelay.com" "964b5eb0-2037-5263-883c-e939c6916d7d"
151+
create_test_user "elaine.benes@vandelay.com" "password123" "4" "entity-elaine.benes@vandelay.com" "863fb60a-8084-50fe-82ae-efa113231bef"
152+
create_test_user "george.costanza@vandelay.com" "password123" "5" "entity-george.costanza@vandelay.com" "d0bfd257-4572-5036-b5aa-038743be4715"
153+
create_test_user "cosmo.kramer@vandelay.com" "password123" "6" "entity-cosmo.kramer@vandelay.com" "516e3bb4-bfbe-5dda-9cc9-d0e00ce7b6f2"
154+
create_test_user "h.e.pennypacker@pennypacker.com" "password123" "7" "entity-h.e.pennypacker@pennypacker.com" "42b6846e-501f-5153-9aca-210d8d84f946"
155+
create_test_user "newman@pennypacker.com" "password123" "8" "entity-newman@pennypacker.com" "e60f6db8-521a-5fc3-aacc-ceb3f50b6f7b"
156+
create_test_user "bob.sacamano@vandelay.com" "password123" "9" "entity-bob.sacamano@vandelay.com" "94656683-e366-58b8-a391-32e0c54ca37e"
157+
create_test_user "joe.davola@vandelay.com" "password123" "10" "entity-joe.davola@vandelay.com" "0f439d32-e065-5a20-a08e-22dd6793948a"
158+
create_test_user "soup.nazi@vandelay.com" "password123" "11" "entity-soup.nazi@vandelay.com" "ff2098bd-1a33-5db9-8069-37f2bf5bdba7"
159+
create_test_user "babu.bhatt@vandelay.com" "password123" "12" "entity-babu.bhatt@vandelay.com" "a551424b-91ed-5636-a53b-cdb50660d4c9"
160+
create_test_user "jackie.chiles@pennypacker.com" "password123" "13" "entity-jackie.chiles@pennypacker.com" "af54b89e-5533-585a-b3b7-0003b7e6dcc2"
161+
create_test_user "j.peterman@pennypacker.com" "password123" "14" "entity-j.peterman@pennypacker.com" "dfe2b1a8-8000-5b67-88ad-881b036fa4f9"
162+
create_test_user "david.puddy@vandelay.com" "password123" "15" "entity-david.puddy@vandelay.com" "22f49023-8dfe-57c7-95db-dd0f8cae04a7"
163+
create_test_user "uncle.leo@vandelay.com" "password123" "16" "entity-uncle.leo@vandelay.com" "351fcf8b-d637-596c-be1e-8bdd90dbc4eb"
164+
create_test_user "noaccess@test.com" "password123" "17" "entity-noaccess@test.com" "e543554b-5af0-5d97-ac8f-09608bcfa7b8"
90165

91166
echo 'Creating API keys with format: libops_{accountUUID_no_dashes}_{keyUUID_no_dashes}_{randomSecret}...'
92167
# Helper function to create API key in new format

ci/vault-root-token

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-root-token

0 commit comments

Comments
 (0)