0

I'm experiencing some strange behaviour.

My sudoers file is very short and looks like this :

Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root    ALL=(ALL:ALL) ALL
%admin ALL=(ALL) ALL
%sudo   ALL=(ALL:ALL) ALL

(Note, that's Ubuntu 13.10 with a backported 3.12 kernel)

With this sudoers, when I do sudo env I get almost all my unprivilegied user's environnement, including http_proxy and https_proxy. Now if I append this line to the file, the environnement gets stripped as hell :

Defaults env_keep="http_proxy"

My bet is that there is a default value for env_keep that hold most of what's set in my environnement and that defining it without env_keep+= erases it.

Or that's a sudo bug I should submit ?

0

After troubleshooting and discussing isue with Bob on the Root Access chat, we've found at that indeed, env_keep has undocumented default values.

Extract from sudo's manpage:

     -V          The -V (version) option causes sudo to print its version string and the ver‐
                 sion string of the security policy plugin and any I/O plugins.  If the invok‐
                 ing user is already root the -V option will display the arguments passed to
                 configure when sudo was built and plugins may display more verbose informa‐
                 tion such as default options.
user@host $: sudo sudo -V : 
[...]
Environment variables to preserve: 
XAUTHORIZATION 
XAUTHORITY 
TZ 
PS2 
PS1 
PATH 
LS_COLORS 
KRB5CCNAME 
HOSTNAME 
HOME 
DISPLAY 
COLORS
[...]

If you set env_keep without appending to it, it will override those values. So use Defaults env_keep +="values"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.