diff --git a/internal/proxmox/bootstrap.go b/internal/proxmox/bootstrap.go index c564fe6..7e9f857 100644 --- a/internal/proxmox/bootstrap.go +++ b/internal/proxmox/bootstrap.go @@ -449,9 +449,9 @@ func sudoersContent(user string) string { # pvesh is EXCLUDED (AD-020: pvesh can bypass NOEXEC via API execute). %s ALL=(root) NOPASSWD: NOEXEC: /usr/bin/pct %s ALL=(root) NOPASSWD: NOEXEC: /usr/bin/qm -%s ALL=(root) NOPASSWD: NOEXEC: /usr/bin/apt-get -%s ALL=(root) NOPASSWD: NOEXEC: /usr/bin/dpkg -`, user, user, user, user) + + +`, user, user) } // writeSudoers writes the /etc/sudoers.d/orca file on the remote host diff --git a/internal/proxmox/bootstrap_test.go b/internal/proxmox/bootstrap_test.go index 73b10ae..8499ae1 100644 --- a/internal/proxmox/bootstrap_test.go +++ b/internal/proxmox/bootstrap_test.go @@ -33,17 +33,11 @@ func TestSudoersContent(t *testing.T) { t.Error("missing NOEXEC on qm (AD-020)") } - if !strings.Contains(content, "NOPASSWD: /usr/bin/apt-get") { - t.Error("missing NOPASSWD on apt-get") + if strings.Contains(content, "apt-get") { + t.Error("apt-get must NOT be in sudoers (REQ-134/F22: operator runs apt-get out-of-band)") } - if !strings.Contains(content, "NOPASSWD: /usr/bin/dpkg") { - t.Error("missing NOPASSWD on dpkg") - } - if strings.Contains(content, "NOEXEC: /usr/bin/apt-get") { - t.Error("apt-get must NOT have NOEXEC (breaks maintainer scripts)") - } - if strings.Contains(content, "NOEXEC: /usr/bin/dpkg") { - t.Error("dpkg must NOT have NOEXEC (breaks maintainer scripts)") + if strings.Contains(content, "dpkg") { + t.Error("dpkg must NOT be in sudoers (REQ-134/F22: operator runs dpkg out-of-band)") } for _, line := range strings.Split(content, "\n") {