2023-09-04 16:43:40 +02:00
|
|
|
#!/bin/bash -e
|
2023-04-12 09:46:35 +02:00
|
|
|
|
2023-07-19 13:45:14 +02:00
|
|
|
if [ "$ENABLE_DATASHIELD" == true ]; then
|
2024-03-11 11:34:05 +01:00
|
|
|
# HACK: This only works because exporter-setup.sh and teiler-setup.sh are sourced after datashield-setup.sh
|
2024-03-18 12:18:19 +01:00
|
|
|
if [ -z "${ENABLE_EXPORTER}" ] || [ "${ENABLE_EXPORTER}" != "true" ]; then
|
2024-03-19 09:47:57 +01:00
|
|
|
log WARN "The ENABLE_EXPORTER variable is either not set or not set to 'true'."
|
2024-03-18 12:18:19 +01:00
|
|
|
fi
|
2023-04-12 09:46:35 +02:00
|
|
|
log INFO "DataSHIELD setup detected -- will start DataSHIELD services."
|
|
|
|
OVERRIDE+=" -f ./$PROJECT/modules/datashield-compose.yml"
|
2023-12-22 11:54:13 +01:00
|
|
|
EXPORTER_OPAL_PASSWORD="$(generate_password \"exporter in Opal\")"
|
|
|
|
TOKEN_MANAGER_OPAL_PASSWORD="$(generate_password \"Token Manager in Opal\")"
|
2023-12-22 11:41:07 +01:00
|
|
|
OPAL_DB_PASSWORD="$(echo \"Opal DB\" | generate_simple_password)"
|
2023-11-23 15:54:44 +01:00
|
|
|
OPAL_ADMIN_PASSWORD="$(generate_password \"admin password for Opal\")"
|
2023-12-22 11:41:07 +01:00
|
|
|
DATASHIELD_CONNECT_SECRET="$(echo \"DataShield Connect\" | generate_simple_password)"
|
|
|
|
TOKEN_MANAGER_SECRET="$(echo \"Token Manager\" | generate_simple_password)"
|
2023-09-15 10:12:16 +02:00
|
|
|
if [ ! -e /tmp/bridgehead/opal-cert.pem ]; then
|
|
|
|
mkdir -p /tmp/bridgehead/
|
2023-12-13 15:07:11 +01:00
|
|
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout /tmp/bridgehead/opal-key.pem -out /tmp/bridgehead/opal-cert.pem -days 3650 -subj "/CN=opal/C=DE"
|
2023-07-19 13:45:14 +02:00
|
|
|
fi
|
2023-09-15 11:45:28 +02:00
|
|
|
mkdir -p /tmp/bridgehead/opal-map
|
2024-04-17 14:25:59 +02:00
|
|
|
echo '{"sites": []}' >/tmp/bridgehead/opal-map/central.json
|
|
|
|
echo '[{
|
|
|
|
"external": "'$SITE_ID':443",
|
2023-12-13 15:07:11 +01:00
|
|
|
"internal": "opal:8443",
|
2024-04-17 14:25:59 +02:00
|
|
|
"allowed": ["datashield-connect.request-manager.'$BROKER_ID'"]
|
|
|
|
}]' > /tmp/bridgehead/opal-map/local.json
|
2024-01-31 15:23:14 +01:00
|
|
|
if [ "$USER" == "root" ]; then
|
|
|
|
chown -R bridgehead:docker /tmp/bridgehead
|
|
|
|
chmod g+wr /tmp/bridgehead/opal-map/*
|
|
|
|
chmod g+r /tmp/bridgehead/opal-key.pem
|
|
|
|
fi
|
2023-11-30 14:46:08 +01:00
|
|
|
add_private_oidc_redirect_url "/opal/*"
|
2023-05-16 16:40:22 +02:00
|
|
|
fi
|