Skip to content

Commit 35299c6

Browse files
committed
feat: replace single key by a jwks in docker-compose
1 parent 415f953 commit 35299c6

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

tests/CI/docker-compose.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ services:
130130
condition: service_healthy
131131
dirac-init-certificates:
132132
condition: service_completed_successfully # Let the init container create the certificates
133-
diracx-init-key:
133+
diracx-init-keystore:
134134
condition: service_completed_successfully # Let the init container create the signing key
135135
diracx-init-cs:
136136
condition: service_completed_successfully # Let the init container create the cs
@@ -139,10 +139,10 @@ services:
139139
volumes:
140140
- certs_data:/ca/certs
141141
- diracx-cs-store:/cs_store
142-
- diracx-key-store:/signing-key
142+
- diracx-key-store:/keystore
143143
environment:
144144
- DIRACX_CONFIG_BACKEND_URL=git+file:///cs_store/initialRepo
145-
- DIRACX_SERVICE_AUTH_TOKEN_KEY=file:///signing-key/rs256.key
145+
- DIRACX_SERVICE_AUTH_TOKEN_KEYSTORE=file:///keystore/jwks.json
146146
command: ["sleep", "infinity"] # This is necessary because of the issue described in https://github.com/moby/moby/issues/42275. What is added here is a hack/workaround.
147147
pull_policy: always
148148

@@ -185,33 +185,33 @@ services:
185185
start_period: 60s
186186
command: ["sleep", "infinity"] # This is necessary because of the issue described in https://github.com/moby/moby/issues/42275. What is added here is a hack/workaround.
187187

188-
diracx-init-key:
189-
image: ghcr.io/diracgrid/diracx/secret-generation:latest
190-
container_name: diracx-init-key
188+
diracx-init-keystore:
189+
image: ghcr.io/diracgrid/diracx/services:dev
190+
container_name: diracx-init-keystore
191191
environment:
192-
- DIRACX_SERVICE_AUTH_TOKEN_KEY="file:///signing-key/rs256.key"
192+
- DIRACX_SERVICE_AUTH_TOKEN_KEYSTORE="file:///keystore/jwks.json"
193193
volumes:
194-
- diracx-key-store:/signing-key/
194+
- diracx-key-store:/keystore/
195195
# As the diracx images don't run as root we need to change the permissions of the /cs_store/ directory as well
196196
- diracx-cs-store:/cs_store/
197197
# We need to allow everybody to read the private keys
198198
# Because the users are different between the DIRAC and DiracX containers
199199
entrypoint: |
200-
bash -xc "ssh-keygen -P '' -trsa -b4096 -mPEM -f/signing-key/rs256.key && chmod o+r /signing-key/rs256.* && chmod -R o=u /cs_store"
200+
/entrypoint.sh bash -xc 'python -m diracx.logic rotate-jwk --jwks-path /keystore/jwks.json && chmod -R o=u /cs_store'
201201
pull_policy: always
202202

203203
diracx-init-cs:
204204
image: ghcr.io/diracgrid/diracx/client:dev
205205
container_name: diracx-init-cs
206206
depends_on:
207-
diracx-init-key:
207+
diracx-init-keystore:
208208
condition: service_completed_successfully # Let the init container set the permission on /cs_store/
209209
environment:
210210
- DIRACX_CONFIG_BACKEND_URL=git+file:///cs_store/initialRepo
211-
- DIRACX_SERVICE_AUTH_TOKEN_KEY=file:///signing-key/rs256.key
211+
- DIRACX_SERVICE_AUTH_TOKEN_KEYSTORE=file:///keystore/jwks.json
212212
volumes:
213213
- diracx-cs-store:/cs_store/
214-
- diracx-key-store:/signing-key/
214+
- diracx-key-store:/keystore/
215215
entrypoint: |
216216
/entrypoint.sh bash -xc 'dirac internal generate-cs /cs_store/initialRepo'
217217
pull_policy: always
@@ -239,7 +239,7 @@ services:
239239
- DIRACX_DB_URL_SANDBOXMETADATADB=mysql+aiomysql://Dirac:Dirac@mysql/SandboxMetadataDB
240240
- DIRACX_DB_URL_PILOTAGENTSDB=mysql+aiomysql://Dirac:Dirac@mysql/PilotAgentsDB
241241
- 'DIRACX_OS_DB_PILOTLOGSDB={"sqlalchemy_dsn": "mysql+aiomysql://Dirac:Dirac@mysql/PilotLogsDB"}'
242-
- DIRACX_SERVICE_AUTH_TOKEN_KEY=file:///signing-key/rs256.key
242+
- DIRACX_SERVICE_AUTH_TOKEN_KEYSTORE=file:///keystore/jwks.json
243243
- DIRACX_SERVICE_AUTH_TOKEN_ISSUER=http://diracx:8000
244244
- DIRACX_SERVICE_AUTH_ALLOWED_REDIRECTS=["http://diracx:8000/docs/oauth2-redirect"]
245245
# Obtained with head -c 32 /dev/urandom | base64
@@ -256,7 +256,7 @@ services:
256256
condition: service_completed_successfully
257257
volumes:
258258
- diracx-cs-store:/cs_store/
259-
- diracx-key-store:/signing-key/
259+
- diracx-key-store:/keystore/
260260
entrypoint: |
261261
/entrypoint.sh bash -xc 'uvicorn --factory diracx.routers:create_app --host=0.0.0.0'
262262

0 commit comments

Comments
 (0)