Recognize password failures for BusyBox su (#87060)

* Allow root to use sudo on managed Alpine VMs

This fixes the become_su test on Alpine when running non-split.

* Remove test user sudoers file when removing the user

* Recognize password failures for BusyBox su
This commit is contained in:
Matt Clay
2026-06-03 13:46:08 -07:00
committed by GitHub
parent 9dfed16dae
commit 8b062bb267
6 changed files with 17 additions and 1 deletions
@@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Allow root to use sudo on managed Alpine instances.
@@ -0,0 +1,2 @@
bugfixes:
- su become plugin - Add recognition of password failure for BusyBox version of ``su``.
+4 -1
View File
@@ -104,7 +104,10 @@ class BecomeModule(BecomeBase):
pipelining = False
# messages for detecting prompted password issues
fail = ('Authentication failure',)
fail = (
'Authentication failure',
'incorrect password', # BusyBox
)
SU_PROMPT_LOCALIZATIONS = [
'Password',
@@ -5,3 +5,8 @@
remove: yes
force: yes
loop: "{{ delete_users }}"
- name: delete test user sudoers file
file:
path: '{{ sudoers_path ~ ".d/" ~ test_user_name }}'
state: absent
@@ -12,3 +12,4 @@
{{ test_user_name }} ALL=(ALL) {{"NOPASSWD: " if test_user_allow_sudo == "nopasswd" else ""}} ALL
mode: '0440'
dest: '{{ sudoers_path ~ ".d/" ~ test_user_name }}'
notify: delete test user sudoers file
@@ -230,6 +230,9 @@ bootstrap_remote_alpine()
&& break
retry_or_fail
done
# Allow root to use sudo to facilitate become testing as is done in other test environments.
echo "root ALL=(ALL) ALL" > /etc/sudoers.d/root
}
bootstrap_remote_fedora()