Chat now with support
Chat with Support

Privilege Manager for Unix 7.1 - 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

function

Syntax
function ( parameter = expression, ... ) { statement ... }
Description

See procedure / function for a full description of function.

if-else

Syntax
if ( expression ) statement
if ( expression ) statement else statement
Description

The if-else statement is a conditional statement. It runs the specified statement if the specified expression evaluates to true (a non-zero value). If the else part is present, it runs the associated statement if the expression evaluates to false (the value 0).

Use a statement block of the form { statement ... } to run multiple statements. One Identity recommends using a statement block for readability.

Examples

Accept if the user is contained in the set of trusted users, otherwise continue execution at the next statement:

trustedusers = {"jamie","corey","robyn"}; 
if (user in trustedusers) 
   accept;

Accept if the user is contained in the set of trusted users, otherwise reject:

trustedusers = {"jamie","corey","robyn"}; 
if (user in trustedusers) 
   accept; 
else 
   reject;

Note the use of statement block to handle multiple statements:

trustedusers = {"jamie","corey","robyn"}; 
if (user in trustedusers) { 
   print("accepted"); 
   accept; 
} else { 
   print("rejected"); 
   reject; 
}

include

Syntax
include file-name
Description

The Privilege Manager for Unix configuration language contains the include statement, which is used to call out to other configuration files. By splitting your configuration file up into several smaller files, you can eliminate clutter. You can also hand-off control over certain aspects of configuration to different people, by giving them access to the subsidiary configuration files.

If an accept or reject is done within the included file, control never returns to the original file. On the other hand, if no accept or reject is done in the included file, execution will proceed to the end of that file, and then resume in the original file immediately after the include statement.

If a full pathname is not specified, the value of the policydir setting from the /etc/opt/quest/qpm4u/pm.settings file will be pre-pended to the filename.

When handing off control to a subsidiary configuration file whose contents are controlled by a questionable person, you might want to "fix" certain Privilege Manager for Unix variable values so that they cannot be changed by the subsidiary file. Use the readonly and readonlyexcept statements for this purpose.

As an example, you may have an Oracle® database administrator, who you want to be able to administer certain Oracle® programs. Each of those programs is to run as the "oracle" user. You would like the DBA to be able to grant or deny access to these programs and this account without your involvement, but you certainly do not want to give this person power over non-Oracle® parts of the system.

Specify the file to be included as a string expression; it may contain variables. For example, include "/etc/ + usr + ".conf";.

The following configuration file fragment hands off control to a subsidiary configuration file called, /etc/pmorcle.conf, and ensures that if an accept is done within this file, the job being accepted can only run as the oracle user.

Examples
oraclecmds = {"oradmin", "oraprint", "orainstall"}; 
if(command in oraclecmds) 
{ 
   runuser = "oracle"; 
   readonly {"runuser"}; 
   include "/etc/pmoracle.conf"; 
   reject; 
}

procedure / function

Syntax
procedure parameter (argument-list)
{
statement ...
parameter = expression;
}
function parameter (argument-list)

{

statement ...

parameter = expression;

}
Description

A procedure is a named block of code that runs a sequence of one or more statements, and which may declare zero or more parameters. Each parameter is a variable that may optionally have a default value. If a parameter is declared with a default value, then all following parameters must also be declared with a default value. A procedure terminates when the final statement is run or when a return statement is run.

Variables and parameters declared within the procedure have local scope and are discarded when the procedure terminates. If an identifier is referenced within a procedure, the local scope of the procedure is checked first for a variable or parameter with a matching name. If one cannot be found, then the containing scope is checked for a variable with a matching name. If a matching variable still cannot be found, a new variable is declared, with a scope local to the procedure.

A procedure is invoked by specifying the name of the procedure and providing values for each parameter in a comma-separated argument list contained within parentheses. No argument is required if the matching parameter has a default value; in this case, the parameter will be assigned its specified default value.

A procedure may be declared using the procedure or function keywords. Historically, a function returns a value whereas a procedure does not; however, the parser will permit any procedure to return a value regardless of the keyword used. The choice of using the procedure or function keyword is stylistic. If a procedure ends without a return statement, a variable with the same name as the procedure is treated as the return value.

Examples

Procedure with no parameters:

procedure include_defaults() { 
   include "/opt/quest/qpm4u/policies/defaults.conf"; 
} 

include_defaults();

Procedure with two parameters, one of which has a default value:

procedure process_include_file(fname, fdir="") { 
   topdir = "/opt/quest/qpm4u/policies"; 
   fpath = topdir + "/" + (fdir == "" ? "" : fdir + "/") + fname; 
   if (fileexists(fpath)) { 
      include fpath; 
   } 
} 

process_include_file(user + ".conf"); 
         # default value of "" is assigned to parameter fdir 

process_include_file(user + ".conf", "users"); 
         # parameter fdir is assigned the value "users"

Procedure with a parameter that masks a top-level variable with the same name. This print 1,2,1:

x = 1; 

procedure foo(x) { 
   print(x); 
} 

print(x); 
foo(2); 
print(x); 
Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating