]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-74-AUX-UTILS: Support credential-provided root SSH public key
authorRichard Maw <richard.maw@codethink.co.uk>
Thu, 22 Feb 2024 13:01:13 +0000 (13:01 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 May 2024 08:58:24 +0000 (10:58 +0200)
When root authorized keys are provided by mkosi they are not
newline-terminated so appending a public key to the file results
in a corrupt key, so just to be safe we add an empty line.

test/units/testsuite-74.ssh.sh

index 70fb9ce56cace70b71ff89144c45ce3bec82d865..5d87d9f7acd3b185f4da340a4cf9bd0f74dc0c1b 100755 (executable)
@@ -32,7 +32,9 @@ removesshid() {
 ssh-keygen -N '' -C '' -t rsa -f "$ROOTID"
 
 mkdir -p 0700 /root/.ssh
-cat "$ROOTID".pub >> /root/.ssh/authorized_keys
+# Add a newline in case authorized_keys wasn't terminated correctly.
+echo >>/root/.ssh/authorized_keys
+cat "$ROOTID".pub >>/root/.ssh/authorized_keys
 
 # set root pw to "foo", just to set it to something valid
 # shellcheck disable=SC2016