Chat now with support
Chat with Support

Safeguard for Sudo 2.0 - Administrators Guide

One Identity Privileged Access Suite for Unix Introducing Privilege Manager for Unix Introducing Privilege Manager for Sudo Planning Deployment Installation and Configuration
Download Privilege Manager for Unix Software Packages Download Privilege Manager for Sudo Software Packages Quick Start and Evaluation Configure a Primary Policy Server Configure a Secondary Policy Server Install PM Agent or Sudo Plugin on a Remote Host Remove Configurations
Upgrading Privilege Manager System Administration Managing Security Policy The Privilege Manager for Unix Security Policy Advanced Privilege Manager for Unix Configuration Administering Log and Keystroke Files InTrust Plug-in for Privilege Manager Troubleshooting Privilege Manager for Unix Policy File Components Privilege Manager Variables Privilege Manager for Unix Flow Control Statements Privilege Manager for Unix Built-in Functions and Procedures Privilege Manager Programs Installation Packages Unsupported Sudo Options Sudo Plugin Policy Evaluation About us

Introductory Lessons

The first seven lesson introduce you to some of the simpler constructs and capabilities of Privilege Manager's policies. Each lesson builds upon the precepts of the last lesson. By the end of the seventh lesson you will have sufficient knowledge to start building your own policies.

These are the introductory lessons:

Lesson 1: Basic Policy

This lesson introduces the basic concept of running a command at a privileged level. For a given list of users (in this case, dan and your defined LESSON_USER), run the command as root.

Here is the relevant policy code:

if (user=="dan" || user==PMLESSON_USER) { 

If the policy server evaluates the policy without reaching an explicit "accept" statement, the request is rejected.

Be sure to:

  • Set the LESSON variable to 1.
  • Switch to your test user.
  • Enter the command pmrun whoami.

NOTE: Text in bold represents commands you enter; the resulting output is shown in normal font. The command output for the pmrun commands below has been slightly modified for brevity.

# LESSON=1; export LESSON 
# su demo 
$ whoami 
$ pmrun whoami 
$ exit

As you can see the result of the whoami command without a pmrun prefix shows that you are logged in as user demo. Repeating the command with a pmrun prefix, shows that you executed the command as root.

Here is the policy code that implements this behavior:

if (user=="dan" || user==PMLESSON_USER) { 

If the user who submitted the pmrun request matches either "dan" or the PMLESSON_USER variable, the runuser is set to "root" and the request is accepted.

The exit command at the end returns you to the root shell before proceeding to the next lesson.

Refer to Lesson 1 Sample: Basic Policy to see the sample policy used in this lesson.

Lesson 2: Conditional Privilege

This lesson builds upon the previous lesson by narrowing the conditions under which you can execute the commands as root. It introduces the use of a policy variable, dayname, and the function, timebetween(), to ensure that you can only execute commands within the predetermined time frame of typical office hours (weekdays, between 8:00 a.m. and 5:00 p.m.).

The dayname variable and the timebetween() policy function are used to reject requests outside office hours:

if(dayname=="Sat" || dayname=="Sun" || !timebetween(800,1700)) 

This lesson assumes that the current date and time are within this time frame.

# LESSON=2; export LESSON 
# su demo

Now, change the system date and attempt the command again using the following commands:

$ pmrun date mmdd2100 
Thu Feb 26 21:00:00 EDT 2012 
$ pmrun date mmdd2100 
Request Rejected by pmmasterd on UPMhost 
$ exit


  • mm stands for month (for example, 03 for March)
  • dd stands for day (10 for the 10th)

NOTE: The output shown above illustrates that the first attempt to set the date succeeded because the system date was within normal office hours. The second attempt fails because the time is now set outside of normal office hours.

Remember to reset the correct time on your system by running the date command as the root user.

Refer to Lesson 2 Sample: Conditional Privilege to see the sample policy used in this lesson.

Lesson 3: Specific Commands

This lesson narrows the scope of which commands you can execute with root privilege. The permitted list of commands is ls, hostname and kill. Any other attempt to execute a privileged command is rejected.

The "command" variable stores the command name issued by pmrun:

if (command == "ls" || command == "hostname" || command == "kill") { 
   runuser = "root"; 
# LESSON=3; export LESSON 
# su demo 
$ pmrun shutdown 
Request Rejected by pmmasterd on <UPMhost> 
$ pmrun hostname 
$ exit

where UPMhost is the host name

Refer to Lesson 3 Sample: Specific Commands to see the sample policy used in this lesson.

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating