Oracle Solaris Trusted Extensions Administrator's Procedures

ProcedureHow to Display the Labels of Mounted Files

This procedure creates a shell script that displays the mounted file systems of the current zone. When run from the global zone, the script displays the labels of all mounted file systems in every zone.

Before You Begin

You must be in the System Administrator role in the global zone.

  1. Use the trusted editor to create the getmounts script.

    For details, see How to Edit Administrative Files in Trusted Extensions.

    Provide the pathname to the script, such as /usr/local/scripts/getmounts.

  2. Add the following content and save the file:


    #!/bin/sh
    #
    for i in `/usr/sbin/mount -p | cut -d " " -f3` ; do
            /usr/bin/getlabel $i
    done
  3. Test the script in the global zone.


    # /usr/local/scripts/getmounts
    /:      ADMIN_LOW
    /dev:   ADMIN_LOW
    /kernel:        ADMIN_LOW
    /lib:   ADMIN_LOW
    /opt:   ADMIN_LOW
    /platform:      ADMIN_LOW
    /sbin:  ADMIN_LOW
    /usr:   ADMIN_LOW
    /var/tsol/doors:        ADMIN_LOW
    /zone/needtoknow/export/home:   CONFIDENTIAL : NEED TO KNOW
    /zone/internal/export/home:     CONFIDENTIAL : INTERNAL USE ONLY
    /zone/restricted/export/home:   CONFIDENTIAL : RESTRICTED
    /proc:  ADMIN_LOW
    /system/contract:       ADMIN_LOW
    /etc/svc/volatile:      ADMIN_LOW
    /etc/mnttab:    ADMIN_LOW
    /dev/fd:        ADMIN_LOW
    /tmp:           ADMIN_LOW
    /var/run:       ADMIN_LOW
    /zone/public/export/home:  PUBLIC
    /root:          ADMIN_LOW

Example 10–2 Displaying the Labels of File Systems in the restricted Zone

When run from a labeled zone by a regular user, the getmounts script displays the labels of all the mounted file systems in that zone. On a system where zones are created for every label in the default label_encodings file, the following is the output from the restricted zone:


# /usr/local/scripts/getmounts
/:      CONFIDENTIAL : RESTRICTED
/dev:   CONFIDENTIAL : RESTRICTED
/kernel:        ADMIN_LOW
/lib:   ADMIN_LOW
/opt:   ADMIN_LOW
/platform:      ADMIN_LOW
/sbin:  ADMIN_LOW
/usr:   ADMIN_LOW
/var/tsol/doors:        ADMIN_LOW
/zone/needtoknow/export/home:   CONFIDENTIAL : NEED TO KNOW
/zone/internal/export/home:     CONFIDENTIAL : INTERNAL USE ONLY
/proc:  CONFIDENTIAL : RESTRICTED
/system/contract:       CONFIDENTIAL : RESTRICTED
/etc/svc/volatile:      CONFIDENTIAL : RESTRICTED
/etc/mnttab:    CONFIDENTIAL : RESTRICTED
/dev/fd:        CONFIDENTIAL : RESTRICTED
/tmp:   CONFIDENTIAL : RESTRICTED
/var/run:       CONFIDENTIAL : RESTRICTED
/zone/public/export/home:       PUBLIC
/home/gfaden:   CONFIDENTIAL : RESTRICTED