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

readonlyexcept

Syntax
readonlyexcept list
Description

The readonlyexcept statement is related to the readonly statement. The readonlyexcept statement makes all variables read-only, except those listed in the statement. The readonlyexcept statement has the same syntax as the readonly statement.

Examples
runhost = "myhost"; 
runuser = "jamie"; 
readonlyexcept {"runuser"}; 
runhost = "newhost"; // fails, runhost still equals "myhost" 
runuser = "corey"; // runuser now equals "corey"

This policy will cause an execution error. Running pmcheck displays a message similar to this:

**Policy execution error in /etc/opt/quest/qpm4u/policy/pm.conf, line 3 Cannot assign value to readonly identifier runuser

reject

Syntax
reject [rejectmsg]
Description

The reject statement rejects the job request submitted by a user. After a command is accepted, nothing else in the configuration script is executed. If a configuration is not explicitly accepted or rejected, it is rejected by default. A default reject message is displayed to the user if no message is specified with the reject statement. If a null string is specified, then the command is rejected silently.

Examples
adminusers = {"dan","robyn"}; 
adminprogs = {"hostname","kill","csh","ksh"}; 
if (user in adminusers && command in adminprogs) 
{ 
   runuser = "root"; 
   if (user == "dan" && !officehours) 
   { 
      reject "You can't use “ + runcommand + “ outside office hours\n"; #custom msg 

   } 
   if (user == "robyn" && !officehours) 
   { 
      if (!getuserpasswd(user)) 
         reject ; #use default reject msg 
   } 
   accept; 
} 
else 
{ 
   reject ""; #reject silently – no msg displayed to the user 
}

return

Syntax
return [expression];
Description

return exits the current procedure/function and returns the value of expression.

Examples
function square (n){
   n2 = n * n; 
   return n2; 
} 

print(square(10)); // prints "100"

switch

Syntax
switch (string) 
{ 
   case expression1: 
      statement1a; [statement1b; …] [break;] 
   case expression2: 
      statement2a; [statement2b; …] [break;] 
   default: statement3a; [statement3b; …] [break;] 
}
Description

The switch statement tests whether an expression matches one of several values (each of which is specified in a case statement) and branches accordingly. If a case matches the value, execution will begin at that case falling through to subsequent cases until a break statement occurs. The break statement forces an immediate exit from the switch statement; it is optional.

The default statement is executed if none of the cases match the value. This statement is optional. If there is no default and none of the cases match the value, nothing happens. Case statements can be in any order, but the default statement, if present, must occur after all of the case statements.

Examples
switch (user) { 
   case "leslie": 
      runuser="sys"; 
      break; 
   case "adrian": 
      accept; 
   case "cory": 
   case "jamie": 
      runuser = "root"; 
      accept; 
   default: 
      reject; 
} 

switch (gidnum){ 
   case 0: runuser="root"; break; 
   default: break; 
}

(See Example 9: Switch and Case Statements for additional usage examples.)

Related Documents