This section introduces you to the basics of policy scripting through a series of seven semi-interactive lessons. However, before you begin, please note: One Identity assumes you:
The first seven lessons introduce you to some of the simpler constructs and capabilities of Privilege Manager for Unix's policies. Each lesson is designed to allow you to run the policy files on your own test system, with minimal changes, enabling you to learn the basics of policy scripting quickly.
Following the seven basic lessons are three advanced lessons designed to extend your knowledge and understanding of creating policies.
Before you start the lessons
Before you start the lessons, you must install the example policy file. This procedure instructs you to create a temporary directory and then use the pmpolicy command with a checkout sub-command to checkout the current policy into the temporary directory you just created.
To install the main example policy file
# mkdir /tmp/policy
# /opt/quest/sbin/pmpolicy checkout -d /tmp/policy
** Validate options [ OK ] ** Checkout to /tmp/policy/policy_pmpolicy ** Create directory [ OK ] ** Check out working copy [ OK ] ** Copy files [ OK ] ** Perform syntax check [ OK ]
# cd /tmp/policy/policy_pmpolicy
#pmpolicy masterstatus ** Validate options [ OK ] ** Report details of production copy ** Check out working copy (HEAD revision) [ OK ] ** Check if directory contains a working copy [ OK ] - Directory contains an svn working copy:/var/opt/quest/qpm4u/pmpolicy/.scratch/._29076 ** Check current status of working copy [ OK ] ** Report details of production copy [ OK ] - Production Policy File : /etc/opt/quest/qpm4u/policy/pm.conf - Checked out at : 2012-11-30 16:23 - Current Revision : 1 - Latest Trunk Revision : 1 - Locally modified : NO
Copy the main example policy into place:
# cp /opt/quest/qpm4u/examples/pm.conf pm.conf cp: overwrite `pm.conf'? y
Policy file
This is the main policy file that Privilege Manager for Unix uses to drive through the lessons.
The other sample policy files for the lessons are also in the examples directory:
/opt/quest/qpm4u/examples/example1.conf /opt/quest/qpm4u/examples/example2.conf /opt/quest/qpm4u/examples/example3.conf /opt/quest/qpm4u/examples/example4.conf /opt/quest/qpm4u/examples/example5.conf /opt/quest/qpm4u/examples/example6.conf /opt/quest/qpm4u/examples/example7.conf /opt/quest/qpm4u/examples/example8.conf /opt/quest/qpm4u/examples/example9.conf /opt/quest/qpm4u/examples/example10.conf
# pmpolicy commit -d /tmp/policy
** Validate options [ OK ] ** Commit copy in directory:/tmp/policy/policy_pmpolicy ** Check directory [ OK ] ** Perform syntax check [ OK ] ** Verify files to commit [ OK ] Please enter the commit log message: example pm.conf ** Commit change form working copy [ OK ] ** Committed revision 2
# pmpolicy revert -r 1 ** Validate options [ OK ] ** Revert to revision:1 ** Check out working copy (trunk revision) [ OK ] ** Check out working copy (revision 1) [ OK ] ** Check required revision [ OK ] ** Get file list for trunk [ OK ] ** Get file list for selected revision [ OK ] ** Copy file:pm.conf [ OK ] ** Perform syntax check [ OK ] ** Verify files to commit [ OK ] Please enter the commit log message: revert to original ** Commit change from working copy [ OK ] ** Committed revision 3
See Main policy configuration file to see the example policy file used in these lessons.
For each lesson in this hands-on tutorial, you are required to log on as root and then switch to a test user. Then, at the conclusion of each lesson, switch back to root to get ready to start the next lesson.
To work through these lessons, you need to create users called demo, dan, and robyn on your test system, as the policy file is based around these default users.
To create the test users
Lessons 1-10 are controlled by an environment variable called LESSON. Set this to a number in the range 1 through 6, using the following command:
LESSON=1; export LESSON
The main policy file, pm.conf, reads the LESSON and LESSON_USER environment variables and assigns their values to the PMLESSON and PMLESSON_USER policy variables, respectively.
The following example instructs you to run a fictitious command, fred, under Lesson 1.
You use the pmrun command to submit commands to Privilege Manager for Unix. Try entering fred using pmrun.
To enter a fictitious command
# su demo $ pmrun fred
Lesson 1 is selected -------------LESSON 1 DESCRIPTION--------------------------- Policy file /opt/quest/pm4u/examples/linux-intel/example1.conf ------------------------------------------------------------ This basic lesson uses a policy allowing users dan and demo the rights to run any command as root. For example, to test this, enter the command pmrun whoami which will return the value root as the logged in user. ----------------------------------------------------------- fred 3201.063 Exec of fred failed: Command not found
As you can see, the policy informs you which lesson is selected and also provides the path to the associated policy file which contains this lesson fragment.
The policy files are reproduced in Sample policy files for your reference, but you are encouraged to look at the digital copies of these files and experiment with the constructs that they contain once you have completed the lessons.
© 2024 One Identity LLC. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center