Go to main content

Trusted Extensions Developer's Guide

Exit Print View

Updated: November 2020

Trusted Extensions APIs

This section introduces the following Trusted Extensions Label APIs:

In addition to these Trusted Extensions APIs, you can use the security APIs that are available with the Oracle Solaris OS. An application that runs on Trusted Extensions might require the manipulation of other security attributes. For example, the user and profile databases contain information about users, roles, authorizations, and profiles. These databases can restrict who can run a program. Privileges are coded into various Oracle Solaris programs and can also be coded into third-party applications.

For more information about these Oracle Solaris OS security APIs, see Developing Privileged Applications, in Solaris Security for Developers Guide.

The Oracle Solaris OS provides discretionary access control (DAC), in which the owner of the data determines who is permitted access to the data. The Trusted Extensions software provides additional access control, which is called mandatory access control (MAC). In MAC, ordinary users cannot specify or override the security policy. The security administrator sets the security policy.

Applications use Trusted Extensions APIs to obtain labels for hosts, zones, users, and roles. Where the security policy permits, the APIs enable you to set labels on user processes or on role processes. Setting a label on a zone or on a host is an administrative procedure, not a programmatic procedure.

The label APIs operate on opaque labels. In an opaque label, the internal structure of the label is not exposed. Using an opaque label enables existing programs that are created with the APIs to function even if the internal structure of the label changes. For example, you cannot use the label APIs to locate particular bits in a label. The label APIs enable you to obtain labels and to set labels. You can only set labels if you are permitted to do so by the security policy.

Label APIs

Labels, label ranges, and a label limit determine who can access information on a system that is configured with Trusted Extensions.

The label APIs are used to access, convert, and perform comparisons for labels, label ranges and limits, and the relationship between labels. A label can dominate another label, or a label can be disjoint from another label.

The label_encodings file defines the sensitivity labels, clearance labels, label ranges, and label relationships that pertain to your Trusted Extensions environment. This file also controls the appearance of labels. The security administrator is responsible for creating and maintaining the label_encodings file. See the label_encodings(5) man page.

The label of a process is determined by the zone in which the process executes.

    All objects are associated with a label or sometimes with a label range. An object can be accessed at a particular label within the defined label range. The objects that are associated with a label range include the following:

  • All users and all roles during PAM authentication by the pam_tsol_account.so.1 module

  • All multilevel ports on hosts that permit communications

  • All multilevel interfaces for zones and networks

  • Allocatable devices, such as CD-ROM devices and audio devices, when allocated from the global zone

  • Other devices that are not allocatable, such as printers and workstations, when allocated from the global zone

    By default, devices have a range from ADMIN_LOW to ADMIN_HIGH.

For more information about labels, see Label Types.

How Labels Are Used in Access Control Decisions

MAC compares the label of the process that is running an application with the label or the label range of any object that the process tries to access. MAC permits a process to read down to a lower label and permits a process to write to an equal label.

Label[Process] >= Label[Object]

A process bound to a multilevel port (MLP) can listen for requests at multiple labels and send replies to the originator of the request. In Trusted Extensions, such replies are write-equal.

Label[Process] = Label[Object]

Types of Label APIs

Sensitivity Label APIs

    Sensitivity label APIs can be used to do the following:

  • Obtain a process label

  • Initialize labels

  • Find the greatest lower bound or the least upper bound between two labels

  • Compare labels for dominance and equality

  • Check and set label types

  • Convert labels to a readable format

  • Obtain information from the label_encodings file

  • Check that a sensitivity label is valid and within the system range

For a description of these APIs, see Labels and Clearances.

Clearance Label APIs

Users, devices, and network interfaces have label ranges. The upper bound of the range is effectively the clearance. If the upper bound of the range and the lower bound of the range are equal, the range is a single label.

    Clearance label APIs can be used to do the following:

  • Find the greatest lower bound or the least upper bound between two labels

  • Compare labels for dominance and equality

  • Convert clearances between the internal format and the hexadecimal format

For a description of these APIs, see Labels and Clearances.

Label Range APIs

    A label range is used to set limits on the following:

  • The labels at which hosts can send and receive information

  • The labels at which processes acting on behalf of users and roles can work on the system

  • The labels at which users can allocate devices

    This use of a label range restricts the labels at which files can be written to storage media on these devices.

Label ranges are assigned administratively. Label ranges can apply to users, roles, hosts, zones, network interfaces, printers, and other objects.

    You can use the following methods to obtain information about label ranges:

  • getuserrange() obtains the user's label range.

  • getdevicerange() obtains the label range of a device.

  • tncfg -t template-name info shows the label range of a template that is associated with a network interface.

For a description of these APIs, see Labels and Clearances.