From efd3a550c5770e671596b37841a28a0e5a9a6262 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Wed, 25 Nov 2026 21:42:58 +0000 Subject: [PATCH] fix(images): let become work on molecule-ubuntu2604 and add gnupg 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 --- docs/images/molecule-ubuntu2604.md | 4 +++- .../molecule/image-smoke-2604/verify.yml | 22 +------------------ images/molecule-ubuntu2604/Dockerfile | 15 +++++++++---- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/docs/images/molecule-ubuntu2604.md b/docs/images/molecule-ubuntu2604.md index f6e449c..b7d8044 100644 --- a/docs/images/molecule-ubuntu2604.md +++ b/docs/images/molecule-ubuntu2604.md @@ -12,7 +12,9 @@ It is the release the hosts are moving to; the roles are tested on it next to 24 `ca-certificates`. - Python for Ansible on the target: `python3`, `python3-apt`, `python3-systemd`. - The packages the roles manage, preinstalled so a converge makes no network calls: - `iptables`, `ufw`, `fail2ban`, `openssh-server` (the `ssh` unit is enabled). + `iptables`, `ufw`, `fail2ban`, `openssh-server` (the `ssh` unit is enabled), and `gnupg` + (the docker scenario signs its stand-in APT repository with it). +- root's `sudo` skips the PAM account check (`pam_rootok`), so `become` works in the container. - Throwaway SSH host keys and a machine-id generated at build time. They are not secrets and the image is a test target that must never be exposed to a network. diff --git a/extensions/molecule/image-smoke-2604/verify.yml b/extensions/molecule/image-smoke-2604/verify.yml index 51db9bf..a45cb09 100644 --- a/extensions/molecule/image-smoke-2604/verify.yml +++ b/extensions/molecule/image-smoke-2604/verify.yml @@ -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