jjb: Enable the use of .ssh/authorized_keys2 when building images
authorKienan Stewart <kstewart@efficios.com>
Wed, 28 Feb 2024 14:03:24 +0000 (09:03 -0500)
committerKienan Stewart <kstewart@efficios.com>
Thu, 29 Feb 2024 12:15:48 +0000 (07:15 -0500)
Change-Id: If4e760db7562c197056ba1996576688eea74e838
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
pipelines/images/imagebuild.sh

index 45632c0514c365dd0811a5eac196c5c5158825c8..befc9bf0fb2f1e302b0901f486f9246c686b71ae 100644 (file)
@@ -173,6 +173,10 @@ CLEANUP+=(
     "rm -f ${HOME}/.ssh/id_rsa"
 )
 lxc file push ~/.ssh/id_rsa.pub "ci:${INSTANCE_NAME}/root/.ssh/authorized_keys2"
+# Some distros, eg. Rocky Linux, don't enable the use of authorized_keys2
+# by default
+lxc exec "ci:${INSTANCE_NAME}" -- bash -c 'if test -f /etc/redhat-release ; then sed -i "s#^AuthorizedKeysFile.*#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2#" /etc/ssh/sshd_config ; systemctl restart sshd ; fi'
+
 
 # Confirm working SSH connection
 if ! ssh "${INSTANCE_IP}" hostname ; then
This page took 0.024042 seconds and 4 git commands to generate.