From e2bc0a9ba93bfe95efa5d139b43cd9e1eed60980 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sun, 2 Jun 2024 13:03:52 +0200 Subject: [PATCH] hosting the jump creating users --- jumphost/Dockerfile | 3 ++- jumphost/create_users.sh | 7 +++++++ jumphost/supervisord.conf | 8 +++++++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 jumphost/create_users.sh diff --git a/jumphost/Dockerfile b/jumphost/Dockerfile index c1bc9b6..98ec490 100644 --- a/jumphost/Dockerfile +++ b/jumphost/Dockerfile @@ -1,5 +1,6 @@ FROM debian:bookworm-slim +COPY create_users.sh /create_users.sh COPY start_sshd.sh /start_sshd.sh COPY supervisord.conf /etc/supervisord.conf @@ -10,7 +11,7 @@ RUN apt-get update && \ apt-get -y clean && \ touch /var/log/supervisord.log && \ mkdir /var/run/sshd && \ - chmod a+x /start_sshd.sh + chmod a+x /*.sh EXPOSE 22/tcp diff --git a/jumphost/create_users.sh b/jumphost/create_users.sh new file mode 100644 index 0000000..c052c7a --- /dev/null +++ b/jumphost/create_users.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +for user in /jumphost_users/*; do + uid=`cat /jumphost_users/${user} + /usr/sbin/groupadd -g ${uid} ${user} + /usr/sbin/useradd -d /home/${user} -m -s /bin/bash -u ${uid} -g ${uid} ${user} +done \ No newline at end of file diff --git a/jumphost/supervisord.conf b/jumphost/supervisord.conf index db6f9b1..7c35c87 100644 --- a/jumphost/supervisord.conf +++ b/jumphost/supervisord.conf @@ -3,7 +3,13 @@ nodaemon=true childlogdir=/var/log logfile=/var/log/supervisord.log +[program:create_users] +command=/create_users.sh +startsecs=0 +autorestart=false +startretries=1 + [program:sshd] -command=/entry/start_sshd.sh +command=/start_sshd.sh stdout_logfile=/var/log/sshd.log redirect_stderr=true \ No newline at end of file