diff options
| author | Ryo Nakamura <upa@haeena.net> | 2024-02-06 10:35:38 +0900 |
|---|---|---|
| committer | Ryo Nakamura <upa@haeena.net> | 2024-02-06 10:35:38 +0900 |
| commit | ff45d9d71b85a618aed6d3d5e5056bada6ff81f9 (patch) | |
| tree | 8f5989f7f30f8e8a9320128617fa63e22115d65a /Dockerfile/ubuntu-20.04.Dockerfile | |
| parent | 9908fb309d9388481769e1a558a1f8dc47c4dabf (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/ubuntu-20.04.Dockerfile')
| -rw-r--r-- | Dockerfile/ubuntu-20.04.Dockerfile | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Dockerfile/ubuntu-20.04.Dockerfile b/Dockerfile/ubuntu-20.04.Dockerfile index a2dda99..5a75295 100644 --- a/Dockerfile/ubuntu-20.04.Dockerfile +++ b/Dockerfile/ubuntu-20.04.Dockerfile @@ -12,9 +12,19 @@ RUN python3 -m pip install pytest # preparation for sshd -RUN mkdir /var/run/sshd \ +RUN mkdir /var/run/sshd \ + && ssh-keygen -A \ && ssh-keygen -f /root/.ssh/id_rsa -N "" \ - && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys + && cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys + +# create test user +RUN useradd -m -d /home/test 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 ARG mscpdir="/mscp" |
