Skip to content

fix: explicit env var passthrough for sudo on env_reset distros - #88

Merged
murilovarela merged 1 commit into
mainfrom
SW386/small-fix
Jun 15, 2026
Merged

fix: explicit env var passthrough for sudo on env_reset distros#88
murilovarela merged 1 commit into
mainfrom
SW386/small-fix

Conversation

@SW386

@SW386 SW386 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

On distros with env_reset in sudoers (like we've seen in Ubuntu 26.04 as reported: https://vanta.atlassian.net/browse/PER-10076), sudo -E does not reliably pass through VANTA_KEY, VANTA_OWNER_EMAIL, or VANTA_REGION. The env_reset policy strips the environment regardless of the -E flag, so the dpkg/rpm postinst script never sees the required variables and installation fails silently.

Solution

Replace sudo -E with plain sudo and explicitly forward only the required variables via sudo env VAR=value .... This sidesteps env_reset entirely — the variables are passed as arguments to env rather than inherited through sudo.

VANTA_NOSTART is forwarded conditionally using shell parameter expansion so it is only included when set.

Changes

  • install-linux.sh: Replace sudo -E with sudo and pass env vars explicitly to the install command

Fixes PER-10076

@SW386 SW386 changed the title fix: vanta agent scripts fix: explicit env var passthrough for sudo on env_reset distros Jun 12, 2026
@SW386
SW386 requested a review from anani112 June 12, 2026 16:32
@murilovarela
murilovarela merged commit 5eaf86d into main Jun 15, 2026
10 checks passed
@murilovarela
murilovarela deleted the SW386/small-fix branch June 15, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants