File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,9 +9,21 @@ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -b 4096 -f /etc/ssh/
99RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
1010RUN [ -f "/etc/ssh/ssh_host_ed25519_key" ] || ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
1111
12+ # Inject Kitchen's public key for SSH access (driver provides insecure_key.pub in build context)
13+ ADD insecure_key.pub /tmp/insecure_key.pub
14+ RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh && \
15+ touch /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys && \
16+ cat /tmp/insecure_key.pub >> /root/.ssh/authorized_keys
17+
1218# Create the kitchen user if missing (kept for parity with default kitchen-docker behavior)
1319RUN if ! getent passwd kitchen; then \
1420 useradd -d /home/kitchen -m -s /bin/bash -p '*' kitchen; \
1521 fi
1622
23+ # Allow SSH key login for the kitchen user as well
24+ RUN mkdir -p /home/kitchen/.ssh && chmod 700 /home/kitchen/.ssh && \
25+ touch /home/kitchen/.ssh/authorized_keys && chmod 600 /home/kitchen/.ssh/authorized_keys && \
26+ cat /tmp/insecure_key.pub >> /home/kitchen/.ssh/authorized_keys && \
27+ chown -R kitchen:kitchen /home/kitchen/.ssh
28+
1729
Original file line number Diff line number Diff line change @@ -9,9 +9,21 @@ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -b 4096 -f /etc/ssh/
99RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
1010RUN [ -f "/etc/ssh/ssh_host_ed25519_key" ] || ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ''
1111
12+ # Inject Kitchen's public key for SSH access (driver provides insecure_key.pub in build context)
13+ ADD insecure_key.pub /tmp/insecure_key.pub
14+ RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh && \
15+ touch /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys && \
16+ cat /tmp/insecure_key.pub >> /root/.ssh/authorized_keys
17+
1218# Create the kitchen user if missing (kept for parity with default kitchen-docker behavior)
1319RUN if ! getent passwd kitchen; then \
1420 useradd -d /home/kitchen -m -s /bin/bash -p '*' kitchen; \
1521 fi
1622
23+ # Allow SSH key login for the kitchen user as well
24+ RUN mkdir -p /home/kitchen/.ssh && chmod 700 /home/kitchen/.ssh && \
25+ touch /home/kitchen/.ssh/authorized_keys && chmod 600 /home/kitchen/.ssh/authorized_keys && \
26+ cat /tmp/insecure_key.pub >> /home/kitchen/.ssh/authorized_keys && \
27+ chown -R kitchen:kitchen /home/kitchen/.ssh
28+
1729
You can’t perform that action at this time.
0 commit comments