$CHKPRO

From VSI OpenVMS Wiki
Jump to: navigation, search

$CHKPRO, or Check Access Protection, is a system service that determines whether an accessor with the specified rights and privileges can access an object with the specified attributes. The service invokes the system’s access protection check, which permits layered products and other subsystems to build protected structures that are consistent with the protection facilities provided by the base operating system. The service also allows a privileged subsystem to perform protection checks on behalf of a requester.

The caller can also request that an object access audit be performed if security auditing has been enabled for the object class or if auditing ACEs are contained in the object’s ACL. The CHP$V_AUDIT flag requests an access audit. This requires that the caller be in executive or kernel mode or possess the AUDIT privilege.

Usually, $CHKPRO generates an object access audit when an audit is required. The caller can specify the CHP$V_CREATE flag to force an object creation audit instead of an object access audit. Similarly, the CHP$V_DELETE flag forces an object deletion audit. The CHP$_AUDIT_LIST item code can be used to specify additional information to be included in any resulting audit records.

Syntax

SYS$CHKPRO itmlst ,[objpro] ,[usrpro]

C prototype:

int sys$chkpro (void *itmlst, void *objpro, void *usrpro);

itemlst

OpenVMS usage: item_list_3
Type: longword (unsigned)
Access: read only
Mechanism: by reference

Protection attributes of the object and the rights and privileges of the accessor. The item list arguments accepted by this service permit you to specify the protection of the object being accessed, the rights and privileges of the accessor, and the type of access desired. At a minimum, the following item codes should be specified to perform a thirdparty protection check:

  • CHP$_ACCESS
  • CHP$_OWNER
  • CHP$_PRIV
  • CHP$_PROT
  • CHP$_UIC

The following table defines the item descriptor fields:

Descriptor Field Definition
Buffer length A word containing a user-supplied integer specifying the length (in bytes) of the associated buffer. The length of the buffer needed depends on the item code specified in the item code field of the item descriptor. If the value of buffer length is too small, the service truncates the data.
Item code A word containing a user-supplied symbolic code specifying the item of information in n in the associated buffer. The item codes are defined in the $ACLDEF system macro library.
Buffer address A longword containing the user-supplied address of the buffer.
Return length address A longword that normally contains the user-supplied address of a word in which the service writes the length in bytes of the information it returned. This is not used by $CHKPRO and should contain a 0.

Specifying any specific protection attribute causes that protection check to be made; any protection attribute not specified is not checked. Rights and privileges specified are used as needed. If a protection check requires any right or privilege not specified in the item list, the right or privilege of the caller’s process is used.

item codes

CHP$_ACCESS

A longword bit mask representing the type of access desired ($ARMDEF). Be aware that the $CHKPRO service does not interpret the bits in the access mask; instead, it compares them to the object’s protection mask (CHP$_PROT). Any bits not specified by CHP$_ACCESS or CHP$_PROT are assumed to be clear, which grants access.

CHP$_ACL

A vector that points to an object’s access control list. The buffer address, bufadr, specifies a buffer containing one or more ACEs. The number that specifies the length of the CHP$_ACL buffer, buflen, must be equal to the sum of all ACE lengths. The format of the ACE structure depends on the value of the second byte in the structure, which specifies the ACE type. The $FORMAT_ACL system service description describes each ACE type and its format. You can specify the CHP$_ACL item multiple times to point to multiple segments of an access control list. You can specify a maximum of 20 segments. The segments are processed in the order specified.

CHP$_ACMODE

A byte that defines the accessor’s processor access mode. The following access modes and their symbols are defined in the $PSLDEF macro:

Symbol Access Mode
PSL$C_USER User
PSL$C_SUPER Supervisor
PSL$C_EXEC Executive
PSL$C_KERNEL Kernel

If CHP$_ACMODE is not specified, access mode is not used to determine access.

CHP$_ADDRIGHTS

A vector that points to an additional rights list segment to be appended to the existing rights list. Each entry of the rights list is a quadword data structure consisting of a longword containing the identifier value, followed by a longword containing a mask identifying the attributes of the holder. The $CHKPRO service ignores the attributes. A maximum of 11 rights descriptors is allowed. If you specify CHP$_ADDRIGHTS without specifying CHP$_RIGHTS, the accessor’s rights list consists of the rights list specified by the CHP$_ADDRIGHTS item codes and the rights list of the current process. If you specify CHP$_RIGHTS and CHP$_ADDRIGHTS, you should be aware of the following:

  • CHP$_RIGHTS must come first.
  • The accessor’s UIC is the identifier of the first entry in the rights list specified by the CHP$_RIGHTS item code.
  • The accessor’s rights list consists of the rights list specified by the CHP$_RIGHTS item code and the CHP$_ADDRIGHTS item codes.

