From da55a259c9eb742f67f230d0592ea459f4876aa1 Mon Sep 17 00:00:00 2001 From: jmac774 <104130511+jmac774@users.noreply.github.com> Date: Tue, 18 Oct 2022 18:51:15 +0200 Subject: [PATCH] Fix T1098.004 (#2193) Fix for systems with multiple authorized keys. Without quotes, the echo command separates new lines with space instead of new line character which breaks authorized_keys file in case there are multiple keys in the file. --- atomics/T1098.004/T1098.004.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomics/T1098.004/T1098.004.yaml b/atomics/T1098.004/T1098.004.yaml index 78783a05..af04208c 100644 --- a/atomics/T1098.004/T1098.004.yaml +++ b/atomics/T1098.004/T1098.004.yaml @@ -15,6 +15,6 @@ atomic_tests: name: bash elevation_required: false command: | - if [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo $ssh_authorized_keys > ~/.ssh/authorized_keys; fi; + if [ -f ~/.ssh/authorized_keys ]; then ssh_authorized_keys=$(cat ~/.ssh/authorized_keys); echo "$ssh_authorized_keys" > ~/.ssh/authorized_keys; fi; cleanup_command: | unset ssh_authorized_keys