diff --git a/Dockerfile b/Dockerfile index 4df5e0c..de934f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG BASE_IMAGE_TAG=3.8.18-slim-bookworm FROM python:$BASE_IMAGE_TAG as builder ENV VIRTUAL_ENV=/opt/privacyidea WORKDIR $VIRTUAL_ENV -RUN apt-get update && apt-get install -y python3-dev gcc libpq-dev libkrb5-dev curl +RUN apt-get update && apt-get install -y python3-dev gcc libpq-dev libkrb5-dev COPY requirements.txt requirements.txt RUN python3 -m venv "$VIRTUAL_ENV" && . $VIRTUAL_ENV/bin/activate && pip3 install wheel && pip3 install -r requirements.txt @@ -18,7 +18,7 @@ ENV PI_SKIP_BOOTSTRAP=false \ COPY prebuildfs / SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN install_packages ca-certificates gettext-base tini tree jq libpq5 && \ +RUN install_packages ca-certificates gettext-base tini tree jq libpq5 realmd krb5-user curl && \ mkdir -p "$PI_DATA_DIR" "$PI_CFG_DIR" && \ chown -R nobody:nogroup "$PI_DATA_DIR" "$PI_CFG_DIR" USER nobody diff --git a/README.md b/README.md index ffe317d..b7e555e 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,10 @@ The Khalibre privacyIDEA container can create a default admin user by setting th | `PI_DB_USER` | Database user | | | `PI_DB_PASSWORD` | Database password | | | `PI_DB_NAME` | Database name | | -| `PI_DB_HOST` | Database host | | -| `PI_DB_PORT` | Database port | depnds on PI_DB_VENDOR default for each type | +| `PI_DB_HOST` | Database host. For on postgres use it support multiple hosts with comma separated | | +| `PI_DB_PORT` | Database port. For on postgres use it support multiple hosts with comma separated | depnds on PI_DB_VENDOR default for each type | | `PI_DB_ARGS` | Addiitional DB attributes | | -| `SQLALCHEMY_DATABASE_URI` | Full SQL connection strinng | | +| `SQLALCHEMY_DATABASE_URI` | Full SQL connection string. If set it will override all PI_DB_* settings | | | `PI_CACHE_TYPE` | privacyIDEA cache type | simple | | `PI_PEPPER` | This is used to encrypt the admin passwords | | | `PI_AUDIT_NO_SIGN` | If you by any reason want to avoid signing audit entries set it true | false | diff --git a/rootfs/usr/local/bin/configure_privacyidea.sh b/rootfs/usr/local/bin/configure_privacyidea.sh index aba44b7..ca3dc76 100755 --- a/rootfs/usr/local/bin/configure_privacyidea.sh +++ b/rootfs/usr/local/bin/configure_privacyidea.sh @@ -42,9 +42,10 @@ function generate_pi_config { echo "[ERROR] $var_name should be defined" exit 1 else - # Remove single and double quotes + # Remove single, double quotes and spaces var_value=${var_value//\'/} var_value=${var_value//\"/} + var_value=${var_value// /} eval "$var_name='$var_value'" fi } @@ -71,10 +72,10 @@ function generate_pi_config { # Define the SQLAlchemy database URI using the necessary variables if [ -z "$PI_DB_ARGS" ]; then - export SQLALCHEMY_DATABASE_URI="${PI_DB_VENDOR}+psycopg2://${PI_DB_USER}:${encoded_password}@/${PI_DB_NAME}?host=${PI_DB_HOST// /}&port=${PI_DB_PORT:-5432}" + export SQLALCHEMY_DATABASE_URI="${PI_DB_VENDOR}+psycopg2://${PI_DB_USER}:${encoded_password}@/${PI_DB_NAME}?host=${PI_DB_HOST}&port=${PI_DB_PORT:-5432}" else check_and_clean_vars "PI_DB_ARGS" - export SQLALCHEMY_DATABASE_URI="${PI_DB_VENDOR}+psycopg2://${PI_DB_USER}:${encoded_password}@/${PI_DB_NAME}?host=${PI_DB_HOST// /}&port=${PI_DB_PORT:-5432}&${PI_DB_ARGS//,/&}" + export SQLALCHEMY_DATABASE_URI="${PI_DB_VENDOR}+psycopg2://${PI_DB_USER}:${encoded_password}@/${PI_DB_NAME}?host=${PI_DB_HOST}&port=${PI_DB_PORT:-${PI_DB_HOST//[!,]/}}&${PI_DB_ARGS//,/&}" fi ;;