2021-05-17 13:54:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-05-17 14:26:58 +00:00
|
|
|
set -eu
|
2021-05-17 13:54:59 +00:00
|
|
|
|
|
|
|
file_env() {
|
|
|
|
local var="$1"
|
|
|
|
local fileVar="${var}_FILE"
|
|
|
|
local def="${2:-}"
|
|
|
|
|
|
|
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
|
|
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
local val="$def"
|
|
|
|
if [ "${!var:-}" ]; then
|
|
|
|
val="${!var}"
|
|
|
|
elif [ "${!fileVar:-}" ]; then
|
|
|
|
val="$(< "${!fileVar}")"
|
|
|
|
fi
|
|
|
|
export "$var"="$val"
|
|
|
|
unset "$fileVar"
|
|
|
|
}
|
|
|
|
|
|
|
|
file_env "PASSWORD"
|
2021-05-17 14:26:58 +00:00
|
|
|
|
2021-06-28 11:42:02 +00:00
|
|
|
{{ if eq (env "OIDC_ENABLED") "1" }}
|
2021-06-28 12:03:22 +00:00
|
|
|
echo 'auth-openid=1' >> /etc/rstudio/rserver.conf
|
|
|
|
echo 'auth-openid-issuer={{ env "OIDC_ISSUER_URL"}}' >> /etc/rstudio/rserver.conf
|
|
|
|
echo 'auth-openid-base-uri=https://{{ env "DOMAIN" }}' >> /etc/rstudio/rserver.conf
|
2021-06-28 11:42:02 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2021-09-21 10:50:40 +00:00
|
|
|
{{ if eq (env "KEYCLOAK_ENABLED") "1" }}
|
2023-04-11 14:26:16 +00:00
|
|
|
apt update --allow-releaseinfo-change
|
2021-09-21 10:50:40 +00:00
|
|
|
apt install -y libpam-script
|
|
|
|
mkdir -p /opt/pam-exec-oauth2/
|
|
|
|
wget https://github.com/WASHNote/pam-exec-oauth2/releases/download/v0.0.1/pam-exec-oauth2 -O /opt/pam-exec-oauth2/pam-exec-oauth2
|
|
|
|
chmod +x /opt/pam-exec-oauth2/pam-exec-oauth2
|
2021-09-29 08:36:24 +00:00
|
|
|
echo 'auth requisite pam_exec.so log=/tmp/pam_exec.log expose_authtok /opt/pam-exec-oauth2/pam-exec-oauth2 --verbose' > /etc/pam.d/common-auth
|
|
|
|
echo 'auth requisite pam_script.so' >> /etc/pam.d/common-auth
|
2021-09-21 10:50:40 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2023-03-14 14:49:11 +00:00
|
|
|
{{ if eq (env "MSSQL_ENABLED") "1" }}
|
|
|
|
export ACCEPT_EULA=Y
|
|
|
|
|
|
|
|
apt --allow-releaseinfo-change update && apt install -yq curl gpg libglpk40
|
|
|
|
|
|
|
|
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
|
|
|
|
|
|
|
|
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
|
|
|
|
|
|
|
|
apt update && apt install -yq msodbcsql17 mssql-tools
|
|
|
|
{{ end }}
|
|
|
|
|
2021-10-26 08:57:20 +00:00
|
|
|
locale-gen {{ env "DEFAULT_LOCALES" }}
|
|
|
|
|
2021-05-17 14:26:58 +00:00
|
|
|
exec "$@"
|