Skip to content

Commit 04d6f5c

Browse files
committed
test
1 parent 7b49117 commit 04d6f5c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

kitchen/dockerfiles/centos9.Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -b 4096 -f /etc/ssh/
99
RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
1010
RUN [ -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)
1319
RUN 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

kitchen/dockerfiles/rocky9.Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@ RUN [ -f "/etc/ssh/ssh_host_rsa_key" ] || ssh-keygen -t rsa -b 4096 -f /etc/ssh/
99
RUN [ -f "/etc/ssh/ssh_host_ecdsa_key" ] || ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ''
1010
RUN [ -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)
1319
RUN 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

0 commit comments

Comments
 (0)