Bug 56579 - pam_runasroot does not pass environment to execl
pam_runasroot does not pass environment to execl
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: PAM
UCS 5.2
Other Linux
: P5 normal (vote)
: UCS 5.0-5-errata
Assigned To: Juan Carlos
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-13 13:31 CEST by Juan Carlos
Modified: 2023-10-18 16:20 CEST (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juan Carlos univentionstaff 2023-09-13 13:31:05 CEST
A change in sudo (from version 1.9.4, commit https://github.com/sudo-project/sudo/commit/7d0b19d2a0236ff50f8e8253ba86e1672399ae52 ) causes that when invoking this pam module, when setenv is used, the target for it is the private sudo environment instead of the local environ pointer. For that reason, when a program is invoked with execl, the state of the environment variables in the target program is the original one, without the setenv operation having any apparent effect. 

Because the environment modifications used in pam_runasroot are used only for the invoked processes and do not need to be preserved afterwards, the execle function can be used together with a local pointer for the environment variables.
Comment 2 Juan Carlos univentionstaff 2023-10-17 07:41:22 CEST
Cherry-picked to 5.0-5:

Change:

Don't use setenv function to modify environment variables and use execle with a local pointer instead for compatibility with sudo >= 1.9.4

Commits:

pam-runasroot (11.0.0-2)
39caebc730d8 | fix(pam_runasroot): fix setting of environment variables due to sudo API change


New package version:

Package: pam-runasroot
Version: 11.0.0-2
Branch: ucs_5.0-0
Scope: errata5.0-5
Comment 3 Florian Best univentionstaff 2023-10-17 16:04:19 CEST
OK: env variables passed explicitly, no need to set them for the current process, only for the subprocess
OK: code review
OK: Advisory
Comment 4 Iván.Delgado univentionstaff 2023-10-18 16:20:28 CEST
<https://errata.software-univention.de/#/?erratum=5.0x844>