<?Pub UDT _bookmark _target?><?Pub EntList bsol dash hellip gt lt minus?><?Pub CX solbook(book(title()bookinfo()part()part(title()partintro()chapter()?><chapter id="managezones-1"><?Pub Tag atict:info tracking="on" ref="0"?><?Pub Tag
atict:user user="sharonr" fullname="Sharon Veach"?><title>Managing Zones in Trusted Extensions (Tasks)</title><indexterm><primary>zones</primary><secondary>managing</secondary>
</indexterm><indexterm><primary>zones</primary><secondary>in Trusted Extensions</secondary>
</indexterm><highlights><para>This chapter describes how non-global zones work on a system that is
configured with Solaris Trusted Extensions. Also included are procedures that are unique to
zones in Trusted Extensions.</para><itemizedlist><listitem><para><olink targetptr="managezones-16" remap="internal">Zones in Trusted Extensions</olink></para>
</listitem><listitem><para><olink targetptr="managezones-12" remap="internal">Global Zone Processes and
Labeled Zones</olink></para>
</listitem><listitem><para><olink targetptr="managezones-4" remap="internal">Zone Administration Utilities
in Trusted Extensions</olink></para>
</listitem><listitem><para><olink targetptr="managezones-6" remap="internal">Managing Zones (Task Map)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="managezones-16"><title>Zones in Trusted Extensions</title><para><indexterm><primary>global zone</primary><secondary>difference from labeled zones</secondary></indexterm><indexterm><primary>zones</primary><secondary>global</secondary></indexterm>A properly configured Trusted Extensions system
consists of a global zone, which is the operating system instance, and one
or more labeled non-global zones. During configuration, Trusted Extensions attaches
a unique label to each zone, which creates labeled zones. The labels come
from the <filename>label_encodings</filename> file. The administrators can
create a zone for each label, but are not required to. It is possible to have
more labels than labeled zones on a system. It is not possible to have more
labeled zones than labels.</para><para><indexterm><primary>directories</primary><secondary>accessing lower-level</secondary></indexterm><indexterm><primary>accessing</primary><secondary>home directories</secondary></indexterm><indexterm><primary>home directories</primary><secondary>accessing</secondary></indexterm>On a Trusted Extensions system, the file systems of a zone are usually
mounted as a loopback file system (lofs). All writable files and directories
in a labeled zone are at the label of the zone. By default, a user can view
files that are in a zone at a lower label than the user's current label. This
configuration enables users to view their home directories at lower labels
than the label of the current workspace. Although users can view files at
a lower label, they cannot modify them. Users can only modify files from a
process that has the same label as the file.</para><para>In Trusted Extensions, the global zone is an administrative zone. The labeled
zones are for regular users. Users can work in a zone whose label is within
the user's accreditation range.</para><para>Every zone has an associated IP address and security attributes. A zone
can be configured with multilevel ports (MLPs). Also, a zone can be configured
with a policy for Internet Control Message Protocol (ICMP) broadcasts, such
as <command>ping</command>.</para><para>For information about sharing directories from a labeled zone and about
mounting directories from labeled zones remotely, see <olink targetptr="managefiles-1" remap="internal">Chapter&nbsp;17, Managing and Mounting Files in Trusted Extensions (Tasks)</olink>.</para><para>Zones in Trusted Extensions are built on the Solaris zones product.
For details, see <olink targetdoc="group-sa" targetptr="zone" remap="external">Part&nbsp;II, <citetitle remap="chapter">Zones,</citetitle> in <citetitle remap="book">System Administration Guide:  Virtualization Using the Solaris Operating System</citetitle></olink>.
In particular, patching and package installation issues affect Trusted Extensions.
For details, see <olink targetdoc="group-sa" targetptr="z.pkginst.ov-1" remap="external">Chapter 24, <citetitle remap="chapter">About Packages and Patches on a Solaris System With Zones Installed (Overview),</citetitle> in <citetitle remap="book">System Administration Guide:  Virtualization Using the Solaris Operating System</citetitle></olink> and <olink targetdoc="group-sa" targetptr="gclkx" remap="external">Chapter 28, <citetitle remap="chapter">Troubleshooting Miscellaneous Solaris Zones Problems,</citetitle> in <citetitle remap="book">System Administration Guide:  Virtualization Using the Solaris Operating System</citetitle></olink>.</para><sect2 id="managezones-2"><title>Zones and IP Addresses in Trusted Extensions</title><itemizedlist><para>Your initial setup team assigned IP addresses to the global zone and
the labeled zones. Three types of configurations are documented in <olink targetptr="txconf-20" remap="internal">Creating Labeled Zones</olink>:</para><listitem><para>The system has one IP address for the global zone and all
labeled zones.</para><para>This configuration is useful on a system that uses
DHCP software to obtain its IP address. If no users are expected to log in,
an LDAP server might have this configuration.</para>
</listitem><listitem><para>The system has one IP address for the global zone, and one
IP address that is shared by all zones, including the global zone. Any zone
can have a combination of a unique address and a shared address.</para><para>This
configuration is useful on a system that regular users are going to log in
to. It can also be used for a printer or an NFS server. This configuration
conserves IP addresses.</para>
</listitem><listitem><para>The system has one IP address for the global zone, and each
labeled zone has a unique IP address.</para><para>This configuration is useful
for providing access to separate physical networks of single-level systems.
Typically, each zone would have an IP address on a different physical network
from the other labeled zones. Because this configuration is implemented with
a single IP instance, the global zone controls the physical interfaces and
manages global resources, such as the route table.</para>
</listitem>
</itemizedlist><para>With the introduction of exclusive IP instances for a non-global zone,
a fourth type of configuration is available in the Solaris OS. In
the Solaris Express Community Edition, a non-global zone can be assigned its own IP instance and manage
its own physical interfaces. In this configuration, each zone operates as
if it is a distinct system. For a description, see <olink targetdoc="group-sa" targetptr="z.config.ov-6" remap="external"><citetitle remap="section">Zone Network Interfaces</citetitle> in <citetitle remap="book">System Administration Guide:  Virtualization Using the Solaris Operating System</citetitle></olink>.</para><para>However, in such a configuration, each labeled zone operates as if it
is a distinct single-labeled system. The multilevel networking features of Trusted Extensions rely
on features of a shared IP stack. Administration procedures in Trusted Extensions assume
that networking is controlled entirely by the global zone. Therefore, if your
initial setup team has installed labeled zones with exclusive IP instances,
you must provide or refer to site-specific documentation.</para>
</sect2><sect2 id="managezones-31"><title>Zones and Multilevel Ports</title><para>By default, a zone cannot send packets to and receive packets from any
other zone. Multilevel ports (MLPs) enable particular services on a port to
accept requests within a range of labels or from a set of labels. These privileged
services can reply at the label of the request. For example, you might want
to create a privileged web browser port that can listen at all labels, but
whose replies are restricted by label. By default, labeled zones have no MLPs.</para><para>The range of labels or set of labels that constrains the packets that
the MLP can accept is based on the zone's IP address. The IP address is assigned
a remote host template in the <filename>tnrhdb</filename> database. The label
range or set of labels in the remote host template constrains the packets
that the MLP can accept.</para><itemizedlist><listitem><para>The constraints on MLPs for different IP address configurations
are as follows:</para>
</listitem><listitem><para>On a system where the global zone has an IP address and each
labeled zone has a unique IP address, an MLP for a particular service can
be added to every zone. For example, the system could be configured so that
the <command>ssh</command> service, over TCP port <literal>22</literal>, is
an MLP in the global zone and in every labeled zone.</para>
</listitem><listitem><para>In a typical configuration, the global zone is assigned one
IP address and labeled zones share a second IP address with the global zone.
When an MLP is added to a shared interface, the service packet is routed to
the labeled zone where the MLP is defined. The packet is accepted only if
the remote host template for the labeled zone includes the label of the packet.
If the range is <constant>ADMIN_LOW</constant> to <constant>ADMIN_HIGH</constant>,
then all packets are accepted. A narrower range would discard packets that
are not within the range.</para><para>At most, one zone can define a particular
port to be an MLP on a shared interface. In the preceding scenario, where
the <command>ssh</command> port is configured as a shared MLP in a non-global
zone, no other zone can receive <command>ssh</command> connections on the
shared address. However, the global zone could define the <command>ssh</command> port
as a private MLP for receipt of connections on its zone-specific address. </para>
</listitem><listitem><para>On a system where the global zone and the labeled zones share
an IP address, an MLP for the <command>ssh</command> service could be added
to one zone. If the MLP for <command>ssh</command> is added to the global
zone, then no labeled zone can add an MLP for the <command>ssh</command> service.
Similarly, if the MLP for the <command>ssh</command> service is added to a
labeled zone, then the global zone cannot be configured with an <command>ssh</command> MLP.</para>
</listitem>
</itemizedlist><para>For an example of adding MLPs to labeled zones, see <olink targetptr="managetnet-33" remap="internal">Example&nbsp;19&ndash;16</olink>.</para>
</sect2><sect2 id="managezones-26"><title>Zones and ICMP in Trusted Extensions</title><para>Networks transmit broadcast messages and send ICMP packets to systems
on the network. On a multilevel system, these transmissions could flood the
system at every label. By default, the network policy for labeled zones requires
that ICMP packets be received only at the matching label.</para>
</sect2>
</sect1><sect1 id="managezones-12"><title>Global Zone Processes and Labeled Zones</title><para>In Trusted Extensions, MAC policy applies to all processes, including processes
in the global zone. Processes in the global zone run at the label <constant>ADMIN_HIGH</constant>. When files from a global zone are shared, they are shared at
the label <constant>ADMIN_LOW</constant>. Therefore, because MAC prevents
a higher-labeled process from modifying a lower-level object, the global zone
usually cannot write to an NFS-mounted system.</para><para>However, in a limited number of cases, actions in a labeled zone can
require that a global zone process modify a file in that zone.</para><para>To enable a global zone process to mount a remote file system with read/write
permissions, the mount must be under the zone path of the zone whose label
corresponds to that of the remote file system. But it must not be mounted
under that zone's root path.</para><itemizedlist><listitem><para>The mounting system must have a zone at the identical label
as the remote file system.</para>
</listitem><listitem><para>The system must mount the remote file system under the zone
path of the identically labeled zone.</para><para>The system must <emphasis>not</emphasis> mount
the remote file system under the <emphasis>zone root path</emphasis> of the
identically labeled zone</para>
</listitem>
</itemizedlist><para>Consider a zone that is named <literal>public</literal> at the label <constant>PUBLIC</constant>. The <emphasis>zone path</emphasis> is <filename class="directory">/zone/public/</filename>. All directories under the zone
path are at the label <constant>PUBLIC</constant>, as in:</para><screen><filename class="directory">/zone/public/dev</filename>
<filename class="directory">/zone/public/etc</filename>
<filename class="directory">/zone/public/home/<replaceable>username</replaceable></filename>
<filename class="directory">/zone/public/root</filename>
<filename class="directory">/zone/public/usr</filename></screen><para>Of the directories under the zone path, only files under <filename class="directory">/zone/public/root</filename> are visible from the public
zone. All other directories and files at the label <constant>PUBLIC</constant> are
accessible only from the global zone. The path <filename class="directory">/zone/public/root</filename> is the <emphasis>zone root path</emphasis>.</para><para>From the perspective of the public zone administrator, the zone root
path is visible as <filename class="directory">/</filename>. Similarly, the
public zone administrator cannot access a user's home directory in the zone
path, <filename class="directory">/zone/public/home/<replaceable>username</replaceable></filename> directory.
That directory is visible only from the global zone. The public zone mounts
that directory in the zone root path as <filename class="directory">/home/<replaceable>username</replaceable></filename>. From the perspective of the global zone,
that mount is visible as <filename class="directory">/zone/public/root/home/<replaceable>username</replaceable></filename>.</para><para>The public zone administrator can modify <filename class="directory">/home/<replaceable>username</replaceable></filename>. A global zone process, when files in a
user's home directory need to be modified, does not use that path. The global
zone uses the user's home directory in the zone path, <filename class="directory">/zone/public/home/<replaceable>username</replaceable></filename>.</para><itemizedlist><listitem><para>Files and directories that are under the zone path, <filename class="directory">/zone/<replaceable>zonename</replaceable>/</filename>, but
not under the zone root path, <filename class="directory">/zone/<replaceable>zonename</replaceable>/root</filename> directory, can be modified by a global zone
process that runs at the label <constant>PUBLIC</constant>.</para>
</listitem><listitem><para>Files and directories that are under the zone root path, <filename class="directory">/zone/public/root</filename>, can be modified by the labeled
zone administrator.</para>
</listitem>
</itemizedlist><para>For example, when a user allocates a device in the public zone, a global
zone process that runs at the label <constant>PUBLIC</constant> modifies
the <filename class="directory">dev</filename> directory in the zone path, <filename class="directory">/zone/public/dev</filename>. Similarly, when a user saves
a desktop configuration, the desktop configuration file is modified by a global
zone process in the <filename class="directory">/zone/public/home/<replaceable>username</replaceable></filename>. Finally, to share files from a labeled zone, the
global zone administrator creates the configuration file, <filename>dfstab</filename>,
in the zone path, <filename>/zone/public/etc/dfs/dfstab</filename>. A labeled
zone administrator cannot access that file, and cannot share files from the
labeled zone. To share a labeled directory, see <olink targetptr="txconf-43" remap="internal">How
to Share Directories From a Labeled Zone</olink>.</para>
</sect1><sect1 id="managezones-4"><title>Zone Administration Utilities in Trusted Extensions</title><itemizedlist><para>Some zone administration tasks can be performed from the command line.
However, the simplest way to administer zones is to use the GUIs that Trusted Extensions provides:</para><listitem><para>The configuration of zone security attributes is performed
by using the Trusted Network Zones tool in the Solaris Management Console. For a description of
the tool, see <olink targetptr="txtool-14" remap="internal">Trusted Network Zones Tool</olink>.
For examples of zone configuration and creation, see <olink targetptr="txconf-1" remap="internal">Chapter&nbsp;4,
Configuring Trusted Extensions (Tasks)</olink> and <olink targetptr="managezones-5" remap="internal">How to Create a Multilevel Port for a Zone</olink>.</para>
</listitem><listitem><para><indexterm><primary>administering</primary><secondary>zones from Trusted JDS</secondary></indexterm><indexterm><primary>zones</primary><secondary>administering from Trusted JDS</secondary></indexterm><indexterm><primary>files</primary><secondary><command>/usr/sbin/txzonemgr</command></secondary></indexterm><indexterm><primary>scripts</primary><secondary><command>/usr/sbin/txzonemgr</command></secondary></indexterm><indexterm><primary><command>/usr/sbin/txzonemgr</command> script</primary></indexterm>The shell script, <command>/usr/sbin/txzonemgr</command>, provides a menu-based wizard for creating, installing, initializing,
and booting zones. If you are administering zones from Solaris Trusted Extensions (GNOME),
use the <command>txzonemgr</command> script rather than Trusted CDE actions. <command>txzonemgr</command> uses the <command>zenity</command> command. For details,
see the <citerefentry><refentrytitle>zenity</refentrytitle><manvolnum>1</manvolnum></citerefentry> man page.</para>
</listitem><listitem><para>In Trusted CDE, the configuration and creation of zones can be
performed by using actions in the Trusted_Extensions folder. For a description
of the actions, see <olink targetptr="txtool-3" remap="internal">Trusted CDE Actions</olink>.
For procedures that use the actions, see <olink targetptr="commontasks-42" remap="internal">How
to Start CDE Administrative Actions in Trusted Extensions</olink>.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="managezones-6"><title>Managing Zones (Task Map)</title><indexterm><primary>Managing Zones (Task Map)</primary>
</indexterm><indexterm><primary>tasks and task maps</primary><secondary>Managing Zones (Task Map)</secondary>
</indexterm><indexterm><primary>zones</primary><secondary>administering</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>zones</secondary>
</indexterm><para>The following task map describes zone management tasks that are specific
to Trusted Extensions. The map also points to common procedures that are performed
in Trusted Extensions just as they are performed on a Solaris system.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>View all zones.</para>
</entry><entry><para>At any label, views the zones that are dominated by the current zone.</para>
</entry><entry><para><olink targetptr="managetnet-12" remap="internal">How to Display Ready or Running Zones</olink></para>
</entry>
</row><row><entry><para>View mounted directories.</para>
</entry><entry><para>At any label, views the directories that are dominated by the current
label.</para>
</entry><entry><para><olink targetptr="managetnet-11" remap="internal">How to Display the Labels of Mounted
Files</olink></para>
</entry>
</row><row><entry><para>Enable regular users to view an <filename>/etc</filename> file.</para>
</entry><entry><para>Loopback mounts a directory or file from the global zone that is not
visible by default in a labeled zone.</para>
</entry><entry><para><olink targetptr="managezones-10" remap="internal">How to Loopback Mount a File That
Is Usually Not Visible in a Labeled Zone</olink></para>
</entry>
</row><row><entry><para>Prevent regular users from viewing a lower-level home directory from
a higher label.</para>
</entry><entry><para>By default, lower-level directories are visible from higher-level zones.
When you disable the mounting of one lower-level zone, you disable all mounts
of lower-level zones.</para>
</entry><entry><para><olink targetptr="managezones-3" remap="internal">How to Disable the Mounting of Lower-Level
Files</olink></para>
</entry>
</row><row><entry><para>Configure a zone to enable the changing of the labels on files.</para>
</entry><entry><para>Labeled zones have limited privileges. By default, labeled zones do
not have the privilege that enables an authorized user to relabel a file.
You modify the zone configuration to add the privilege.</para>
</entry><entry><para><olink targetptr="managezones-8" remap="internal">How to Enable Files to be Relabeled
From a Labeled Zone</olink></para>
</entry>
</row><row><?PubTbl row rht="0.54in"?><entry><para>Move a file or directory into or out of a labeled zone.</para>
</entry><entry><para>Changes a file or directory's level of security by changing its label.</para>
</entry><entry><para><olink targetdoc="trssug" targetptr="ugtour-23" remap="external"><citetitle remap="section">How to Move Files Between Labels in Trusted CDE</citetitle> in <citetitle remap="book">Solaris Trusted Extensions User&rsquo;s Guide</citetitle></olink></para>
</entry>
</row><row><entry><para>Attach a ZFS dataset to a labeled zone and share it.</para>
</entry><entry><para>Mounts a ZFS dataset with read/write permissions in a labeled zone and
shares the dataset read-only with a higher zone.</para>
</entry><entry><para><olink targetptr="managezones-22" remap="internal">How to Share a ZFS Dataset From a
Labeled Zone</olink>.</para>
</entry>
</row><row><entry><para>Configure a new zone.</para>
</entry><entry><para>Creates a zone at a label that is not currently being used to label
a zone on this system.</para>
</entry><entry><para>See <olink targetptr="txconf-11" remap="internal">Name and Label
the Zone</olink>.</para><para>Then, follow the procedure that the initial setup team used to create
the other zones. For the steps, see <olink targetptr="txconf-20" remap="internal">Creating Labeled
Zones</olink>.</para>
</entry>
</row><row><?PubTbl row rht="0.54in"?><entry><para>Create a multilevel port for an application.</para>
</entry><entry><para>Multilevel ports are useful for programs that require a multilevel feed
into a labeled zone.</para>
</entry><entry><para><olink targetptr="managezones-28" remap="internal">How to Configure a Multilevel Port
for NFSv3 Over udp</olink></para><para><olink targetptr="managezones-5" remap="internal">How to Create a Multilevel Port for
a Zone</olink></para>
</entry>
</row><row><entry><para>Troubleshoot NFS mount and access problems.</para>
</entry><entry><para>Debugs general access issues for mounts and possibly for zones.</para>
</entry><entry><para><olink targetptr="managefiles-20" remap="internal">How to Troubleshoot Mount Failures
in Trusted Extensions</olink></para>
</entry>
</row><row><entry><para>Remove a labeled zone.</para>
</entry><entry><para>Completely removes a labeled zone from the system.</para>
</entry><entry><para><olink targetdoc="group-sa" targetptr="z.inst.task-44" remap="external"><citetitle remap="section">How to Remove a Non-Global Zone</citetitle> in <citetitle remap="book">System Administration Guide:  Virtualization Using the Solaris Operating System</citetitle></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><task id="managetnet-12"><title>How to Display Ready or Running
Zones</title><tasksummary><para><indexterm><primary>zones</primary><secondary>displaying status</secondary></indexterm><indexterm><primary>displaying</primary><secondary>status of every zone</secondary></indexterm>This procedure creates a shell script that displays
the labels of the current zone and all zones that the current zone dominates.</para>
</tasksummary><taskprerequisites><para>You must be in the System Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Use the trusted editor to create the <filename>getzonelabels</filename> script.</para><para>For details, see <olink targetptr="roles-10" remap="internal">How to Edit Administrative
Files in Trusted Extensions</olink>.</para><para>Provide the pathname to the script, such as <filename>/usr/local/scripts/getzonelabels</filename>.</para>
</step><step><para><indexterm><primary>files</primary><secondary><filename>getzonelabels</filename></secondary></indexterm><indexterm><primary>scripts</primary><secondary><filename>getzonelabels</filename></secondary></indexterm><indexterm><primary><filename>getzonelabels</filename> script</primary></indexterm><indexterm><primary><filename>/usr/local/scripts/getzonelabels</filename> script</primary></indexterm>Add the following content, and save the file:</para><screen>#!/bin/sh
#
echo "NAME\t\tSTATUS\t\tLABEL"
echo "====\t\t======\t\t====="
myzone=`zonename`
for i in `/usr/sbin/zoneadm list -p` ; do
        zone=`echo $i | cut -d ":" -f2`
        status=`echo $i | cut -d ":" -f3`
        path=`echo $i | cut -d ":" -f4`
        if [ $zone != global ]; then
                if [ $myzone = global ]; then
                        path=$path/root/tmp
                else
                        path=$path/export/home
                fi
        fi
        label=`/usr/bin/getlabel -s $path |cut -d ":" -f2-9`
        if [ `echo $zone|wc -m` -lt 8 ]; then
                echo "$zone\t\t$status\t$label"
        else
                echo "$zone\t$status\t$label"
        fi
done</screen>
</step><step><para>Test the script in the global zone.</para><screen># <userinput>getzonelabels</userinput>
NAME            STATUS          LABEL
====            ======          =====
global          running         ADMIN_HIGH
needtoknow      running         CONFIDENTIAL : NEED TO KNOW
restricted      ready           CONFIDENTIAL : RESTRICTED
internal        running         CONFIDENTIAL : INTERNAL
public          running         PUBLIC</screen><para>When run from the global zone, the script displays the labels of all
ready or running zones. Here is the global zone output for the zones that
were created from the default <filename>label_encodings</filename> file:</para>
</step>
</procedure><example id="managetnet-21"><title>Displaying the Labels of All Ready or Running Zones</title><para>In the following example, a user runs the <filename>getzonelabels</filename> script
in the <literal>internal</literal> zone.</para><screen># <userinput>getzonelabels</userinput>
NAME            STATUS          LABEL
====            ======          =====
internal        running         CONFIDENTIAL : INTERNAL
public          running         PUBLIC</screen>
</example>
</task><task id="managetnet-11"><title>How to Display the Labels of Mounted
Files</title><indexterm><primary>files</primary><secondary>accessing from dominating labels</secondary>
</indexterm><tasksummary><para>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.</para>
</tasksummary><taskprerequisites><para>You must be in the System Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Use the trusted editor to create the <filename>getmounts</filename> script.</para><para>For details, see <olink targetptr="roles-10" remap="internal">How to Edit Administrative
Files in Trusted Extensions</olink>.</para><para>Provide the pathname to the script, such as <filename>/usr/local/scripts/getmounts</filename>.</para>
</step><step><para><indexterm><primary>files</primary><secondary><filename>getmounts</filename></secondary></indexterm><indexterm><primary>scripts</primary><secondary><filename>getmounts</filename></secondary></indexterm><indexterm><primary><filename>getmounts</filename> script</primary></indexterm><indexterm><primary><filename>/usr/local/scripts/getmounts</filename> script</primary></indexterm>Add the following content and save the file:</para><screen>#!/bin/sh
#
for i in `/usr/sbin/mount -p | cut -d " " -f3` ; do
        /usr/bin/getlabel $i
done</screen>
</step><step><para>Test the script in the global zone.</para><screen># <userinput>/usr/local/scripts/getmounts</userinput>
/:      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</screen>
</step>
</procedure><example id="managezones-19"><title>Displaying the Labels of File Systems in the <literal>restricted</literal> Zone</title><indexterm><primary>displaying</primary><secondary>labels of file systems in labeled zone</secondary>
</indexterm><indexterm><primary>labels</primary><secondary>displaying labels of file systems in labeled zone</secondary>
</indexterm><indexterm><primary>zones</primary><secondary>displaying labels of file systems</secondary>
</indexterm><para>When run from a labeled zone by a regular user, the <filename>getmounts</filename> 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 <filename>label_encodings</filename> file,
the following is the output from the <literal>restricted</literal> zone:</para><screen># <userinput>/usr/local/scripts/getmounts</userinput>
/:      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</screen>
</example>
</task><task id="managezones-10"><title>How to Loopback Mount a File That Is Usually
Not Visible in a Labeled Zone</title><tasksummary><para><indexterm><primary>files</primary><secondary>loopback mounting</secondary></indexterm><indexterm><primary>mounting</primary><secondary>files by loopback mounting</secondary></indexterm>This procedure enables a user in a specified
labeled zone to view files that are not exported from the global zone by default.</para>
</tasksummary><taskprerequisites><para>You must be in the System Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Halt the zone whose configuration you want to change.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> halt</screen>
</step><step><para>Loopback mount a file or directory.</para><para>For example, enable
ordinary users to view a file in the <filename class="directory">/etc</filename> directory.</para><screen># zonecfg -z <replaceable>zone-name</replaceable>
 add filesystem
 set special=/etc/<replaceable>filename</replaceable>
 set directory=/etc/<replaceable>filename</replaceable>
 set type=lofs
 add options [ro,nodevices,nosetuid]
 end
 exit</screen><note><para>Certain files are not used by the system, so that loopback mounting
them has no effect. For example, the <filename>/etc/dfs/dfstab</filename> file
in a labeled zone is not checked by Trusted Extensions software. For more information,
see <olink targetptr="managefiles-18" remap="internal">Sharing Files From a Labeled Zone</olink>.</para>
</note>
</step><step><para>Start the zone.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> boot</screen>
</step>
</procedure><example id="managezones-14"><title>Loopback Mounting the <filename>/etc/passwd</filename> file</title><para>In this example, the security administrator wants to enable testers
and programmers to check that their local passwords are set. After the <literal>sandbox</literal> zone is halted, it is configured to loopback mount the <filename>passwd</filename> file. Then, the zone is restarted.</para><screen># <userinput>zoneadm -z sandbox halt</userinput>
# <userinput>zonecfg -z sandbox
 add filesystem
    set special=/etc/passwd
    set directory=/etc/passwd
    set type=lofs
    add options [ro,nodevices,nosetuid]
 end
 exit</userinput>
# <userinput>zoneadm -z sandbox boot</userinput></screen>
</example>
</task><task id="managezones-3"><title>How to Disable the Mounting of Lower-Level
Files</title><indexterm><primary>restricting</primary><secondary>access to lower-level files</secondary>
</indexterm><indexterm><primary>restricting</primary><secondary>mounts of lower-level files</secondary>
</indexterm><indexterm><primary>files</primary><secondary>preventing access from dominating labels</secondary>
</indexterm><indexterm><primary>protecting</primary><secondary>files at lower labels from being accessed</secondary>
</indexterm><indexterm><primary><constant>net_mac_aware</constant> privilege</primary>
</indexterm><tasksummary><para>By default, users can view lower-level files. Remove the <constant>net_mac_aware</constant> privilege to prevent the viewing of all lower-level files from
a particular zone. For a description of the <constant>net_mac_aware</constant> privilege,
see the <olink targetdoc="group-refman" targetptr="privileges-5" remap="external"><citerefentry><refentrytitle>privileges</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> man
page.</para>
</tasksummary><taskprerequisites><para>You must be in the System Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Halt the zone whose configuration you want to change.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> halt</screen>
</step><step><para>Configure the zone to prevent the viewing of lower-level files.</para><para>Remove the <constant>net_mac_aware</constant> privilege from the zone.</para><screen># zonecfg -z <replaceable>zone-name</replaceable>
 set limitpriv=default,!net_mac_aware
 exit</screen>
</step><step><para>Restart the zone.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> boot</screen>
</step>
</procedure><example id="managezones-11"><title>Preventing Users From Viewing Lower-Level Files</title><para>In this example, the security administrator wants to prevent users on
one system from being confused. Therefore, users can only view files at the
label at which the users are working. So, the security administrator prevents
the viewing of all lower-level files. On this system, users cannot see publicly
available files unless they are working at the <literal>PUBLIC</literal> label.
Also, users can only NFS mount files at the label of the zones.</para><screen># <userinput>zoneadm -z restricted halt</userinput>
# <userinput>zonecfg -z restricted
 set limitpriv=default,!net_mac_aware
 exit</userinput>
# <userinput>zoneadm -z restricted boot</userinput></screen><screen># <userinput>zoneadm -z needtoknow halt</userinput>
# <userinput>zonecfg -z needtoknow
 set limitpriv=default,!net_mac_aware
 exit</userinput>
# <userinput>zoneadm -z needtoknow boot</userinput></screen><screen># <userinput>zoneadm -z internal halt</userinput>
# <userinput>zonecfg -z internal
 set limitpriv=default,!net_mac_aware
 exit</userinput>
# <userinput>zoneadm -z internal boot</userinput></screen><para>Because <literal>PUBLIC</literal> is the lowest label, the security
administrator does not run the commands for the <literal>PUBLIC</literal> zone.</para>
</example>
</task><task id="managezones-22"><title>How to Share a ZFS Dataset From a Labeled
Zone</title><indexterm><primary>datasets</primary><see>ZFS</see>
</indexterm><indexterm><primary>mounting</primary><secondary>ZFS dataset on labeled zone</secondary>
</indexterm><indexterm><primary>ZFS</primary><secondary>adding dataset to labeled zone</secondary>
</indexterm><indexterm><primary>ZFS</primary><secondary>mounting dataset read-write on labeled zone</secondary>
</indexterm><indexterm><primary>sharing</primary><secondary>ZFS dataset from labeled zone</secondary>
</indexterm><tasksummary><para>In this procedure, you mount a ZFS dataset with read/write permissions
in a labeled zone. Because all commands are executed in the global zone, the
global zone administrator controls the addition of ZFS datasets to labeled
zones.</para><para>At a minimum, the labeled zone must be in the <literal>ready</literal> state
to share a dataset. The zone can be in the <literal>running</literal>  state.</para>
</tasksummary><taskprerequisites><para>To configure the zone with the dataset, you first halt the zone.</para>
</taskprerequisites><procedure><step><para>Create the ZFS dataset.</para><screen># zfs create <replaceable>datasetdir/subdir</replaceable></screen><para>The name of the dataset can include a directory, such as <filename>zone/data</filename>.</para>
</step><step><para>In the global zone, halt the labeled zone.</para><screen># zoneadm -z <replaceable>labeled-zone-name</replaceable> halt</screen>
</step><step><para>Set the mount point of the dataset.</para><screen># zfs set mountpoint=legacy <replaceable>datasetdir/subdir</replaceable></screen><para>Setting the ZFS <literal>mountpoint</literal> property sets the label
of the mount point when the mount point corresponds to a labeled zone.</para>
</step><step><para>Add the dataset to the zone as a file system.</para><screen># zonecfg -z <replaceable>labeled-zone-name</replaceable>
# zonecfg:<replaceable>labeled-zone-name</replaceable>&gt; add fs
# zonecfg:<replaceable>labeled-zone-name</replaceable>:dataset&gt; set dir=/<replaceable>subdir</replaceable>
# zonecfg:<replaceable>labeled-zone-name</replaceable>:dataset&gt; set special=<replaceable>datasetdir/subdir</replaceable>
# zonecfg:<replaceable>labeled-zone-name</replaceable>:dataset&gt; set type=zfs
# zonecfg:<replaceable>labeled-zone-name</replaceable>:dataset&gt; end
# zonecfg:<replaceable>labeled-zone-name</replaceable>&gt; exit</screen><para>By adding the dataset as a file system, the dataset is mounted at <filename class="directory">/data</filename> in the zone before the <filename>dfstab</filename> file
is interpreted. This step ensures that the dataset is not mounted before the
zone is booted. Specifically, the zone boots, the dataset is mounted, then
the <filename>dfstab</filename> file is interpreted.</para>
</step><step><para>Share the dataset.</para><para>Add an entry for the dataset file
system to the <filename>/zone/<replaceable>labeled-zone-name</replaceable>/etc/dfs/dfstab</filename> file. This entry also uses the <literal>/</literal><replaceable>subdir</replaceable> pathname.</para><screen>share  -F nfs  -d "<replaceable>dataset-comment</replaceable>"  /<replaceable>subdir</replaceable></screen>
</step><step><para>Boot the labeled zone.</para><screen># <userinput>zoneadm -z <replaceable>labeled-zone-name</replaceable> boot</userinput></screen><para>When the zone is booted, the dataset is mounted automatically as a read/write
mount point in the <replaceable>labeled-zone-name</replaceable> zone with
the label of the <replaceable>labeled-zone-name</replaceable> zone.</para>
</step>
</procedure><example id="managezones-23"><title>Sharing and Mounting a ZFS Dataset From Labeled Zones</title><indexterm><primary>accessing</primary><secondary>ZFS dataset mounted in lower-level zone from higher-level zone</secondary>
</indexterm><indexterm><primary>ZFS</primary><secondary>viewing mounted dataset read-only from higher-level zone</secondary>
</indexterm><para>In this example, the administrator adds a ZFS dataset to the <literal>needtoknow</literal> zone and shares the dataset. The dataset, <literal>zone/data</literal>,
is currently assigned to the <filename class="directory">/mnt</filename> mount
point. Users in the <literal>restricted</literal> zone can view the dataset.</para><para>First, the administrator halts the zone.</para><screen># <userinput>zoneadm -z needtoknow halt</userinput></screen><para>Because the dataset is currently assigned to a different mount point,
the administrator removes the previous assignment, then sets the new mount
point.</para><screen># <userinput>zfs set zoned=off zone/data</userinput>
# <userinput>zfs set mountpoint=legacy zone/data</userinput></screen><para>Next, in the <command>zonecfg</command> interactive interface, the administrator
explicitly adds the dataset to the <literal>needtoknow</literal> zone.</para><screen># <userinput>zonecfg -z needtoknow</userinput>
# <userinput>zonecfg:needtoknow&gt; add fs</userinput>
# <userinput>zonecfg:needtoknow:dataset&gt; set dir=/data</userinput>
# <userinput>zonecfg:needtoknow:dataset&gt; set special=zone/data</userinput>
# <userinput>zonecfg:needtoknow:dataset&gt; set type=zfs</userinput>
# <userinput>zonecfg:needtoknow:dataset&gt; end</userinput>
# <userinput>zonecfg:needtoknow&gt; exit</userinput></screen><para>Next, the administrator modifies the <filename>/zone/needtoknow/etc/dfs/dfstab</filename> file to share the dataset, then boots the <literal>needtoknow</literal> zone.</para><screen><userinput>## Global zone dfstab file for needtoknow zone</userinput>
<userinput>share  -F nfs  -d "App Data on ZFS"  /data</userinput></screen><screen># <userinput>zoneadm -z needtoknow boot</userinput></screen><para>The dataset is now accessible.</para><para>Users in the the <literal>restricted</literal> zone, which dominates
the <filename>needtoknow</filename> zone, can view the mounted dataset by
changing to the <filename class="directory">/data</filename> directory. They
use the full path to the mounted dataset from the perspective of the global
zone. In this example, <literal>machine1</literal> is the host name of the
system that includes the labeled zone. The administrator assigned this host
name to a non-shared IP address.</para><screen># <userinput>cd /net/machine1/zone/needtoknow/root/data</userinput></screen>
</example><taskrelated role="troubleshooting"><para><indexterm><primary>troubleshooting</primary><secondary>viewing ZFS dataset mounted in lower-level zone</secondary></indexterm>If the attempt
to reach the dataset from the higher label returns the error <literal>not
found</literal> or <literal>No such file or directory</literal>, the administrator
must restart the automounter service by running the <command>svcadm restart
autofs</command> command.</para>
</taskrelated>
</task><task id="managezones-8"><title>How to Enable Files to be Relabeled
From a Labeled Zone</title><tasksummary><para><indexterm><primary>files</primary><secondary>relabeling privileges</secondary></indexterm>This procedure is a prerequisite for a user to be able to relabel
files.</para>
</tasksummary><taskprerequisites><para>You must be in the Security Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Halt the zone whose configuration you want to change.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> halt</screen>
</step><step><para>Configure the zone to enable relabeling.</para><para>Add the appropriate
privileges to the zone. The windows privileges enable users to use drag-and-drop
and cut-and-paste operations.</para><stepalternatives><step><para>To enable downgrades, add the <constant>file_downgrade_sl</constant> privilege
to the zone.</para><screen># zonecfg -z <replaceable>zone-name</replaceable>
 set limitpriv=default,win_dac_read,win_mac_read,win_dac_write,
 win_mac_write,win_selection,file_downgrade_sl
 exit</screen>
</step><step><para>To enable upgrades, add the <constant>sys_trans_label</constant> and <constant>file_upgrade_sl</constant> privileges to the zone.</para><screen># zonecfg -z <replaceable>zone-name</replaceable>
 set limitpriv=default,win_dac_read,win_mac_read,win_dac_write,
 win_mac_write,win_selection,sys_trans_label,file_upgrade_sl
 exit</screen>
</step><step><para>To enable both upgrades and downgrades, add all three privileges
to the zone.</para><screen># zonecfg -z <replaceable>zone-name</replaceable>
 set limitpriv=default,win_dac_read,win_mac_read,win_dac_write,
 win_mac_write,win_selection,sys_trans_label,file_downgrade_sl,
 file_upgrade_sl
 exit</screen>
</step>
</stepalternatives>
</step><step><para>Restart the zone.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> boot</screen><para>For the user and process requirements that permit relabeling, see the <olink targetdoc="group-refman" targetptr="setflabel-3tsol" remap="external"><citerefentry><refentrytitle>setflabel</refentrytitle><manvolnum>3TSOL</manvolnum></citerefentry></olink> man page. To authorize a user to relabel files, see <olink targetptr="manageusers-16" remap="internal">How to Enable a User to Change the Security Level
of Data</olink>.</para>
</step>
</procedure><example id="managezones-7"><title>Enabling Upgrades From the <literal>internal</literal> Zone</title><para>In this example, the security administrator wants to enable authorized
users on a system to upgrade files. By enabling users to upgrade information,
the administrator enables them to protect the information at a higher level
of security. In the global zone, the administrator runs the following zone
administration commands.</para><screen># <userinput>zoneadm -z internal halt</userinput>
# <userinput>zonecfg -z internal
 set limitpriv=default,sys_trans_label,file_upgrade_sl
 exit</userinput>
# <userinput>zoneadm -z internal boot</userinput></screen><para>Authorized users can now upgrade <constant>internal</constant> information
to <constant>restricted</constant> from the <constant>internal</constant> zone.</para>
</example><example id="managezones-9"><title>Enabling Downgrades From the <literal>restricted</literal> Zone</title><para>In this example, the security administrator wants to enable authorized
users on a system to downgrade files. Because the administrator does not add
windows privileges to the zone, authorized users cannot use the File Manager
to relabel files. To relabel files, users use the <command>setlabel</command> command.</para><para>By enabling users to downgrade information, the administrator permits
users at a lower level of security to access the files. In the global zone,
the administrator runs the following zone administration commands.</para><screen># <userinput>zoneadm -z restricted halt</userinput>
# <userinput>zonecfg -z restricted
 set limitpriv=default,file_downgrade_sl
 exit</userinput>
# <userinput>zoneadm -z restricted boot</userinput></screen><para>Authorized users can now downgrade <constant>restricted</constant> information
to <constant>internal</constant> or <constant>public</constant> from the <constant>restricted</constant> zone by using the <command>setlabel</command> command.</para>
</example>
</task><task id="managezones-28"><title>How to Configure a Multilevel Port for NFSv3
Over <literal>udp</literal></title><tasksummary><para><indexterm><primary>Trusted Network Zones tool</primary><secondary>configuring a multilevel port</secondary></indexterm><indexterm><primary>zones</primary><secondary>creating MLP for NFSv3</secondary></indexterm><indexterm><primary>multilevel ports (MLPs)</primary><secondary>example of NFSv3 MLP</secondary></indexterm>This
procedure is used to enable NFSv3 read-down mounts over <literal>udp</literal>.
The Solaris Management Console is used to add the MLP.</para>
</tasksummary><taskprerequisites><para>You must be in the Security Administrator role in the global zone.</para>
</taskprerequisites><procedure><step><para>Start the Solaris Management Console.</para><para>For details, see <olink targetptr="roles-15" remap="internal">How to Administer the Local System With the Solaris Management
Console</olink>.</para>
</step><step><para>Choose the Files toolbox.</para><para>The title of the toolbox
includes <literal>Scope=Files, Policy=TSOL</literal>.</para>
</step><step><para>Configure the zone and the MLP.</para><substeps><step><para>Navigate to the Trusted Network Zones tool.</para>
</step><step><para>Double-click the global zone.</para>
</step><step><para>Add a multilevel port for the UDP protocol:</para><substeps><step><para>Click Add for the Multilevel Ports for Zone's IP Addresses.</para>
</step><step><para>Type 2049 for the port number, and click OK.</para>
</step>
</substeps>
</step><step><para>Click OK to save the settings.</para>
</step>
</substeps>
</step><step><para>Close the Solaris Management Console.</para>
</step><step><para>Update the kernel.</para><screen># <userinput>tnctl -fz /etc/security/tsol/tnzonecfg</userinput></screen>
</step>
</procedure>
</task><task id="managezones-5"><title>How to Create a Multilevel Port for a Zone</title><tasksummary><para><indexterm><primary>Trusted Network Zones tool</primary><secondary>creating a multilevel port</secondary></indexterm><indexterm><primary>zones</primary><secondary>creating MLP</secondary></indexterm><indexterm><primary>multilevel ports (MLPs)</primary><secondary>example of web proxy MLP</secondary></indexterm>This procedure is used when an application that runs in a labeled
zone requires a multilevel port (MLP) to communicate with the zone. In this
procedure, a web proxy communicates with the zone. The Solaris Management Console is used to add
the MLP.</para>
</tasksummary><taskprerequisites><para>You must be in the Security Administrator role in the global zone. The
labeled zone must exist. For details, see <olink targetptr="txconf-20" remap="internal">Creating Labeled
Zones</olink>.</para>
</taskprerequisites><procedure><step><para>Start the Solaris Management Console.</para><para>For details, see <olink targetptr="roles-15" remap="internal">How to Administer the Local System With the Solaris Management
Console</olink>.</para>
</step><step><para>Choose the Files toolbox.</para><para>The title of the toolbox
includes <literal>Scope=Files, Policy=TSOL</literal>.</para>
</step><step><para>Add the proxy host and the webservices host to the list of computers.</para><substeps><step><para>Under System Configuration, navigate to the Computers and Networks
tool.</para>
</step><step><para>In the Computers tool, click the Action menu and choose Add Computer.</para>
</step><step><para>Add the host name and IP address for the proxy host.</para>
</step><step><para>Save the changes.</para>
</step><step><para>Add the host name and IP address for the webservice host.</para>
</step><step><para>Save the changes.</para>
</step>
</substeps>
</step><step><para>Configure the zone and the MLP.</para><substeps><step><para>Navigate to the Trusted Network Zones tool.</para>
</step><step><para>Select the labeled zone.</para>
</step><step><para>In the MLP Configuration for Local IP Addresses section, specify
the appropriate port/protocol field.</para>
</step><step><para>Save the changes.</para>
</step>
</substeps>
</step><step><para>For the zone, customize a template by completing the following
steps:</para><substeps><step><para>Navigate to the Security Templates tool.</para><para>Click the
Action menu and choose Add Template.</para>
</step><step><para>Use the host name for the template name.</para>
</step><step><para>Specify CIPSO for the Host Type.</para>
</step><step><para>Use the label of the zone for the Minimum Label and for the Maximum
Label.</para>
</step><step><para>Assign the zone label to the Security Label Set.</para>
</step><step><para>Select the Hosts Explicitly Assigned tab.</para>
</step><step><para>In the Add an Entry section, add the IP address that is associated
with the zone.</para>
</step><step><para>Save the changes.</para>
</step>
</substeps>
</step><step><para>Close the Solaris Management Console.</para>
</step><step><para>Start the zones.</para><screen># zoneadm -z <replaceable>zone-name</replaceable> boot</screen>
</step><step><para>In the global zone, add routes for the new addresses.</para><para>For
example, if the zones have a shared IP address, do the following:</para><screen># route add <replaceable>proxy</replaceable> <replaceable>labeled-zones-IP-address</replaceable>
# route add <replaceable>webservice</replaceable> <replaceable>labeled-zones-IP-address</replaceable></screen>
</step>
</procedure>
</task>
</sect1>
</chapter><?Pub *0000054822 0?>