지금 지원 담당자와 채팅
지원 담당자와 채팅

Privilege Manager for Unix 7.0 - Administration Guide

Introducing Privilege Manager for Unix Planning Deployment Installation and Configuration Upgrade Privilege Manager for Unix 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 for Unix Troubleshooting Privilege Manager for Unix Policy File Components Privilege Manager for Unix Variables
Variable names Variable scope Global input variables Global output variables Global event log variables PM settings variables
Privilege Manager for Unix Flow Control Statements Privilege Manager for Unix Built-in Functions and Procedures
Environment functions Hash table functions Input and output functions LDAP functions LDAP API example List functions Miscellaneous functions Password functions Remote access functions String functions User information functions Authentication Services functions
Privilege Manager for Unix programs Installation Packages

Introductory lessons

The first seven lesson introduce you to some of the simpler constructs and capabilities of Privilege Manager for Unix'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) { 
runuser="root"; 
accept; 
}

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.

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_USER=demo; export LESSON_USER 
# LESSON=1; export LESSON 
# su demo 
$ whoami 
demo 
$ pmrun whoami 
root 
$ 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 ran the command as root.

Here is the policy code that implements this behavior:

if (user=="dan" || user==PMLESSON_USER) { 
runuser="root"; 
accept; 
}

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 run the commands as root. It introduces the use of a policy variable, dayname, and the function, timebetween(), to ensure that you can only run 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)) 
   reject;

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

where:

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

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 run with root privilege. The permitted list of commands is ls, hostname, and kill. Any other attempt to run a privileged command is rejected.

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

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

where <UPMhost> is the host name

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

관련 문서

The document was helpful.

평가 결과 선택

I easily found the information I needed.

평가 결과 선택