summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-12 14:07:40 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-12 14:08:14 +0200
commita91180af23f4a6287607beb82464c8b82e49c7bc (patch)
tree338f7c7598cd85fa3574add940df1a93be9b9847
parent87e374fd35185d75485658db8dd5baf4f3d8003a (diff)
downloadalpine-conf-a91180af23f4a6287607beb82464c8b82e49c7bc.zip
tests: setup-user: test permissions of authorized_keys
follow up to commit dfd40992e173 (setup-sshd, setup-user: follow openssh permission recommendations)
-rwxr-xr-xtests/setup_user_test8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/setup_user_test b/tests/setup_user_test
index 03dd601..9d660d9 100755
--- a/tests/setup_user_test
+++ b/tests/setup_user_test
@@ -117,8 +117,10 @@ setup_user_interactive_suggest_ssh_body() {
-o match:"adduser.* -g FullName .*testuser" \
-e empty \
setup-user <answers
- grep "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
+ grep -x "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
|| atf_fail "ssh key not fetched from alpinelinux"
+ atf_check -o match:"^600$" \
+ stat -c "%a" home/testuser/.ssh/authorized_keys
}
setup_user_groups_commas_body() {
@@ -157,8 +159,10 @@ setup_user_keys_opt_body() {
atf_check -s exit:0 \
-o match:"adduser.* -D .*testuser" \
setup-user -k https://gitlab.alpinelinux.org/user.keys testuser
- grep "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
+ grep -x "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
|| atf_fail "ssh key not fetched from alpinelinux"
+ atf_check -o match:"^600$" \
+ stat -c "%a" home/testuser/.ssh/authorized_keys
}
setup_user_unlock_body() {