From 928eedfe8f7642aa6306708d77c106f480446f64 Mon Sep 17 00:00:00 2001 From: Panos Chatzopoulos Date: Wed, 6 Sep 2023 14:16:58 +0200 Subject: [PATCH] moved generating of c4gh key for dev envirnoment to compose file --- sda-auth/dev-server/docker-compose.yml | 16 +++++++++++++++- sda-auth/dev-server/setup.sh | 6 ------ 2 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 sda-auth/dev-server/setup.sh diff --git a/sda-auth/dev-server/docker-compose.yml b/sda-auth/dev-server/docker-compose.yml index a729c5e86..45118f266 100644 --- a/sda-auth/dev-server/docker-compose.yml +++ b/sda-auth/dev-server/docker-compose.yml @@ -38,6 +38,19 @@ services: - CEGA_USERS_USER=dummy ports: - 8443:8443 + keygen: + image: golang:alpine3.16 + container_name: keygen + command: + - "/bin/sh" + - "-c" + - if [ ! -f "/out/c4gh_key.sec.pem" ]; then git --help >/dev/null 2>&1; [[ "$$?" != "0" ]] && apk add git; + [ ! -d "crypt4gh" ] && git clone https://github.com/neicnordic/crypt4gh.git; + cd crypt4gh; + [ ! -f "crypt4gh" ] && go build .; + ./crypt4gh generate -n c4gh_key -p privatekeypass && mv *.pem /out/; fi + volumes: + - ../keys:/out auth: container_name: auth build: @@ -50,6 +63,8 @@ services: condition: service_started cega: condition: service_started + keygen: + condition: service_completed_successfully environment: - ELIXIR_ID=XC56EL11xx - ELIXIR_PROVIDER=http://oidc:9090 @@ -70,7 +85,6 @@ services: volumes: - ../keys:/keys - ../:/sda-auth - - ./keys/c4gh_key.pub.pem:/c4gh_key.pub.pem image: sda-auth ports: - 8080:8080 diff --git a/sda-auth/dev-server/setup.sh b/sda-auth/dev-server/setup.sh deleted file mode 100644 index bc5569e86..000000000 --- a/sda-auth/dev-server/setup.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -mkdir -p keys - -openssl genrsa -out c4gh_key.sec.pem 4096 -openssl rsa -in c4gh_key.sec.pem -pubout -out keys/c4gh_key.pub.pem