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
|
- docker-alpine
|
||||||
- x86_64
|
- x86_64
|
||||||
|
|
||||||
test-dash:
|
# disabled - 0.13.1 has globbing bug
|
||||||
extends: test-default
|
#test-dash:
|
||||||
before_script:
|
# extends: test-default
|
||||||
- apk add dash
|
# before_script:
|
||||||
- ln -sf /usr/bin/dash /bin/sh
|
# - apk add dash
|
||||||
|
# - ln -sf /usr/bin/dash /bin/sh
|
||||||
|
|
||||||
test-oksh:
|
test-oksh:
|
||||||
extends: test-default
|
extends: test-default
|
||||||
|
|||||||
@ -178,9 +178,11 @@ init__create_default_user() {
|
|||||||
echo '%wheel ALL=(ALL) NOPASSWD: ALL' > "$ETC/sudoers.d/wheel"
|
echo '%wheel ALL=(ALL) NOPASSWD: ALL' > "$ETC/sudoers.d/wheel"
|
||||||
fi
|
fi
|
||||||
if [ -d "$ETC/doas.d" ]; then
|
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
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@ init_tests \
|
|||||||
userdata_users_groups \
|
userdata_users_groups \
|
||||||
userdata_users_lock_passwd \
|
userdata_users_lock_passwd \
|
||||||
userdata_users_doas \
|
userdata_users_doas \
|
||||||
|
userdata_users_doas_with_default \
|
||||||
userdata_users_ssh_authorized_keys \
|
userdata_users_ssh_authorized_keys \
|
||||||
userdata_ssh_authorized_keys \
|
userdata_ssh_authorized_keys \
|
||||||
userdata_groups \
|
userdata_groups \
|
||||||
@ -420,6 +421,26 @@ userdata_users_doas_body() {
|
|||||||
|| atf_fail "etc/doas.d/foo.conf is not as expected"
|
|| 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() {
|
userdata_users_ssh_authorized_keys_body() {
|
||||||
fake_bin getent <<-EOF
|
fake_bin getent <<-EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
@ -923,4 +944,3 @@ userdata_autoinstall_lvm_body() {
|
|||||||
-o match:"reboot" \
|
-o match:"reboot" \
|
||||||
tiny-cloud final
|
tiny-cloud final
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user