1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
051f00940c feat: install vim
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-17 14:39:12 +02:00
98c9e7f9f9 fix(Dockerfile): fail build when apt-get fails 2022-09-17 14:39:12 +02:00
4 changed files with 10 additions and 17 deletions

View File

@ -1,6 +1,6 @@
FROM debian:bookworm-slim
RUN set -eux && \
RUN set -eux; \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \

View File

@ -16,7 +16,7 @@
| --- | --- | --- |
| `ROOT_AUTHORIZED_KEYS` | `/path/to/file` | Path to file that contains the public SSH keys that can be used for root user authentication. This file will be copied to `/root/.ssh/authorized_keys` |
| `HOSTKEYS` | `/path/to/hostkey` | Specifies a (semi-colon separated list of) file(s) containing a private host key used by SSH. |
| `USERADD` | `{username}:{uid}:{gid}:{shell};...` | Create user account(s) on startup |
| `USERADD` | `{username}:{uid}:{gid};...` | Create user account(s) on startup |
| `GROUPADD` | `{groupname}:{gid};...` | Create group account(s) on startup |
| `BASE_DIR` | `/home` | Basedir used for user account creation (Default: `/home`) |
@ -28,7 +28,7 @@ $ docker run -it \
-v $(pwd)/jumpbox:/var/lib/jumpbox \
-e "ROOT_AUTHORIZED_KEYS=/var/lib/jumpbox/authorized_keys"
-e "HOSTKEYS=/var/lib/jumpbox/ssh_host_ed25519_key;/var/lib/jumpbox/ssh_host_rsa_key"
-e "USERADD=jumpbox:1000:1000:/bin/bash"
-e "USERADD=jumpbox:1000:1000"
-e "GROUPADD=jumpbox:1000"
-p 1022:22 \
pommib/jumpbox:latest
@ -50,6 +50,6 @@ services:
environment:
ROOT_AUTHORIZED_KEYS: /var/lib/jumpbox/authorized_keys
HOSTKEYS: /var/lib/jumpbox/ssh_host_ed25519_key;/var/lib/jumpbox/ssh_host_rsa_key
USERADD: jumpbox:1000:1000:/bin/bash
USERADD: jumpbox:1000:1000
GROUPADD: jumpbox:1000
```

View File

@ -1,6 +1,6 @@
#!/bin/sh
set -ex
set -x
IMAGE=pommib/jumpbox:latest
docker pull $IMAGE

View File

@ -22,7 +22,6 @@ if [ ! -d "$BASE_DIR" ]; then
fi
# GROUPADD="group1:1000;group2:1001;group3:1002"
i=""
while [ "$GROUPADD" != "$i" ] ;do
i=${GROUPADD%%;*}
GROUPADD="${GROUPADD#$i;}"
@ -33,26 +32,20 @@ while [ "$GROUPADD" != "$i" ] ;do
groupadd --gid "$GROUP_GID" "$GROUP_NAME"
done
# USERADD="user1:1000:1000:/bin/bash;user2:1001:1000:/bin/sh;user3:1002:1002:/bin/sh"
i=""
j=""
# USERADD="user1:1000:1000;user2:1001:1000;user3:1002:1002"
while [ "$USERADD" != "$i" ] ;do
i=${USERADD%%;*}
USERADD="${USERADD#$i;}"
USER_NAME=${i%%:*}
j="${i#$USER_NAME:}"
USER_UID="${j%%:*}"
j="${j#$USER_UID:}"
USER_GID="${j%%:*}"
j="${j#$USER_GID:}"
USER_SHELL=$j
UID_GID="${i#$USER_NAME:}"
USER_UID="${UID_GID%%:*}"
USER_GID="${UID_GID#$USER_UID:}"
useradd --home-dir "$BASE_DIR/$USER_NAME" --shell "$USER_SHELL" --uid "$USER_UID" --gid "$USER_GID" "$USER_NAME"
useradd --home-dir "$BASE_DIR/$USER_NAME" --uid "$USER_UID" --gid "$USER_GID" "$USER_NAME"
done
# HOSTKEYS="/var/lib/jumpbox/ssh_host_ed25519_key;/var/lib/jumpbox/ssh_host_rsa_key"
i=""
if [ -n "$HOSTKEYS" ]; then
while [ "$HOSTKEYS" != "$i" ]; do
i=${HOSTKEYS%%;*}