summaryrefslogtreecommitdiff
path: root/Dockerfile/alpine-3.19.Dockerfile
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-06 10:35:38 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-06 10:35:38 +0900
commitff45d9d71b85a618aed6d3d5e5056bada6ff81f9 (patch)
tree8f5989f7f30f8e8a9320128617fa63e22115d65a /Dockerfile/alpine-3.19.Dockerfile
parent9908fb309d9388481769e1a558a1f8dc47c4dabf (diff)
add two env vars to pass password/keyphrase (#9)
MSCP_SSH_AUTH_PASSWORD passes a password, and MSCP_SSH_AUTH_PASSPHRASE passes a passphrase for publickey auth. They enable avoiding interactive password input. Test cases are also added.
Diffstat (limited to 'Dockerfile/alpine-3.19.Dockerfile')
-rw-r--r--Dockerfile/alpine-3.19.Dockerfile18
1 files changed, 14 insertions, 4 deletions
diff --git a/Dockerfile/alpine-3.19.Dockerfile b/Dockerfile/alpine-3.19.Dockerfile
index a19957b..a338161 100644
--- a/Dockerfile/alpine-3.19.Dockerfile
+++ b/Dockerfile/alpine-3.19.Dockerfile
@@ -9,10 +9,20 @@ RUN apk add --no-cache \
RUN pip3 install --break-system-packages conan
# preparation for sshd
-RUN ssh-keygen -A
-RUN mkdir /var/run/sshd \
- && ssh-keygen -f /root/.ssh/id_rsa -N "" \
- && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+RUN ssh-keygen -A \
+ && mkdir /var/run/sshd \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
+
+# create test user
+RUN addgroup -S test \
+ && adduser -S test -G test \
+ && echo "test:userpassword" | chpasswd \
+ && mkdir -p /home/test/.ssh \
+ && ssh-keygen -f /home/test/.ssh/id_rsa_test -N "keypassphrase" \
+ && cat /home/test/.ssh/id_rsa_test.pub >> /home/test/.ssh/authorized_keys \
+ && chown -R test:test /home/test \
+ && chown -R test:test /home/test/.ssh
# Build mscp as a single binary