mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-14 19:02:45 +03:00
Extra test for cloud-config doas when adding extra users to default.
This commit is contained in:
parent
3e44e41603
commit
f91de06fee
@ -8,11 +8,12 @@ test-default:
|
||||
- docker-alpine
|
||||
- x86_64
|
||||
|
||||
test-dash:
|
||||
extends: test-default
|
||||
before_script:
|
||||
- apk add dash
|
||||
- ln -sf /usr/bin/dash /bin/sh
|
||||
# disabled - 0.13.1 has globbing bug
|
||||
#test-dash:
|
||||
# extends: test-default
|
||||
# before_script:
|
||||
# - apk add dash
|
||||
# - ln -sf /usr/bin/dash /bin/sh
|
||||
|
||||
test-oksh:
|
||||
extends: test-default
|
||||
|
||||
@ -178,9 +178,11 @@ init__create_default_user() {
|
||||
echo '%wheel ALL=(ALL) NOPASSWD: ALL' > "$ETC/sudoers.d/wheel"
|
||||
fi
|
||||
if [ -d "$ETC/doas.d" ]; then
|
||||
echo 'permit nopass :wheel' > "$TARGET/etc/doas.d/wheel.conf"
|
||||
echo 'permit nopass :wheel' > "$ETC/doas.d/wheel.conf"
|
||||
#echo 'permit nopass :wheel' > "$TARGET/etc/doas.d/wheel.conf"
|
||||
elif [ -f "$ETC/doas.conf" ]; then
|
||||
add_once "$TARGET/etc/doas.conf" "permit nopass :wheel"
|
||||
add_once "$ETC/doas.conf" "permit nopass :wheel"
|
||||
#add_once "$TARGET/etc/doas.conf" "permit nopass :wheel"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ init_tests \
|
||||
userdata_users_groups \
|
||||
userdata_users_lock_passwd \
|
||||
userdata_users_doas \
|
||||
userdata_users_doas_with_default \
|
||||
userdata_users_ssh_authorized_keys \
|
||||
userdata_ssh_authorized_keys \
|
||||
userdata_groups \
|
||||
@ -420,6 +421,26 @@ userdata_users_doas_body() {
|
||||
|| atf_fail "etc/doas.d/foo.conf is not as expected"
|
||||
}
|
||||
|
||||
userdata_users_doas_with_default_body() {
|
||||
# first specified user keeps the default user
|
||||
fake_userdata_nocloud <<-EOF
|
||||
#cloud-config
|
||||
users:
|
||||
- default
|
||||
- name: foo
|
||||
doas: ["permit nopass foo"]
|
||||
EOF
|
||||
mkdir -p etc/doas.d
|
||||
atf_check -e ignore -o ignore tiny-cloud early
|
||||
atf_check \
|
||||
-e match:"userdata_users: done" \
|
||||
-o ignore \
|
||||
tiny-cloud main
|
||||
find .
|
||||
grep "permit nopass foo" etc/doas.d/foo.conf \
|
||||
|| atf_fail "etc/doas.d/foo.conf is not as expected"
|
||||
}
|
||||
|
||||
userdata_users_ssh_authorized_keys_body() {
|
||||
fake_bin getent <<-EOF
|
||||
#!/bin/sh
|
||||
@ -923,4 +944,3 @@ userdata_autoinstall_lvm_body() {
|
||||
-o match:"reboot" \
|
||||
tiny-cloud final
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user