test(images): try pam_rootok for become on 26.04 (temporary diagnostics)
Assisted-by: Claude Code
This commit is contained in:
1 parent
62ffae7764
commit
5364f18728
1 file changed
+9
-21
@@ -58,28 +58,16 @@
|
||||
changed_when: false
|
||||
|
||||
# TEMPORARY diagnostics for #376; removed before review.
|
||||
- name: "DIAG #376: enable sudo debug logging"
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sudo.conf
|
||||
content: "Debug sudo /var/log/sudo_debug.log all@debug\n"
|
||||
mode: "0644"
|
||||
|
||||
- name: "DIAG #376: collect account and sudo state without become"
|
||||
- name: "DIAG #376: test the cause and the candidate fix without become"
|
||||
ansible.builtin.shell: |
|
||||
set +e
|
||||
echo "== id: $(id)"; echo "== loginuid: $(cat /proc/self/loginuid)"
|
||||
echo "== getent passwd root: $(getent passwd root)"
|
||||
echo "== getent shadow root (fields): $(getent shadow root | awk -F: '{print $1":"(($2 ~ /^[!*]/)?$2:"<hash>")":"$3":"$4":"$5":"$6":"$7":"$8}')"
|
||||
echo "== files shadow root (fields): $(awk -F: '$1=="root"{print $1":"(($2 ~ /^[!*]/)?$2:"<hash>")":"$3":"$4":"$5":"$6":"$7":"$8}' /etc/shadow)"
|
||||
echo "== ls shadow:"; ls -l --time-style=full-iso /etc/shadow /etc/passwd
|
||||
echo "== nsswitch:"; grep -E '^(passwd|group|shadow)' /etc/nsswitch.conf
|
||||
echo "== date: $(date -u) days: $(( $(date +%s) / 86400 ))"
|
||||
echo "== systemd: $(systemctl --version | head -1); state: $(systemctl is-system-running)"
|
||||
echo "== sudo -n -u root true:"; sudo -n -u root true; echo "rc=$?"
|
||||
echo "== sudo -H -S -n -u root sh -c echo:"; sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS' </dev/null; echo "rc=$?"
|
||||
echo "== sudo debug (pam/acct/auth):"; grep -iE 'pam|acct|account|auth|uid' /var/log/sudo_debug.log | grep -v -i 'password=' | tail -60
|
||||
echo "== journal sudo/pam:"; journalctl --no-pager -o short-iso -n 40 _COMM=sudo _COMM=sudo.ws 2>&1 | tail -40
|
||||
echo "== journal (auth, last 40):"; journalctl --no-pager -o short-iso -n 40 SYSLOG_FACILITY=10 2>&1 | tail -40
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user