From 5d41f7539a518b76f3e5b2da1700376bf68ced51 Mon Sep 17 00:00:00 2001 From: knoflook Date: Thu, 7 Mar 2024 15:44:21 +0100 Subject: [PATCH] feat: experimental local users --- .env.sample | 3 +++ abra.sh | 2 +- compose.local-users.yml | 2 +- entrypoint.sh.tmpl | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.env.sample b/.env.sample index 5a6b4b0..ef1d3d8 100644 --- a/.env.sample +++ b/.env.sample @@ -16,6 +16,9 @@ COMPOSE_FILE="compose.yml" # MSSQL driver MSSQL_ENABLED="1" +# Comment out if you are using keycloak or oidc +COMPOSE_FILE="$COMPOSE_FILE:compose.local-users.yml" + # OpenID Connect (SSO) #COMPOSE_FILE="$COMPOSE_FILE:compose.oidc.yml" #OIDC_ENABLED=1 diff --git a/abra.sh b/abra.sh index 030b13f..06c9c6d 100644 --- a/abra.sh +++ b/abra.sh @@ -1,4 +1,4 @@ -export CUSTOM_ENTRYPOINT_VERSION=v15 +export CUSTOM_ENTRYPOINT_VERSION=v16 export OIDC_CONF_VERSION=v1 export PAM_EXEC_OAUTH2_YAML_VERSION=v1 export PAM_SCRIPT_AUTH_VERSION=v7 diff --git a/compose.local-users.yml b/compose.local-users.yml index 293a2c2..4facbfc 100644 --- a/compose.local-users.yml +++ b/compose.local-users.yml @@ -6,7 +6,7 @@ services: volumes: - users:/opt/users environment: - - LINK_USERS=/opt/users/ + - COPY_USERS=1 volumes: users: diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index fb537bf..1c8ec66 100644 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -21,6 +21,23 @@ file_env() { unset "$fileVar" } +{{ if eq (env "COPY_USERS") "1" }} +cp /opt/users/passwd /etc/passwd || true +cp /opt/users/shadow /etc/shadow || true +cp /opt/users/group /etc/group || true + +copy_users() { + while true; do + cp /etc/passwd /opt/users/passwd + cp /etc/shadow /opt/users/shadow + cp /etc/group /opt/users/group + sleep 60 + done +} + +copy_users & +{{ end }} + file_env "PASSWORD" {{ if eq (env "OIDC_ENABLED") "1" }}