Sudo Mastery: User Access Control for Real People (IT Mastery Book 3) by Michael W Lucas
Author:Michael W Lucas [Lucas, Michael W]
Language: eng
Format: mobi
Publisher: Tilted Windmill Press
Published: 2013-11-14T03:00:00+00:00
Environment Customization
A sudo policy can do more than just allow and disallow environment variables; it can explicitly set variables. Sudoers policies let you set the user's path, and you can also set arbitrary environment variables if needed.
Managing $PATH
One environment variable is a little trickier than most. Many intruders try to sabotage a user's $PATH, so that the user will run a bogus version of commands rather than the proper one. If a helpdesk flunky needs to reset a user's password, but he runs the program /tmp/.1234/hacker/passwd rather than /usr/bin/passwd, bad things will happen. Use the secure_path option to define your trusted path for sudo commands.
Defaults secure_path="/bin /usr/bin /sbin /usr/sbin"
Sudo tries to run the command using the secure path. If the command isn't in the secure path, it fails.
This affects commands run via sudo, but not shell instances started via sudo. If you start a full interactive shell, the shell reads the target user's .profile and other shell startup files as it initializes the environment. Secure paths help when running sudo like this:
$ sudo passwd mike
In this use case, secure_path makes sure that the passwd command being run is actually the system's passwd command and not an intruder's customized copy. It doesn't verify that the sudo command the user run is the proper one, however, so users still need to take care of their $PATH.
Adding Environment Variables
Sometimes you want to specifically set environment variables for a privileged user. Use the env_file option to give the full path to a file containing the new environment variables. One common situation is when you're behind a proxy server. You want users to always access the internet via your proxy? Add the environment variables to their environment.
Defaults env_file="/etc/sudoenv"
The environment file contains a standard list of variable assignments, like so.
FTP_PROXY=http://proxyhost:8080
ftp_proxy=http://proxyhost:8080
HTTP_PROXY=http:// proxyhost:8080
http_proxy=http:// proxyhost:8080
Sudo adds these environment variables before stripping out the environment, so list any added variables in an env_keep sudoers rule as well. This also means you override the user's own environment variables, so if a user has a different setting you've just replaced it.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Effective Threat Investigation for SOC Analysts by Yahia Mostafa;(6581)
Practical Memory Forensics by Svetlana Ostrovskaya & Oleg Skulkin(6302)
Machine Learning Security Principles by John Paul Mueller(6273)
Attacking and Exploiting Modern Web Applications by Simone Onofri & Donato Onofri(5948)
Operationalizing Threat Intelligence by Kyle Wilhoit & Joseph Opacki(5908)
Solidity Programming Essentials by Ritesh Modi(4044)
Microsoft 365 Security, Compliance, and Identity Administration by Peter Rising(3683)
Operationalizing Threat Intelligence by Joseph Opacki Kyle Wilhoit(3413)
Future Crimes by Marc Goodman(3351)
Mastering Python for Networking and Security by José Manuel Ortega(3349)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3337)
Blockchain Basics by Daniel Drescher(3305)
Learn Computer Forensics - Second Edition by William Oettinger(3173)
Incident Response with Threat Intelligence by Roberto MartÃnez(2899)
Mobile App Reverse Engineering by Abhinav Mishra(2887)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2873)
The Code Book by Simon Singh(2832)
From CIA to APT: An Introduction to Cyber Security by Edward G. Amoroso & Matthew E. Amoroso(2783)
Building a Next-Gen SOC with IBM QRadar: Accelerate your security operations and detect cyber threats effectively by Ashish M Kothekar(2764)