CHP$_ALARMNAME

Address of a buffer to receive the alarm name from any Alarm ACE contained in the object’s ACL. If the object does not have security alarms enabled, $CHKPRO returns retlenadr as 0. If a matching Alarm ACE exists, the string SECURITY will be returned.

CHP$_AUDIT_LIST

A security auditing item list containing additional information to be included in any resulting security audit. The bufadr argument points to the beginning of an $AUDIT_EVENT item list. See the itmlst argument of the $AUDIT_EVENT system service for a list of valid security auditing item codes. Note that the NSA$_EVENT_TYPE and NSA$_EVENT_SUBTYPE items are ignored when auditing with $CHKPRO. The CHP$V_AUDIT flag must be specified.

CHP$_AUDITNAME

Address of a buffer to receive the audit name from any Audit ACE contained in the object’s ACL. If the object does not have auditing enabled, $CHKPRO returns retlenadr as 0. If a matching Audit ACE exists, the string SECURITY will be returned.

CHP$_FLAGS

A longword that defines various aspects of the protection check. The symbols in the following table are offsets to the bits within the longword. You can also obtain the values as masks with the appropriate bit set by using the prefix CHP$M rather than CHP$V. The following symbols are defined only in the system macro library ($CHPDEF):

Symbol Access
CHP$V_ALTER Accessor desires write access to object.
CHP$V_AUDIT Access audit requested.
CHP$V_CREATE Perform the audit as an object creation event.
CHP$V_DELETE Perform the audit as an object deletion event.
CHP$V_FLUSH Force audit buffer flush.
CHP$V_INTERNAL Audit on behalf of the Trusted Computing Base (TCB). Reserved to VSI.
CHP$V_MANDATORY Force the object access event to be audited.
CHP$V_NOFAILAUD Do not perform audits for failed access.
CHP$V_NOSUCCAUD Do not perform audits for successful access.
CHP$V_OBSERVE Accessor desires read access to object.
CHP$V_SERVER Audit on behalf of a TCB server process.
CHP$V_USEREADALL Accessor is eligible for READALL privilege.

The default for CHP$_FLAG is CHP$M_OBSERVE and CHP$M_ALTER. The primary purpose of the CHP$V_OBSERVE and CHP$V_ALTER flags is as latent support for a mandatory (lattice) security policy, such as that provided by the Security Enhanced VMS (SEVMS) offering.

CHP$_MATCHEDACE

This output item is a variable-length data structure containing the first Identifier ACE in the object’s ACL that allowed or denied the accessor to access the object. See the $FORMAT_ACL system service for a description of an Identifier ACE format.

CHP$_MODE

A byte that defines the object’s owner access mode. The following access modes of the object’s owner and their symbols are defined in the system macro library ($PSLDEF):

Symbol Access Mode
PSL$C_USER User
PSL$C_SUPER Supervisor
PSL$C_EXEC Executive
PSL$C_KERNEL Kernel

CHP$_MODES

A quadword that defines the object’s access mode protection. You specify a 2-bit access mode as shown in CHP$_MODE for each possible access type. See OpenVMS System Services Reference Manual Vol. I (A-GETUAI) for the diagram illustrating the format of an access mode vector for bit numbers.

CHP$_OBJECT_CLASS

A character string containing the protected object class associated with the object. The object class string is used to determine whether any security auditing is enabled for the object access event. This item code is required when the CHP$_AUDIT flag is specified.

CHP$_OBJECT_NAME

A character string containing the object name associated with the protection check. The object name string is included in any resulting security audit. If an object name string is not specified, the string ‘‘<not available>’’ is substituted in any security audit for all protected object classes other than FILE. For FILE class audits, it is assumed that the caller has supplied an object name by using the auditing item list (NSA$_OBJECT_NAME).

CHP$_OWNER

A longword describing the object’s owner identifier (UIC or general identifier). This might be either a UIC format identifier or a general identifier. Note that CHP$_OWNER is used in conjunction with the CHP$_PROT item code.

CHP$_PRIV

A quadword that defines an accessor’s privilege mask. Each bit in the mask has a symbolic name, defined by the $PRVDEF macro. You form the bit array by specifying the symbolic name of each privilege in a logical OR operation. See the $SETPRV system service for the symbolic name and description of each privilege.

