fix(images): let become work on molecule-ubuntu2604 and add gnupg
Build / build (pull_request) Successful in 30s
Molecule / molecule (pull_request) Failing after 1m4s
Lint / lint (pull_request) Successful in 1m56s

In the booted 26.04 container, pam_unix's account check for sudo runs
the unix_chkpwd helper, which fails there, so become from root fails
with "account validation failure". /etc/pam.d/sudo now lets root
through with pam_rootok before common-account; a non-root caller still
goes through pam_unix. The build fails if the line does not apply.

gnupg joins the image, as in the 24.04 image: the docker and gitea
scenarios need it on the target. The temporary diagnostics are removed.

Closes #376

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-25 21:42:58 +00:00
1 parent 5364f18728
commit efd3a550c5
3 files changed
+15 -26

No files matched your search

@@ -33,6 +33,7 @@
- ufw
- fail2ban
- openssh-server
- gnupg
- name: Query the units a role scenario relies on
ansible.builtin.systemd:
@@ -57,27 +58,6 @@
ansible.builtin.command: iptables -S
changed_when: false
# TEMPORARY diagnostics for #376; removed before review.
- name: "DIAG #376: test the cause and the candidate fix without become"
ansible.builtin.shell: |
set -o pipefail
echo "== status: $(grep -E '^(Seccomp|Seccomp_filters|NoNewPrivs|CapEff)' /proc/self/status | tr '\t\n' ' ')"
echo "== unix_chkpwd root chkexpiry:"; /usr/sbin/unix_chkpwd root chkexpiry </dev/null; echo "rc=$?"
echo "== sudo before:"; sudo -n -u root true; echo "rc=$?"
sed -i '0,/^@include common-account/s//account sufficient pam_rootok.so\n@include common-account/' /etc/pam.d/sudo
echo "== pam.d/sudo account lines:"; grep -E '^(account|@include common-account)' /etc/pam.d/sudo
echo "== sudo after pam_rootok:"; sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS' </dev/null; echo "rc=$?"
echo "== journal:"; journalctl --no-pager -o short-iso -n 20 SYSLOG_FACILITY=10 | tail -20
args:
executable: /bin/bash
changed_when: false
failed_when: false
register: kamino_diag_376
- name: "DIAG #376: show the result"
ansible.builtin.debug:
var: kamino_diag_376.stdout_lines
- name: Run a task with become, as the role scenarios do
ansible.builtin.command: id -u
become: true