fix: copy entrypoint into quest container. Disable mounting for entrypoint & public key. Use Env to pass ssh public key into container.

This commit is contained in:
Justin Lin committed 2024-10-21 11:54:32 +08:00
1 parent 860b257ea7
commit 1888781a47
5 files changed
+32 -23

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ RUN rm -f /etc/motd /etc/issue /etc/issue.net /etc/update-motd.d/*
RUN rm -rf /etc/skel && mkdir -p /etc/skel
RUN mkdir -p /etc/ssh/authorized_keys && chmod 755 /etc/ssh/authorized_keys
COPY ./quests/.includes/sshd_config /etc/ssh/sshd_config
COPY ./quests/entrypoint.sh /entrypoint.sh
EXPOSE 22
+4 -3
View File
@@ -10,9 +10,10 @@ if ! id -u ${USERNAME} >/dev/null 2>&1; then
find / -name ".gitkeep" -type f -exec rm -f {} +
echo "Adding public key for $USERNAME"
PUB_KEY=/etc/ssh/authorized_keys/${USERNAME}
cp /ssh_key.pub ${PUB_KEY}
chmod 644 ${PUB_KEY}
echo "Public key: $PUB_KEY"
PUB_KEY_PATH=/etc/ssh/authorized_keys/${USERNAME}
echo $PUB_KEY > ${PUB_KEY_PATH}
chmod 644 ${PUB_KEY_PATH}
fi
mkdir -p /run/sshd