CHP$_PRIVUSED A longword mask of flags representing privileges used to gain the requested access. You can also obtain the values as masks with the appropriate bit set by using the prefix CHP$M rather than CHP$V. The symbols are defined in the system macro library ($CHPDEF). The following symbols are used as offsets to the bits within the longword:

Symbol Meaning
CHP$V_SYSPRV SYSPRV was used to gain the requested access.
CHP$V_GRPPRV GRPPRV was used to gain the requested access.
CHP$V_BYPASS BYPASS was used to gain the requested access.
CHP$V_READALL READALL was used to gain the requested access.
CHP$V_OPER OPER was used to gain the requested access.
CHP$V_GRPNAM GRPNAM was used to gain the requested access.
CHP$V_SYSNAM SYSNAM was used to gain the requested access.
CHP$V_GROUP GROUP was used to gain the requested access.
CHP$V_WORLD WORLD was used to gain the requested access.
CHP$V_PRMCEB PRMCEB was used to gain the requested access.
CHP$V_UPGRADE UPGRADE was used to gain the requested access.
CHP$V_DOWNGRADE DOWNGRADE was used to gain the requested access.

CHP$_PROT

A vector describing the object’s SOGW protection mask. See OpenVMS System Services Reference Manual Vol. I (A-GETUAI) for the diagram depicting the format for describing the object's protection.

The $CHKPRO service compares the low-order four bits of CHP$_ACCESS against one of the 4-bit fields in the low-order word of CHP$_PROT, the next four bits of CHP$_ACCESS against one of the 4-bit fields in the next word of CHP$_PROT, and so on. The $CHKPRO service chooses a field of CHP$_PROT based on the privileges specified for the accessor (CHP$_PRIV), the UICs of the accessor (CHP$_RIGHTS or CHP$_ADDRIGHTS, or both), and the object’s owner (CHP$_OWNER).

You must also specify the identifier of the object’s owner with CHP$_OWNER when you use CHP$_PROT.

CHP$_RIGHTS

A vector that points to an accessor’s rights list. The accessor’s UIC is the identifier of the first entry in the rights list. The accessor’s rights list consists of the rights list specified by CHP$_RIGHTS and, optionally, the rights list specified by the CHP$_ADDRIGHTS item codes.

CHP$_UIC

A longword specifying the accessor’s owner UIC. This item code can be used to avoid having to pass an entire rights list segment via the CHP$_RIGHTS item code. If CHP$_RIGHTS and then CHP$_UIC are specified, in that order, $CHKPRO initializes the local rights list and then replaces just the owner UIC with the value of CHP$_UIC.


objpro

OpenVMS usage: char_string
Type: opaque byte stream
Access: read only
Mechanism: by descriptor

Buffer containing an object security profile. The objpro argument is the address of a descriptor pointing to a buffer that contains an encoded object security profile. The objpro argument eliminates the need to supply all of the component object protection attributes with the $CHKPRO item list. The objpro argument is currently reserved to VSI.

usrpro

OpenVMS usage: char_string
Type: opaque byte stream
Access: read only
Mechanism: by descriptor

Buffer containing a user security profile. The usrpro argument is the address of a descriptor pointing to a buffer that contains an encoded user security profile. The usrpro argument eliminates the need to supply all of the component user security attributes with the $CHKPRO item list. The $CREATE_USER_PROFILE service can be used to construct a user security profile. When the usrpro argument is specified, any component user profile attributes specified in the $CHKPRO item list replace those contained in the user security profile. The item codes used with $CHKPRO are described in the following list and are defined in the $CHPDEF system macro library

Values Returned

Value Meaning
SS$_NORMAL The service completed successfully; the desired access is granted.
SS$_ACCVIO The item list cannot be read by the caller, or one of the buffers specified in the item list cannot be written by the caller.
SS$_ACLFULL More than 20 CHP$_ACL items were given.
SS$_BADPARAM The argument is invalid.
SS$_BUFFEROVF The output buffer is too small and the protection check succeeded.
SS$_IVACL You supplied an invalid ACL segment with the CHP$_ACL item.
SS$_IVBUFLEN The output buffer is too small and the protection check failed.
SS$_NOAUDIT Caller lacks privilege to request audit.
SS$_NOPRIV The desired access is not granted.
SS$_RIGHTSFULL More than 11 CHP$_ADDRIGHTS items were given.

Privileges Required

AUDIT privilege is required when requesting an audit.

See also