summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Hanley <nicholasjhanley@gmail.com>2022-07-12 23:25:21 -0400
committerNick Hanley <nicholasjhanley@gmail.com>2022-07-12 23:36:01 -0400
commit2d8899bb38173c60d5ea7377f0970919874d77c9 (patch)
tree9c198c492b61a57f90ec133cfa3ce253a152799d
parent25702cd8d3d5c236f4a7b430eb5eae1f05985913 (diff)
downloadalpine-conf-2d8899bb38173c60d5ea7377f0970919874d77c9.zip
tests: setup-sshd, setup-user: test ssh dir permissions
Follow up to the follow up (87e374fd, a91180af). Commit dfd40992 also affects ~/.ssh, so test its permissions too.
-rwxr-xr-xtests/setup_sshd_test4
-rwxr-xr-xtests/setup_user_test4
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index f2677ad..3d62f62 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -48,6 +48,8 @@ setup_sshd_openssh_body() {
|| atf_fail "failed to wget ssh key"
# check that permissions are set properly
+ atf_check -o match:"^700$" \
+ stat -c '%a' root/.ssh
atf_check -o match:"^600$" \
stat -c '%a' root/.ssh/authorized_keys
}
@@ -154,6 +156,8 @@ setup_sshd_openssh_ssh_key_body() {
|| atf_fail "did not add ssh key"
# check that permissions are set properly
+ atf_check -o match:"^700$" \
+ stat -c '%a' root/.ssh
atf_check -o match:"^600$" \
stat -c '%a' root/.ssh/authorized_keys
}
diff --git a/tests/setup_user_test b/tests/setup_user_test
index 9d660d9..2211f67 100755
--- a/tests/setup_user_test
+++ b/tests/setup_user_test
@@ -119,6 +119,8 @@ setup_user_interactive_suggest_ssh_body() {
setup-user <answers
grep -x "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
|| atf_fail "ssh key not fetched from alpinelinux"
+ atf_check -o match:"^700$" \
+ stat -c "%a" home/testuser/.ssh
atf_check -o match:"^600$" \
stat -c "%a" home/testuser/.ssh/authorized_keys
}
@@ -161,6 +163,8 @@ setup_user_keys_opt_body() {
setup-user -k https://gitlab.alpinelinux.org/user.keys testuser
grep -x "$WGETCONTENT" home/testuser/.ssh/authorized_keys \
|| atf_fail "ssh key not fetched from alpinelinux"
+ atf_check -o match:"^700$" \
+ stat -c "%a" home/testuser/.ssh
atf_check -o match:"^600$" \
stat -c "%a" home/testuser/.ssh/authorized_keys
}