<?Pub UDT _bookmark _target?><?Pub CX solbook(?><chapter id="devtask-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag atict:user
user="sharonr" fullname="Sharon Veach"?><title>Controlling Access to Devices
(Tasks)</title><highlights><para>This chapter provides step-by-step instructions for protecting devices,
in addition to a reference section. The following is a list of the information
in this chapter.</para><itemizedlist><listitem><para><olink targetptr="devtask-45" remap="internal">Configuring Devices (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devtask-10" remap="internal">Configuring Device Policy (Task
Map)</olink></para>
</listitem><listitem><para><olink targetptr="devtask-3" remap="internal">Managing Device Allocation (Task
Map)</olink></para>
</listitem><listitem><para><olink targetptr="devtask-48" remap="internal">Allocating Devices (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devtask-16" remap="internal">Device Protection (Reference)</olink></para>
</listitem>
</itemizedlist><para>For overview information about device protection, see <olink targetptr="concept-42" remap="internal">Controlling Access to Devices</olink>.</para>
</highlights><sect1 id="devtask-45"><title>Configuring Devices (Task Map)</title><indexterm><primary>task maps</primary><secondary>devices</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>configuring devices</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>devices task map</secondary>
</indexterm><para>The following task map points to tasks for managing access to devices.</para><informaltable frame="all" pgwide="1"><tgroup cols="2" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="88.50*"/><colspec colname="colspec1" colwidth="161.65*"/><thead><row><entry><para>Task</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Manage device policy</para>
</entry><entry><para><olink targetptr="devtask-10" remap="internal">Configuring Device Policy (Task Map)</olink></para>
</entry>
</row><row><entry><para>Manage device allocation</para>
</entry><entry><para><olink targetptr="devtask-3" remap="internal">Managing Device Allocation (Task Map)</olink></para>
</entry>
</row><row><entry><para>Use device allocation</para>
</entry><entry><para><olink targetptr="devtask-48" remap="internal">Allocating Devices (Task Map)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devtask-10"><title>Configuring Device Policy (Task Map)</title><indexterm><primary>task maps</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>managing device policy</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>configuring device policy</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>managing</secondary>
</indexterm><indexterm><primary>device policy</primary><secondary>managing devices</secondary>
</indexterm><indexterm><primary>device policy</primary><secondary>task map</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>device policy</secondary>
</indexterm><para>The following task map points to device configuration procedures that
are related to device policy.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="117.42*"/><colspec colname="col2" colwidth="145.87*"/><colspec colname="colspec1" colwidth="132.73*"/><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 the device policy for the devices on your system</para>
</entry><entry><para>Lists the devices and their device policy.</para>
</entry><entry><para><olink targetptr="devtask-6" remap="internal">How to View Device Policy</olink></para>
</entry>
</row><row><entry><para>Require privilege for device use</para>
</entry><entry><para>Uses privileges to protect a device.</para>
</entry><entry><para><olink targetptr="devtask-19" remap="internal">How to Change the Device Policy on an
Existing Device</olink></para>
</entry>
</row><row><entry><para>Remove privilege requirements from a device</para>
</entry><entry><para>Removes or lessens the privileges that are required to access a device.</para>
</entry><entry><para><olink targetptr="devtask-37" remap="internal">Example&nbsp;5&ndash;3</olink></para>
</entry>
</row><row><entry><para>Audit changes in device policy</para>
</entry><entry><para>Records changes in device policy in the audit trail</para>
</entry><entry><para><olink targetptr="devtask-56" remap="internal">How to Audit Changes in Device Policy</olink></para>
</entry>
</row><row><entry><para>Access <filename>/dev/arp</filename></para>
</entry><entry><para>Gets Solaris IP MIB-II information.</para>
</entry><entry><para><olink targetptr="devtask-23" remap="internal">How to Retrieve IP MIB-II Information
From a /dev/* Device</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devtask-30"><title>Configuring Device Policy</title><indexterm><primary>device management</primary><see>device policy</see>
</indexterm><indexterm><primary>devices</primary><secondary>device allocation</secondary><see>device allocation</see>
</indexterm><indexterm><primary>device policy</primary><secondary>configuring</secondary>
</indexterm><para><indexterm><primary>access</primary><secondary>restricting for</secondary><tertiary>devices</tertiary></indexterm><indexterm><primary>access</primary><secondary>security</secondary><tertiary>devices</tertiary></indexterm>Device
policy restricts or prevents access to devices that are integral to the system.
The policy is enforced in the kernel.</para><task id="devtask-6"><title>How to View Device Policy</title><indexterm><primary>new features</primary><secondary>commands</secondary><tertiary><command>getdevpolicy</command></tertiary>
</indexterm><indexterm><primary>device policy</primary><secondary>viewing</secondary>
</indexterm><indexterm><primary>listing</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>policies</primary><secondary>on devices</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>viewing device policy</secondary>
</indexterm><indexterm><primary>viewing</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>listing</secondary>
</indexterm><indexterm><primary>displaying</primary><secondary>device policy</secondary>
</indexterm><procedure remap="single-step"><step><para>Display the device policy for all devices on your system.</para><screen>% <userinput>getdevpolicy | more</userinput>
DEFAULT
        read_priv_set=none
        write_priv_set=none
ip:*
        read_priv_set=net_rawaccess
        write_priv_set=net_rawaccess
&hellip;</screen>
</step>
</procedure><example id="devtask-35"><title>Viewing the Device Policy for a Specific Device</title><para>In this example, the device policy for three devices is displayed.</para><screen>% <userinput>getdevpolicy /dev/allkmem /dev/ipsecesp /dev/hme</userinput>
/dev/allkmem
        read_priv_set=all
        write_priv_set=all
/dev/ipsecesp
        read_priv_set=sys_net_config
        write_priv_set=sys_net_config
/dev/hme
        read_priv_set=net_rawaccess
        write_priv_set=net_rawaccess</screen>
</example>
</task><task id="devtask-19"><title>How to Change the Device Policy on an Existing
Device</title><indexterm><primary>device policy</primary><secondary>changing</secondary>
</indexterm><indexterm><primary>changing</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>security to devices</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>adding device policy</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>changing device policy</secondary>
</indexterm><indexterm><primary><command>update_drv</command> command</primary><secondary>using</secondary>
</indexterm><indexterm><primary>device policy</primary><secondary><command>update_drv</command> command</secondary>
</indexterm><procedure><step><para>Assume a role that includes the Device Security rights profile,
or become superuser.</para><para>The Primary Administrator role includes the
Device Security rights profile. You can also assign the Device Security rights
profile to a role that you create. To create the role and assign the role
to a user, see <olink targetptr="rbactask-39" remap="internal">Example&nbsp;9&ndash;3</olink>.</para>
</step><step><para>Add policy to a device.</para><screen># update_drv -a -p <replaceable>policy device-driver</replaceable></screen><variablelist><varlistentry><term><option>a</option></term><listitem><para>Specifies a <replaceable>policy</replaceable> for <replaceable>device-driver</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>policy</replaceable></term><listitem><para>Is the device policy for <replaceable>device-driver</replaceable>.
Device policy specifies two sets of privileges. One set is required to read
the device. The other set is required to write to the device.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-driver</replaceable></term><listitem><para>Is the device driver.</para>
</listitem>
</varlistentry>
</variablelist><para>For more information, see the <olink targetdoc="group-refman" targetptr="update-drv-1m" remap="external"><citerefentry><refentrytitle>update_drv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</procedure><example id="devtask-29"><title>Adding Policy to an Existing Device</title><para>In the following example, device policy is added to the <literal>ipnat</literal> device.</para><screen># <userinput>getdevpolicy /dev/ipnat</userinput>
/dev/ipnat
        read_priv_set=none
        write_priv_set=none
# <userinput>update_drv -a \</userinput>
<userinput>-p 'read_priv_set=net_rawaccess write_priv_set=net_rawaccess' ipnat</userinput>
# <userinput>getdevpolicy /dev/ipnat</userinput>
/dev/ipnat
        read_priv_set=net_rawaccess
        write_priv_set=net_rawaccess</screen>
</example><example id="devtask-37"><title>Removing Policy From a Device</title><indexterm><primary>devices</primary><secondary>removing policy</secondary>
</indexterm><indexterm><primary>removing</primary><secondary>policy from device</secondary>
</indexterm><indexterm><primary>removing</primary><secondary>device policy</secondary>
</indexterm><indexterm><primary>device policy</primary><secondary>removing from device</secondary>
</indexterm><para>In the following example, the read set of privileges is removed from
the device policy for the <literal>ipnat</literal> device.</para><screen># <userinput>getdevpolicy /dev/ipnat</userinput>
/dev/ipnat
        read_priv_set=net_rawaccess
        write_priv_set=net_rawaccess
# <userinput>update_drv -a -p write_priv_set=net_rawaccess ipnat</userinput>
# <userinput>getdevpolicy /dev/ipnat</userinput>
/dev/ipnat
        read_priv_set=none
        write_priv_set=net_rawaccess</screen>
</example>
</task><task id="devtask-56"><title>How to Audit Changes in Device Policy</title><indexterm><primary>devices</primary><secondary>auditing policy changes</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>changes in device policy</secondary>
</indexterm><indexterm><primary>device policy</primary><secondary>auditing changes</secondary>
</indexterm><tasksummary><para>By default, the <literal>as</literal> audit class includes the <literal>AUE_MODDEVPLCY</literal> audit event.</para>
</tasksummary><procedure>&rolePAstep;<step><para>Preselect the audit class that includes <literal>AUE_MODDEVPLCY</literal> audit
event.</para><para>Add the <literal>as</literal> class to the <literal>flags</literal> line
of the <filename>audit_control</filename> file. The file would appear similar
to the following:</para><screen># audit_control file
dir:/var/audit
flags:lo,<userinput>as</userinput>
minfree:20
naflags:lo</screen><para>For detailed instructions, see <olink targetptr="audittask-45" remap="internal">How to
Modify the audit_control File</olink>.</para>
</step>
</procedure>
</task><task id="devtask-23"><title>How to Retrieve IP MIB-II Information
From a <filename>/dev/*</filename> Device</title><indexterm><primary>devices</primary><secondary>getting IP MIB-II information</secondary>
</indexterm><indexterm><primary>IP MIB-II</primary><secondary>getting information from <filename>/dev/arp</filename></secondary>
</indexterm><indexterm><primary><filename>/dev/arp</filename> device</primary><secondary>getting IP MIB-II information</secondary>
</indexterm><tasksummary><para>Applications that retrieve Solaris IP MIB-II information should open <filename>/dev/arp</filename>, not <filename>/dev/ip</filename>.</para>
</tasksummary><procedure><step><para>Determine the device policy on <filename>/dev/ip</filename> and <filename>/dev/arp</filename>.</para><screen>% <userinput>getdevpolicy /dev/ip /dev/arp</userinput>
/dev/ip
        read_priv_set=net_rawaccess
        write_priv_set=net_rawaccess
/dev/arp
        read_priv_set=none
        write_priv_set=none</screen><para>Note that the <literal>net_rawaccess</literal> privilege is required
for reading and writing to <filename>/dev/ip</filename>. No privileges are
required for <filename>/dev/arp</filename>.</para>
</step><step><para>Open <filename>/dev/arp</filename> and push the <literal>tcp</literal> and <literal>udp</literal> modules.</para><para>No privileges are required. This method
is equivalent to opening <filename>/dev/ip</filename> and pushing the <literal>arp</literal>, <literal>tcp</literal> and <literal>udp</literal> modules. Because
opening <filename>/dev/ip</filename> now requires a privilege, the <filename>/dev/arp</filename> method is preferred.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="devtask-3"><title>Managing Device Allocation (Task Map)</title><indexterm><primary>task maps</primary><secondary>managing device allocation</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>managing</primary><secondary>device allocation task map</secondary>
</indexterm><indexterm><primary>managing</primary><secondary>devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>adding devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>managing devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>task map</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>managing allocation of</secondary>
</indexterm><para>The following task map points to procedures that enable and configure
device allocation. Device allocation is not enabled by default. After device
allocation is enabled, see <olink targetptr="devtask-48" remap="internal">Allocating Devices
(Task Map)</olink>.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110.00*"/><colspec colname="col2" colwidth="154.00*"/><colspec colname="colspec1" colwidth="132.01*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Make a device allocatable</para>
</entry><entry><para>Enables a device to be allocated to one user at a time.</para>
</entry><entry><para><olink targetptr="devtask-20" remap="internal">How to Make a Device Allocatable</olink></para>
</entry>
</row><row><entry><para>Authorize users to allocate a device</para>
</entry><entry><para>Assigns device allocation authorizations to users.</para>
</entry><entry><para><olink targetptr="devtask-36" remap="internal">How to Authorize Users to Allocate a Device</olink></para>
</entry>
</row><row><entry><para>View the allocatable devices on your system</para>
</entry><entry><para>Lists the devices that are allocatable, and the state of the device.</para>
</entry><entry><para><olink targetptr="devtask-26" remap="internal">How to View Allocation Information About
a Device</olink></para>
</entry>
</row><row><entry><para>Forcibly allocate a device</para>
</entry><entry><para>Allocates a device to a user who has an immediate need</para>
</entry><entry><para><olink targetptr="devtask-13" remap="internal">Forcibly Allocating a Device</olink></para>
</entry>
</row><row><entry><para>Forcibly deallocate a device</para>
</entry><entry><para>Deallocates a device that is currently allocated to a user</para>
</entry><entry><para><olink targetptr="devtask-31" remap="internal">Forcibly Deallocating a Device</olink></para>
</entry>
</row><row><entry><para>Change the allocation properties of a device</para>
</entry><entry><para>Changes the requirements for allocating a device</para>
</entry><entry><para><olink targetptr="devtask-5" remap="internal">How to Change Which Devices Can Be Allocated</olink></para>
</entry>
</row><row><entry><para>Create a device-clean script</para>
</entry><entry><para>Purges data from a physical device.</para>
</entry><entry><para><olink targetptr="devtask-7" remap="internal">Writing New Device-Clean Scripts</olink></para>
</entry>
</row><row><entry><para>Disable device allocation</para>
</entry><entry><para>Removes allocation restrictions from all devices.</para>
</entry><entry><para><olink targetptr="audittask-31" remap="internal">How to Disable the Auditing Service</olink></para>
</entry>
</row><row><entry><para>Audit device allocation</para>
</entry><entry><para>Records device allocation in the audit trail</para>
</entry><entry><para><olink targetptr="devtask-58" remap="internal">How to Audit Device Allocation</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devtask-32"><title>Managing Device Allocation</title><indexterm><primary>adding</primary><secondary>security to devices</secondary>
</indexterm><para>Device allocation restricts or prevents access to peripheral devices.
Restrictions are enforced at user allocation time. By default, users must
have authorization to access allocatable devices.</para><task id="devtask-20"><title>How to Make a Device Allocatable</title><indexterm><primary>devices</primary><secondary>making allocatable</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>making device allocatable</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>enabling</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>allocatable device</secondary>
</indexterm><indexterm><primary>enabling</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>starting</primary><secondary>device allocation</secondary>
</indexterm><tasksummary><para>If you have already run the <command>bsmconv</command> command to enable
auditing, then device allocation is already enabled on your system. For more
information, see the <olink targetdoc="group-refman" targetptr="bsmconv-1m" remap="external"><citerefentry><refentrytitle>bsmconv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Control rights profile,
or become superuser.</para><para>The Primary Administrator role includes the
Audit Control rights profile. You can also assign the Audit Control rights
profile to a role that you create. To create the role and assign the role
to a user, see <olink targetptr="rbactask-39" remap="internal">Example&nbsp;9&ndash;3</olink>.</para>
</step><step><para><indexterm><primary>scripts</primary><secondary><command>bsmconv</command> for device allocation</secondary></indexterm><indexterm><primary>device allocation</primary><secondary>enabling</secondary></indexterm><indexterm><primary>enabling</primary><secondary>device allocation</secondary></indexterm>Enable device allocation.</para><screen># <userinput>bsmconv</userinput>
This script is used to enable the Basic Security Module (BSM).
Shall we continue with the conversion now? [y/n] <userinput>y</userinput>
bsmconv: INFO: checking startup file.
bsmconv: INFO: move aside /etc/rc3.d/S81volmgt.
bsmconv: INFO: turning on audit module.
bsmconv: INFO: initializing device allocation files.

The Basic Security Module is ready.
If there were any errors, please fix them now.
Configure BSM by editing files located in /etc/security.
Reboot this system now to come up with BSM enabled.</screen><note><para>The Volume Management daemon (<literal>/etc/rc3.d/S81volmgt</literal>)
is disabled by this command.</para>
</note>
</step>
</procedure>
</task><task id="devtask-36"><title>How to Authorize Users to Allocate a Device</title><indexterm><primary>devices</primary><secondary>authorizing users to allocate</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>authorizing users to allocate</secondary>
</indexterm><indexterm><primary>users</primary><secondary>assigning allocate authorization to</secondary>
</indexterm><indexterm><primary>authorizations (RBAC)</primary><secondary>for allocating device</secondary>
</indexterm><procedure>&rolePAstep;<step><para>Create a rights profile that contains the appropriate authorization
and commands.</para><itemizedlist><para><indexterm><primary><command>allocate</command> command</primary><secondary>user authorization</secondary></indexterm><indexterm><primary>authorizations (RBAC)</primary><secondary><literal>solaris.device.allocate</literal></secondary></indexterm><indexterm><primary>security attributes</primary><secondary>using to mount allocated device</secondary></indexterm><indexterm><primary><command>mount</command> command</primary><secondary>with security attributes</secondary></indexterm><indexterm><primary><command>umount</command> command</primary><secondary>with security attributes</secondary></indexterm>Typically, you
would create a rights profile that includes the <literal>solaris.device.allocate</literal> authorization.
Follow the instructions in <olink targetptr="rbactask-24" remap="internal">How to Create or
Change a Rights Profile</olink>. Give the rights profile appropriate properties,
such as the following:</para><listitem><para>Rights profile name: <literal>Device Allocation</literal></para>
</listitem><listitem><para>Granted authorizations: <literal>solaris.device.allocate</literal></para>
</listitem><listitem><para>Commands with security attributes: <command>mount</command> with
the <literal>sys_mount</literal> privilege, and <command>umount</command> with
the <literal>sys_mount</literal> privilege</para>
</listitem>
</itemizedlist>
</step><step><para>Create a role for the rights profile.</para><itemizedlist><para>Follow the instructions in <olink targetptr="rbactask-32" remap="internal">How to Create and Assign a Role by Using the GUI</olink>. Use the following role properties
as a guide:</para><listitem><para>Role name: <literal>devicealloc</literal></para>
</listitem><listitem><para>Role full name: <literal>Device Allocator</literal></para>
</listitem><listitem><para>Role description: <literal>Allocates and mounts allocated
devices</literal></para>
</listitem><listitem><para>Rights profile: <literal>Device Allocation</literal></para><para>This rights profile must be at the top of the list of profiles that
are included in the role.</para>
</listitem>
</itemizedlist>
</step><step><para>Assign the role to every user who is permitted to allocate a device.</para>
</step><step><para>Teach the users how to use device allocation.</para><para>For
examples of allocating removable media, see <olink targetptr="devtask-8" remap="internal">How
to Allocate a Device</olink>. </para><para><indexterm><primary>daemons</primary><secondary><command>vold</command></secondary></indexterm><indexterm><primary><command>vold</command> daemon</primary><secondary>turned off by device allocation</secondary></indexterm>Because the Volume Management daemon (<command>vold</command>)
is not running, removable media are not automatically mounted. For examples
of mounting a device that has been allocated, see <olink targetptr="devtask-51" remap="internal">How
to Mount an Allocated Device</olink>.</para>
</step>
</procedure>
</task><task id="devtask-26"><title>How to View Allocation Information About a Device</title><indexterm><primary>device allocation</primary><secondary>viewing information</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>viewing allocation information</secondary>
</indexterm><indexterm><primary>viewing</primary><secondary>device allocation information</secondary>
</indexterm><indexterm><primary>displaying</primary><secondary>allocatable devices</secondary>
</indexterm><taskprerequisites><para>Device allocation must be enabled for this procedure to succeed. To
enable device allocation, see <olink targetptr="devtask-20" remap="internal">How to Make a
Device Allocatable</olink>.</para>
</taskprerequisites><procedure><step><para>Assume a role that includes the Device Security rights profile,
or become superuser.</para><para>The Primary Administrator role includes the
Device Security rights profile. You can also assign the Device Security rights
profile to a role that you create. To create the role and assign the role
to a user, see <olink targetptr="rbactask-39" remap="internal">Example&nbsp;9&ndash;3</olink>.</para>
</step><step><para><indexterm><primary>devices</primary><secondary>listing device names</secondary></indexterm><indexterm><primary>naming conventions</primary><secondary>devices</secondary></indexterm>Display information about allocatable
devices on your system.</para><screen># list_devices <replaceable>device-name</replaceable></screen><itemizedlist><para>where <replaceable>device-name</replaceable> is one of the following:</para><listitem><para><literal>audio</literal>[<replaceable>n</replaceable>] &ndash;
Is a microphone and speaker.</para>
</listitem><listitem><para><literal>fd</literal>[<replaceable>n</replaceable>] &ndash;
Is a diskette drive.</para>
</listitem><listitem><para><literal>sr</literal>[<replaceable>n</replaceable>] &ndash;
 Is a CD-ROM drive.</para>
</listitem><listitem><para><literal>st</literal>[<replaceable>n</replaceable>] &ndash;
 Is a tape drive.</para>
</listitem>
</itemizedlist>
</step>
</procedure><taskrelated role="troubleshooting"><para><indexterm><primary>troubleshooting</primary><secondary><command>list_devices</command> command</secondary></indexterm>If the <command>list_devices</command> command
returns an error message similar to the following, then  either device allocation
is not enabled, or you do not have sufficient permissions to retrieve the
information.</para><para><literal>list_devices: No device maps file entry for specified device.</literal></para><para>For the command to succeed, enable device allocation and assume a role
with  the <literal>solaris.device.revoke</literal> authorization.</para>
</taskrelated>
</task><task id="devtask-13"><title>Forcibly Allocating a Device</title><indexterm><primary>allocating devices</primary><secondary>forcibly</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>forcibly allocating</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>forcibly allocating devices</secondary>
</indexterm><tasksummary><para>Forcible allocation is used when someone has forgotten to deallocate
a device. Forcible allocation can also be used when a user has an immediate
need for a device.</para>
</tasksummary><taskprerequisites><para>The user or role must have the <literal>solaris.device.revoke</literal> authorization. </para>
</taskprerequisites><procedure><step><para>Determine if you have the appropriate authorizations in your role.</para><screen>$ <userinput>auths</userinput>
solaris.device.allocate solaris.device.revoke</screen>
</step><step><para>Forcibly allocate the device to the user who needs the device.</para><para>In this example, the tape drive is forcibly allocated to the user <literal>jdoe</literal>.</para><screen>$ <userinput>allocate -U jdoe</userinput></screen>
</step>
</procedure>
</task><task id="devtask-31"><title>Forcibly Deallocating a Device</title><indexterm><primary>deallocating</primary><secondary>forcibly</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>forcibly deallocating</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>forcibly deallocating devices</secondary>
</indexterm><tasksummary><para>Devices that a user has allocated are not automatically deallocated
when the process terminates or when the user logs out. Forcible deallocation
is used when a user has forgotten to deallocate a device.</para>
</tasksummary><taskprerequisites><para>The user or role must have the <literal>solaris.device.revoke</literal> authorization. </para>
</taskprerequisites><procedure><step><para>Determine if you have the appropriate authorizations in your role.</para><screen>$ <userinput>auths</userinput>
solaris.device.allocate solaris.device.revoke</screen>
</step><step><para>Forcibly deallocate the device.</para><para>In this example, the
printer is forcibly deallocated. The printer is now available for allocation
by another user.</para><screen>$ <userinput>deallocate -f /dev/lp/printer-1</userinput></screen>
</step>
</procedure>
</task><task id="devtask-5"><title>How to Change Which Devices Can Be Allocated</title><indexterm><primary>changing</primary><secondary>allocatable devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>changing allocatable devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>requiring authorization</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>changing which are allocatable</secondary>
</indexterm><procedure><step><para>Assume a role that includes the Device Security rights profile,
or become superuser.</para><para>The Primary Administrator role includes the
Device Security rights profile. You can also assign the Device Security rights
profile to a role that you create. To create the role and assign the role
to a user, see <olink targetptr="rbactask-39" remap="internal">Example&nbsp;9&ndash;3</olink>.</para>
</step><step><para>Specify if authorization is required, or specify the <literal>solaris.device.allocate</literal>  authorization.</para><para><indexterm><primary><filename>device_allocate</filename> file</primary><secondary>sample</secondary></indexterm>Change
the fifth field in the device entry in the <filename>device_allocate</filename> file.</para><screen>audio;audio;reserved;reserved;<userinput>solaris.device.allocate</userinput>;/etc/security/lib/audio_clean
fd0;fd;reserved;reserved;<userinput>solaris.device.allocate</userinput>;/etc/security/lib/fd_clean
sr0;sr;reserved;reserved;<userinput>solaris.device.allocate</userinput>;/etc/security/lib/sr_clean</screen><para>where <literal>solaris.device.allocate</literal> indicates that a user
must have the <literal>solaris.device.allocate</literal> authorization to
use the device.</para>
</step>
</procedure><example id="devtask-41"><title>Permitting Any User to Allocate a Device</title><para><indexterm><primary>authorizations (RBAC)</primary><secondary>not requiring for device allocation</secondary></indexterm><indexterm><primary>devices</primary><secondary>not requiring authorization for use</secondary></indexterm><indexterm><primary>device allocation</primary><secondary>not requiring authorization</secondary></indexterm>In the following example, any user on the system can allocate
any device. The fifth field  in every device entry in the <filename>device_allocate</filename> file has been changed to an at sign (<literal>@</literal>).</para><screen>$ <userinput>whoami</userinput>
devicesec
$ <userinput>vi /etc/security/device_allocate</userinput>
audio;audio;reserved;reserved;<userinput>@</userinput>;/etc/security/lib/audio_clean
fd0;fd;reserved;reserved;<userinput>@</userinput>;/etc/security/lib/fd_clean
sr0;sr;reserved;reserved;<userinput>@</userinput>;/etc/security/lib/sr_clean
&hellip;</screen>
</example><example id="devtask-47"><title>Preventing Some Peripheral Devices From Being Used</title><indexterm><primary>devices</primary><secondary>preventing use of some</secondary>
</indexterm><para>In the following example, the audio device cannot be used. The fifth
field in the audio device entry in the <filename>device_allocate</filename> file
has been changed to an asterisk (<literal>*</literal>).</para><screen>$ <userinput>whoami</userinput>
devicesec
$ <userinput>vi /etc/security/device_allocate</userinput>
audio;audio;reserved;reserved;<userinput>*</userinput>;/etc/security/lib/audio_clean
fd0;fd;reserved;reserved;solaris device.allocate;/etc/security/lib/fd_clean
sr0;sr;reserved;reserved;solaris device.allocate;/etc/security/lib/sr_clean
&hellip;</screen>
</example><example id="devtask-43"><title>Preventing All Peripheral Devices From Being Used</title><indexterm><primary>device allocation</primary><secondary>preventing</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>preventing use of all</secondary>
</indexterm><para>In the following example, no peripheral device can be used. The fifth
field in every device entry in the <filename>device_allocate</filename> file
has been changed to an asterisk (<literal>*</literal>).</para><screen>$ <userinput>whoami</userinput>
devicesec
$ <userinput>vi /etc/security/device_allocate</userinput>
audio;audio;reserved;reserved;<userinput>*</userinput>;/etc/security/lib/audio_clean
fd0;fd;reserved;reserved;<userinput>*</userinput>;/etc/security/lib/fd_clean
sr0;sr;reserved;reserved;<userinput>*</userinput>;/etc/security/lib/sr_clean
&hellip;</screen>
</example>
</task><task id="devtask-58"><title>How to Audit Device Allocation</title><indexterm><primary>devices</primary><secondary>auditing allocation of</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>auditing</secondary>
</indexterm><tasksummary><para>By default, the device allocation commands are in the <literal>other</literal> audit
class.</para>
</tasksummary><procedure>&rolePAstep;<step><para>Preselect the <literal>ot</literal> class for auditing.</para><para>Add
the <literal>ot</literal> class to the <literal>flags</literal> line of the <filename>audit_control</filename> file. The file would appear similar to the following:</para><screen># audit_control file
dir:/var/audit
flags:lo,<userinput>ot</userinput>
minfree:20
naflags:lo</screen><para>For detailed instructions, see <olink targetptr="audittask-45" remap="internal">How to
Modify the audit_control File</olink>.</para>
</step>
</procedure>
</task>
</sect1><sect1 id="devtask-48"><title>Allocating Devices (Task Map)</title><indexterm><primary>task maps</primary><secondary>allocating devices</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>using device allocation</secondary>
</indexterm><indexterm><primary>allocating devices</primary><secondary>task map</secondary>
</indexterm><indexterm><primary>using</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>user procedures</primary><secondary>allocating devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>user procedures</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>using</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>allocating for use</secondary>
</indexterm><para>The following task map points to procedures that show users how to allocate
devices.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110.00*"/><colspec colname="col2" colwidth="154.00*"/><colspec colname="colspec1" colwidth="132.01*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Allocate a device</para>
</entry><entry><para>Enables a user to use a device, while preventing any other user from
using the device.</para>
</entry><entry><para><olink targetptr="devtask-8" remap="internal">How to Allocate a Device</olink></para>
</entry>
</row><row><entry><para>Mount an allocated device</para>
</entry><entry><para>Enables a user to view a device that requires mounting, such as a CD-ROM
or a diskette.</para>
</entry><entry><para><olink targetptr="devtask-51" remap="internal">How to Mount an Allocated Device</olink></para>
</entry>
</row><row><entry><para>Deallocate a device</para>
</entry><entry><para>Makes an allocatable device available for use by another user.</para>
</entry><entry><para><olink targetptr="devtask-9" remap="internal">How to Deallocate a Device</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devtask-52"><title>Allocating Devices</title><para>Device allocation reserves the use of a device to one user at a time.
Devices that require a mount point must be mounted.</para><task id="devtask-8"><title>How to Allocate a Device</title><indexterm><primary>device allocation</primary><secondary>allocating devices</secondary>
</indexterm><indexterm><primary>allocating devices</primary><secondary>by users</secondary>
</indexterm><indexterm><primary>users</primary><secondary>allocating devices</secondary>
</indexterm><indexterm><primary>using</primary><secondary>device allocation</secondary>
</indexterm><indexterm><primary>using</primary><secondary><command>allocate</command> command</secondary>
</indexterm><indexterm><primary><command>allocate</command> command</primary><secondary>using</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>using <command>allocate</command> command</secondary>
</indexterm><taskprerequisites><para>Device allocation must be enabled, as described in <olink targetptr="devtask-20" remap="internal">How to Make a Device Allocatable</olink>. If authorization
is required, the user must have the authorization.</para>
</taskprerequisites><procedure><step><para>Allocate the device.</para><para>Specify the device by device
name.</para><screen>% allocate <replaceable>device-name</replaceable></screen>
</step><step><para>Verify that the device is allocated.</para><para>Run the identical
command.</para><screen>% allocate <replaceable>device-name</replaceable>
allocate. Device already allocated.</screen>
</step>
</procedure><example id="devtask-28"><title>Allocating a Microphone</title><indexterm><primary>microphone</primary><secondary>allocating</secondary>
</indexterm><para>In this example, the user <literal>jdoe</literal> allocates a microphone, <literal>audio</literal>.</para><screen>% <userinput>whoami</userinput>
jdoe
% <userinput>allocate audio</userinput></screen>
</example><example id="devtask-33"><title>Allocating a Printer</title><para>In this example, a user allocates a printer. No one else can print to <literal>printer-1</literal> until the user deallocates it, or until the printer is
forcibly allocated to another user.</para><screen>% <userinput>allocate /dev/lp/printer-1</userinput></screen><para>For an example of forcible deallocation, see <olink targetptr="devtask-31" remap="internal">Forcibly Deallocating a Device</olink>.</para>
</example><example id="devtask-18"><title>Allocating a Tape Drive</title><indexterm><primary>device allocation</primary><secondary>examples</secondary>
</indexterm><indexterm><primary><command>allocate</command> command</primary><secondary>tape drive</secondary>
</indexterm><indexterm><primary>tape drives</primary><secondary>allocating</secondary>
</indexterm><para>In this example, the user <literal>jdoe</literal> allocates a tape drive, <literal>st0</literal>.</para><screen>% <userinput>whoami</userinput>
jdoe
% <userinput>allocate st0</userinput></screen>
</example><taskrelated role="troubleshooting"><para><indexterm><primary>troubleshooting</primary><secondary>allocating a device</secondary></indexterm>If the <command>allocate</command> command cannot
allocate the device, an error  message is displayed in the console window.
For a list of allocation error messages,  see the <olink targetdoc="group-refman" targetptr="allocate-1" remap="external"><citerefentry><refentrytitle>allocate</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</taskrelated>
</task><task id="devtask-51"><title>How to Mount an Allocated Device</title><indexterm><primary>device allocation</primary><secondary>mounting devices</secondary>
</indexterm><indexterm><primary>users</primary><secondary>mounting allocated devices</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>mounting allocated devices</secondary>
</indexterm><indexterm><primary>mounting</primary><secondary>allocated devices</secondary>
</indexterm><taskprerequisites><para>The user or role has allocated the device. To mount a device, the user
or role must have the privileges that are required for mounting the device.
To give the required privileges, see <olink targetptr="devtask-36" remap="internal">How to
Authorize Users to Allocate a Device</olink>.</para>
</taskprerequisites><procedure><step><para>Assume a role that can allocate and mount a device.</para><screen>% su - <replaceable>role-name</replaceable>
Password: <lineannotation>&lt;Type role-name password&gt;</lineannotation>
$</screen>
</step><step id="devtask-mtpt-1"><para>Create and protect a mount point in the role's
home directory.</para><para>You only need to do this step the first time you
need a mount point.</para><screen>$ mkdir <replaceable>mount-point</replaceable> ; chmod 700 <replaceable>mount-point</replaceable></screen>
</step><step><para>List the allocatable devices.</para><screen>$ list_devices -l
<replaceable>List of allocatable devices</replaceable></screen>
</step><step><para>Allocate the device.</para><para>Specify the device by device
name.</para><screen>$ allocate <replaceable>device-name</replaceable></screen>
</step><step><para>Mount the device.</para><screen>$ mount -o ro -F <replaceable>filesystem-type device-path mount-point</replaceable></screen><para>where</para><variablelist><varlistentry><term><option>o ro</option></term><listitem><para>Indicates that the device is to be mounted read-only. Use<option>o rw</option> to indicate that you should be able to write to the device.</para>
</listitem>
</varlistentry><varlistentry><term><option>F</option> <replaceable>filesystem-type</replaceable></term><listitem><para>Indicates the file system format of the device. Typically,
a CD-ROM is formatted with an HSFS file system. A diskette is typically formatted
with a PCFS file system.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-path</replaceable></term><listitem><para>Indicates the path to the device. The output of the <command>list_devices
-l</command> command includes the <replaceable>device-path</replaceable>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>mount-point</replaceable></term><listitem><para>Indicates the mount point that you created in <olink targetptr="devtask-mtpt-1" remap="internal">Step&nbsp;2</olink>.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="devtask-22"><title>Allocating a Diskette Drive</title><indexterm><primary>diskette drives</primary><secondary>allocating</secondary>
</indexterm><indexterm><primary>mounting</primary><secondary>allocated diskette</secondary>
</indexterm><para><indexterm><primary>using</primary><secondary><command>mount</command> command</secondary></indexterm>In this example, a user assumes a role that can allocate
and mount a diskette drive, <literal>fd0</literal>. The diskette is formatted
with a PCFS file system.</para><screen>% <userinput>roles</userinput>
devicealloc
% <userinput>su - devicealloc</userinput>
Password: <lineannotation>&lt;Type devicealloc password&gt;</lineannotation>
$ <userinput>mkdir /home/devicealloc/mymnt</userinput>
$ <userinput>chmod 700 /home/devicealloc/mymnt</userinput>
$ <userinput>list_devices -l</userinput>
...
device: fd0 type: fd files: /dev/diskette /dev/rdiskette /dev/fd0a
...
$ <userinput>allocate fd0</userinput>
$ <userinput>mount -o ro -F pcfs /dev/diskette /home/devicealloc/mymnt</userinput>
$ <userinput>ls /home/devicealloc/mymnt</userinput>
<replaceable>List of the contents of diskette</replaceable></screen>
</example><example id="devtask-24"><title>Allocating a CD-ROM Drive</title><indexterm><primary>CD-ROM drives</primary><secondary>allocating</secondary>
</indexterm><indexterm><primary>mounting</primary><secondary>allocated CD-ROM</secondary>
</indexterm><para>In this example, a user assumes a role that can allocate and mount a
CD-ROM drive, <literal>sr0</literal>. The drive is formatted as an HSFS file
system.</para><screen>% <userinput>roles</userinput>
devicealloc
% <userinput>su - devicealloc</userinput>
Password: <lineannotation>&lt;Type devicealloc password&gt;</lineannotation>
$ <userinput>mkdir /home/devicealloc/mymnt</userinput>
$ <userinput>chmod 700 /home/devicealloc/mymnt</userinput>
$ <userinput>list_devices -l</userinput>
...
device: sr0 type: sr files: /dev/sr0 /dev/rsr0 /dev/dsk/c0t2d0s0 ...
...
$ <userinput>allocate sr0</userinput>
$ <userinput>mount -o ro -F hsfs /dev/sr0 /home/devicealloc/mymnt</userinput>
$ <userinput>cd /home/devicealloc/mymnt ; ls</userinput>
<replaceable>List of the contents of CD-ROM</replaceable></screen>
</example><taskrelated role="troubleshooting"><itemizedlist><para><indexterm><primary>troubleshooting</primary><secondary>mounting a device</secondary></indexterm>If the <command>mount</command> command cannot mount the device,
an error  message is displayed: <literal>mount: insufficient privileges</literal>.
Check the following:</para><listitem><para>Make sure that you are executing the <command>mount</command> command
in a profile shell. If you have assumed a role, the role has a profile shell.
If you are a user who has been assigned a profile with the <command>mount</command> command,
you must create a profile shell. The commands <command>pfsh</command>, <command>pfksh</command>, and <command>pfcsh</command> create a profile shell.</para>
</listitem><listitem><para>Make sure that you own the specified mount point. You should
have read, write, and execute access to the mount point.</para>
</listitem>
</itemizedlist><para>Contact your administrator if you still cannot mount the allocated device.</para>
</taskrelated>
</task><task id="devtask-9"><title>How to Deallocate a Device</title><indexterm><primary>device allocation</primary><secondary>deallocating devices</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>deallocating a device</secondary>
</indexterm><indexterm><primary>deallocating</primary><secondary>devices</secondary>
</indexterm><indexterm><primary>users</primary><secondary>deallocating devices</secondary>
</indexterm><indexterm><primary><command>deallocate</command> command</primary><secondary>using</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary><command>deallocate</command> command</secondary><tertiary>using</tertiary>
</indexterm><tasksummary><para>Deallocation enables other users to allocate and use the device when
you are finished.</para>
</tasksummary><taskprerequisites><para>You must have allocated the device.</para>
</taskprerequisites><procedure><step><para>If the device is mounted, unmount the device.</para><screen>$ cd $HOME
$ umount <replaceable>mount-point</replaceable></screen>
</step><step><para>Deallocate the device.</para><screen>$ deallocate <replaceable>device-name</replaceable></screen>
</step>
</procedure><example id="devtask-39"><title>Deallocating a Microphone</title><indexterm><primary>microphone</primary><secondary>deallocating</secondary>
</indexterm><indexterm><primary>deallocating</primary><secondary>microphone</secondary>
</indexterm><indexterm><primary>using</primary><secondary><command>deallocate</command> command</secondary>
</indexterm><para>In this example, the user <literal>jdoe</literal> deallocates the microphone, <literal>audio</literal>.</para><screen>% <userinput>whoami</userinput>
jdoe
% <userinput>deallocate audio</userinput></screen>
</example><example id="devtask-25"><title>Deallocating a CD-ROM Drive</title><indexterm><primary>users</primary><secondary>unmounting allocated devices</secondary>
</indexterm><indexterm><primary>unmounting</primary><secondary>allocated devices</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>unmounting allocated device</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>unmounting allocated device</secondary>
</indexterm><para><indexterm><primary>using</primary><secondary><command>umount</command> command</secondary></indexterm>In this example, the Device Allocator role deallocates
a CD-ROM drive. After the message is printed, the CD-ROM is ejected.</para><screen>$ <userinput>whoami</userinput>
devicealloc
$ <userinput>cd /home/devicealloc</userinput>
$ <userinput>umount /home/devicealloc/mymnt</userinput>
$ <userinput>ls /home/devicealloc/mymnt</userinput>
$ 
$ <userinput>deallocate sr0</userinput>
/dev/sr0:      326o
/dev/rsr0:     326o
&hellip;
sr_clean: Media in sr0 is ready.  Please, label and store safely.</screen>
</example>
</task>
</sect1><sect1 id="devtask-16"><title>Device Protection (Reference)</title><indexterm><primary>device policy</primary><secondary>kernel protection</secondary>
</indexterm><para>Devices in the Solaris OS are protected by device policy. Peripheral devices
can be protected by device allocation. Device policy is enforced by the kernel.
Device allocation is optionally enabled, and is enforced at the user level.</para><sect2 id="devtask-4"><title>Device Policy Commands</title><indexterm><primary>commands</primary><secondary>device policy commands</secondary>
</indexterm><indexterm><primary>devices</primary><secondary>policy commands</secondary>
</indexterm><para><indexterm><primary>device policy</primary><secondary>commands</secondary></indexterm><indexterm><primary>device policy</primary><secondary><command>add_drv</command> command</secondary></indexterm><indexterm><primary>device policy</primary><secondary><command>update_drv</command> command</secondary></indexterm>Device
management commands administer the device policy on local files. Device policy
can include privilege requirements. Only superuser or a role of equivalent
capabilities can manage devices.</para><para>The following table lists the device management commands.</para><table frame="topbot" id="devtask-tbl-2"><title>Device Management Commands</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="17.58*"/><colspec colname="colspec2" colwidth="43.89*"/><colspec colname="colspec3" colwidth="20.10*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Purpose</para>
</entry><entry><para>Man Page</para>
</entry>
</row>
</thead><tbody><row><entry><para><indexterm><primary><command>devfsadm</command> command</primary><secondary>description</secondary></indexterm><command>devfsadm</command></para>
</entry><entry><para>Administers devices and device drivers on a running system. Also loads
device policy.</para><para>The <command>devfsadm</command> command enables the cleanup of dangling <filename>/dev</filename> links to disk, tape, port, audio, and pseudo devices. Devices
for a named driver can also be reconfigured.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="devfsadm-1m" remap="external"><citerefentry><refentrytitle>devfsadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary><command>getdevpolicy</command> command</primary><secondary>description</secondary></indexterm><command>getdevpolicy</command></para>
</entry><entry><para>Displays the policy associated with one or more devices. This command
can be run by any user.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="getdevpolicy-1m" remap="external"><citerefentry><refentrytitle>getdevpolicy</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary><command>add_drv</command> command</primary><secondary>description</secondary></indexterm><command>add_drv</command></para>
</entry><entry><para>Adds a new device driver to a running system. Contains options to add
device policy to the new device. Typically, this command is called in a script
when a device driver is being installed.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="add-drv-1m" remap="external"><citerefentry><refentrytitle>add_drv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary><command>update_drv</command> command</primary><secondary>description</secondary></indexterm><command>update_drv</command></para>
</entry><entry><para>Updates the attributes of an existing device driver. Contains options
to update the device policy for the device. Typically, this command is called
in a script when a device driver is being installed.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="update-drv-1m" remap="external"><citerefentry><refentrytitle>update_drv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary><command>rem_drv</command> command</primary><secondary>description</secondary></indexterm><command>rem_drv</command></para>
</entry><entry><para>Removes a device or device driver.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="rem-drv-1m" remap="external"><citerefentry><refentrytitle>rem_drv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><sect2 id="devtask-40"><title>Device Allocation</title><para>Device allocation can protect your site from loss of data, computer
viruses, and other security breaches. Unlike device policy, device allocation
is optional. Devices are not allocatable until the <command>bsmconv</command> script
is run. Device allocation uses authorizations to limit access to allocatable
devices.</para><sect3 id="devtask-42"><title>Components of Device Allocation</title><indexterm><primary>device allocation</primary><secondary>components of mechanism</secondary>
</indexterm><indexterm><primary>components</primary><secondary>device allocation mechanism</secondary>
</indexterm><itemizedlist><para>The components of the device allocation mechanism are as follows:</para><listitem><para>The <command>allocate</command>, <command>deallocate</command>, <command>dminfo</command>, and <command>list_devices</command> commands. For more information,
see <olink targetptr="devtask-44" remap="internal">Device Allocation Commands</olink>.</para>
</listitem><listitem><para>Device-clean scripts for each allocatable device.</para>
</listitem>
</itemizedlist><itemizedlist><para>These commands and scripts use the following local files to implement
device allocation:</para><listitem><para>The <filename>/etc/security/device_allocate</filename> file.
For more information, see the <olink targetdoc="group-refman" targetptr="device-allocate-4" remap="external"><citerefentry><refentrytitle>device_allocate</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</listitem><listitem><para>The <filename>/etc/security/device_maps</filename> file. For
more information, see the <olink targetdoc="group-refman" targetptr="device-maps-4" remap="external"><citerefentry><refentrytitle>device_maps</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para>
</listitem><listitem><para>A lock file, in the <filename class="directory">/etc/security/dev</filename> directory, for each allocatable device.</para>
</listitem><listitem><para>The changed attributes of the lock files that are associated
with each allocatable device.</para>
</listitem>
</itemizedlist><note><para>The <filename class="directory">/etc/security/dev</filename> directory
might not be supported in future releases of the Solaris OS.</para>
</note>
</sect3><sect3 id="devtask-44"><title>Device Allocation Commands</title><para><indexterm><primary>device allocation</primary><secondary>commands</secondary></indexterm><indexterm><primary>commands</primary><secondary>device allocation commands</secondary></indexterm>With uppercase options, the <command>allocate</command>, <command>deallocate</command>, and <command>list_devices</command> commands are administrative
commands. Otherwise, these commands are user commands. The following table
lists the device allocation commands.</para><table frame="topbot" id="devtask-tbl-4"><title>Device Allocation Commands</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="18.28*"/><colspec colname="colspec2" colwidth="47.12*"/><colspec colname="colspec3" colwidth="16.17*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Purpose</para>
</entry><entry><para>Man Page</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>bsmconv</command></para>
</entry><entry><para>Creates databases to handle device allocation. Also enables the auditing
service. You must be superuser or in the Primary Administrator role.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="bsmconv-1m" remap="external"><citerefentry><refentrytitle>bsmconv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>dminfo</command></para>
</entry><entry><para>Searches for an allocatable device by device type, by device name, and
by full path name.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="dminfo-1m" remap="external"><citerefentry><refentrytitle>dminfo</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary><command>list_devices</command> command</primary><secondary>description</secondary></indexterm><command>list_devices</command></para>
</entry><entry><para>Lists the status of allocatable devices.</para><para>Lists all the device-special files that are associated with any device
that is listed in the <filename>device_maps</filename> file. </para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="list-devices-1" remap="external"><citerefentry><refentrytitle>list_devices</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary sortas="u2"><option>U</option> option</primary><secondary><command>list_devices</command> command</secondary></indexterm><command>list_devices -U</command></para>
</entry><entry><para>Lists the devices that are allocatable or allocated to the specified
user ID. This option allows you to check which devices are allocatable or
allocated to another user. You must have the <literal>solaris.device.revoke</literal> authorization.</para>
</entry><entry>
</entry>
</row><row><entry><para><indexterm><primary>device allocation</primary><secondary><command>allocate</command> command</secondary></indexterm><indexterm><primary><command>allocate</command> command</primary><secondary>description</secondary></indexterm><command>allocate</command></para>
</entry><entry><para>Reserves an allocatable device for use by one user.</para><para><indexterm><primary>authorizations (RBAC)</primary><secondary><literal>solaris.device.allocate</literal></secondary></indexterm>By default, a user must have the <literal>solaris.device.allocate</literal> authorization to allocate a device. You can modify the <filename>device_allocate</filename> file to not require user authorization. Then, any user on the
system can request the device to be allocated for use.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="allocate-1" remap="external"><citerefentry><refentrytitle>allocate</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><indexterm><primary>device allocation</primary><secondary><command>deallocate</command> command</secondary></indexterm><indexterm><primary><command>deallocate</command> command</primary><secondary>description</secondary></indexterm><command>deallocate</command></para>
</entry><entry><para>Removes the allocation reservation from a device.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="deallocate-1" remap="external"><citerefentry><refentrytitle>deallocate</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</table><sect4 id="devtask-15"><title>Authorizations for the Allocation Commands</title><indexterm><primary>device allocation</primary><secondary>authorizations for commands</secondary>
</indexterm><indexterm><primary>authorizations (RBAC)</primary><secondary>for device allocation</secondary>
</indexterm><para>By default, users must have the <literal>solaris.device.allocate</literal> authorization
to reserve an allocatable device. To create a rights profile to include the <literal>solaris.device.allocate</literal> authorization, see <olink targetptr="devtask-36" remap="internal">How to Authorize Users to Allocate a Device</olink>.</para><para><indexterm><primary><command>allocate</command> command</primary><secondary>authorizations for</secondary></indexterm><indexterm><primary><command>deallocate</command> command</primary><secondary>authorizations for</secondary></indexterm><indexterm><primary><command>list_devices</command> command</primary><secondary>authorizations for</secondary></indexterm><indexterm><primary><literal>solaris.device.revoke</literal> authorization</primary></indexterm><indexterm><primary>authorizations (RBAC)</primary><secondary><literal>solaris.device.revoke</literal></secondary></indexterm><indexterm><primary sortas="u2"><option>U</option> option</primary><secondary><command>allocate</command> command</secondary></indexterm>Administrators
must have the <literal>solaris.device.revoke</literal> authorization to change
the allocation state of any device. For example, the <option>U</option> option
to the <command>allocate</command> and <command>list_devices</command> commands,
and the <option>F</option> option to the <command>deallocate</command> command
require the <literal>solaris.device.revoke</literal> authorization.</para><para>For more information, see <olink targetptr="rbacref-4" remap="internal">Commands That
Require Authorizations</olink>.</para>
</sect4>
</sect3><sect3 id="devtask-12"><title>Allocate Error State</title><indexterm><primary>allocate error state</primary>
</indexterm><indexterm><primary>device allocation</primary><secondary>allocate error state</secondary>
</indexterm><indexterm><primary>errors</primary><secondary>allocate error state</secondary>
</indexterm><indexterm><primary><command>deallocate</command> command</primary><secondary>allocate error state</secondary>
</indexterm><indexterm><primary sortas="f2"><option>F</option> option</primary><secondary><command>deallocate</command> command</secondary>
</indexterm><para>A device is put in an <emphasis>allocate error state</emphasis> when
the <command>deallocate</command> command fails to deallocate, or when the <command>allocate</command> command fails to allocate. When an allocatable device is
in an allocate error state, then the device must be forcibly deallocated.
Only superuser or a role with the Device Management rights profile or the
Device Security rights profile can handle an allocate error state.</para><para><indexterm><primary><command>deallocate</command> command</primary><secondary>allocate error state</secondary></indexterm><indexterm><primary><command>allocate</command> command</primary><secondary>allocate error state</secondary></indexterm>The <command>deallocate</command> command with the <option>F</option> option
forces deallocation. Or, you can use <command>allocate -U</command> to assign
the device to a user. Once the device is allocated, you can investigate any
error messages that appear. After any problems with the device are corrected,
you can forcibly deallocate it.</para>
</sect3><sect3 id="devtask-46"><title><filename>device_maps</filename> File</title><indexterm><primary>device allocation</primary><secondary><filename>device_maps</filename> file</secondary>
</indexterm><indexterm><primary><filename>/etc/security/bsmconv</filename> script</primary>
</indexterm><indexterm><primary><command>bsmconv</command> script</primary><secondary>creating <filename>device_maps</filename> file</secondary>
</indexterm><para><indexterm><primary>configuration files</primary><secondary><filename>device_maps</filename> file</secondary></indexterm><indexterm><primary>device allocation</primary><secondary>configuration file</secondary></indexterm><indexterm><primary><filename>device_maps</filename> file</primary><secondary>description</secondary></indexterm><indexterm><primary><filename>/etc/security/device_maps</filename> file</primary></indexterm>Device maps are created when you set up device allocation.
A default <filename>/etc/security/device_maps</filename> file is created by
the <command>bsmconv</command> command when the auditing service is enabled.
This initial <filename>device_maps</filename> file can be customized for 
your site. The <filename>device_maps</filename> file includes the device names,
device types, and device-special files that are associated with each allocatable
device.</para><para><indexterm><primary><command>dminfo</command> command</primary></indexterm>The <filename>device_maps</filename> file defines the device-special
file mappings for each device, which in many cases is not intuitive. This
file allows programs to discover which device-special files map to which devices.
You can use the <command>dminfo</command> command, for example, to retrieve
the device name, the device type, and the device-special files to specify
when you set up an allocatable device. The <command>dminfo</command> command
uses the <filename>device_maps</filename> file to report this information.</para><para><indexterm><primary><filename>device_maps</filename> file</primary><secondary>format</secondary></indexterm>Each device is represented by a one-line
entry of the form:</para><screen><replaceable>device-name</replaceable>:<replaceable>device-type</replaceable>:<replaceable>device-list</replaceable></screen><example id="devtask-27"><title>Sample <filename>device_maps</filename> Entry</title><para><indexterm><primary><filename>device_maps</filename> file</primary><secondary>sample entries</secondary></indexterm>The following is an example
of an entry in a <filename>device_maps</filename> file for a diskette drive, <literal>fd0</literal>:</para><screen>fd0:\
        fd:\
        /dev/diskette /dev/rdiskette /dev/fd0a /dev/rfd0a \
/dev/fd0b /dev/rfd0b /dev/fd0c /dev/fd0 /dev/rfd0c /dev/rfd0:\</screen>
</example><para><indexterm><primary>\ (backslash)</primary><secondary><filename>device_maps</filename> file</secondary></indexterm><indexterm><primary># (pound sign)</primary><secondary><filename>device_maps</filename> file</secondary></indexterm><indexterm><primary>pound sign (#)</primary><secondary><filename>device_maps</filename> file</secondary></indexterm><indexterm><primary>\ (backslash)</primary><secondary><filename>device_maps</filename> file</secondary></indexterm>Lines in the <filename>device_maps</filename> file can end with a backslash (<literal>\</literal>) to continue
an entry on the next line. Comments can also be included. A pound sign (<literal>#</literal>) comments all subsequent text until the next newline that is not
immediately preceded by a backslash. Leading and trailing blanks are allowed
in any field. The fields are defined as follows:</para><variablelist><varlistentry><term><replaceable>device-name</replaceable></term><listitem><para><indexterm><primary>names</primary><secondary>device names</secondary><tertiary><filename>device_maps</filename> file</tertiary></indexterm>Specifies
the name of the device. For a list of current device names, see <olink targetptr="devtask-26" remap="internal">How to View Allocation Information About a Device</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-type</replaceable></term><listitem><para>Specifies the generic device type. The generic name is the
name for the class of devices, such as <literal>st</literal>, <literal>fd</literal>,
or <literal>audio</literal>. The <replaceable>device-type</replaceable> field
logically groups related devices.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-list</replaceable></term><listitem><para>Lists the device-special files that are associated with the
physical device. The <replaceable>device-list</replaceable> must contain all
of the special files that allow access to a particular device. If the list
is incomplete, a malevolent user can still obtain or modify private information.
Valid entries for the <replaceable>device-list</replaceable> field reflect
the device files that are located in the <filename class="directory">/dev</filename> directory.</para>
</listitem>
</varlistentry>
</variablelist>
</sect3><sect3 id="devtask-34"><title><filename>device_allocate</filename> File</title><indexterm><primary>device allocation</primary><secondary><filename>device_allocate</filename> file</secondary>
</indexterm><indexterm><primary><filename>device_allocate</filename> file</primary><secondary>description</secondary>
</indexterm><para><indexterm><primary><filename>device_allocate</filename> file</primary><secondary>sample</secondary></indexterm><indexterm><primary><filename>/etc/security/device_allocate</filename> file</primary></indexterm>An initial <filename>/etc/security/device_allocate</filename> file is created by the <command>bsmconv</command> command when
the auditing service is enabled. This initial <filename>device_allocate</filename> file
can be used as a starting point. You can modify the <filename>device_allocate</filename> file
to change devices from allocatable to nonallocatable, or to add new devices.
A sample <filename>device_allocate</filename> file follows.</para><screen>st0;st;;;;/etc/security/lib/st_clean
fd0;fd;;;;/etc/security/lib/fd_clean
sr0;sr;;;;/etc/security/lib/sr_clean
audio;audio;;;*;/etc/security/lib/audio_clean</screen><para><indexterm><primary>semicolon (;)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>; (semicolon)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>* (asterisk)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>asterisk (*)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm>An entry in the <filename>device_allocate</filename> file does not mean that the device is allocatable,
unless the entry specifically states that the device is allocatable. In the
sample <filename>device_allocate</filename> file, note the asterisk (<literal>*</literal>)
in the fifth field of the audio device entry. An asterisk in the fifth field
indicates to the system that the device is not allocatable. Therefore, the
device cannot be used. Other values or no value in this field indicates that
the device can be used.</para><para><indexterm><primary><filename>device_allocate</filename> file</primary><secondary>format</secondary></indexterm>In the <filename>device_allocate</filename> file,
each device is represented by a one-line entry of the form:</para><screen><replaceable>device-name</replaceable>;<replaceable>device-type</replaceable>;reserved;reserved;<replaceable>auths</replaceable>;<replaceable>device-exec</replaceable></screen><para><indexterm><primary>\ (backslash)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary># (pound sign)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>pound sign (#)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>\ (backslash)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm>Lines in the <filename>device_allocate</filename> file can end with a backslash (<literal>\</literal>) to continue
an entry on the next line. Comments can also be included. A pound sign (<literal>#</literal>) comments all subsequent text until the next newline that is not
immediately preceded by a backslash. Leading and trailing blanks are allowed
in any field. The fields are defined as follows:</para><variablelist><varlistentry><term><replaceable>device-name</replaceable></term><listitem><para><indexterm><primary>names</primary><secondary>device names</secondary><tertiary><filename>device_maps</filename> file</tertiary></indexterm>Specifies
the name of the device. For a list of current device names, see <olink targetptr="devtask-26" remap="internal">How to View Allocation Information About a Device</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-type</replaceable></term><listitem><para>Specifies the generic device type. The generic name is the
name for the class of devices, such as <literal>st</literal>, <literal>fd</literal>,
and <literal>sr</literal>. The <replaceable>device-type</replaceable> field
logically groups related devices. When you make a device allocatable, retrieve
the device name from the <replaceable>device-type</replaceable> field in the <filename>device_maps</filename> file.</para>
</listitem>
</varlistentry><varlistentry><term><literal>reserved</literal></term><listitem><para>Sun reserves the two fields that are marked <literal>reserved</literal> for
future use.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>auths</replaceable></term><listitem><para><indexterm><primary>* (asterisk)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>asterisk (*)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>@ (at sign)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm><indexterm><primary>at sign (@)</primary><secondary><filename>device_allocate</filename> file</secondary></indexterm>Specifies whether the
device is allocatable. An asterisk (<literal>*</literal>) in this field indicates
that the device is not allocatable. An authorization string, or an empty field,
indicates that the device is allocatable. For example, the string <literal>solaris.device.allocate</literal> in the <replaceable>auths</replaceable> field indicates that the <literal>solaris.device.allocate</literal> authorization is required to allocate the
device. An at sign (<literal>@</literal>) in this file indicates that the
device is allocatable by any user.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>device-exec</replaceable></term><listitem><para>Supplies the path name of a script to be invoked for special
handling, such as cleanup and object-reuse protection during the allocation
process. The <replaceable>device-exec</replaceable> script is run any time
that the device is acted on by the <command>deallocate</command> command.</para>
</listitem>
</varlistentry>
</variablelist><para>For example, the following entry for the <literal>sr0</literal> device
indicates that the CD-ROM drive is allocatable by a user with the <literal>solaris.device.allocate</literal> authorization:</para><screen>sr0;sr;reserved;reserved;solaris.device.allocate;/etc/security/lib/sr_clean</screen><para><indexterm><primary>device allocation</primary><secondary>allocatable devices</secondary></indexterm><indexterm><primary>device-clean scripts</primary><secondary>tape drives</secondary></indexterm><indexterm><primary>scripts</primary><secondary>device-clean scripts</secondary><seealso>device-clean scripts</seealso></indexterm>You can decide to accept the default devices and their defined
characteristics. After you install a new device, you can modify the entries.
Any device that needs to be allocated before use must be defined in the <filename>device_allocate</filename> and <filename>device_maps</filename> files for
that device's system. Currently, cartridge tape drives, diskette drives, CD-ROM
drives, and audio chips are considered allocatable. These device types have
device-clean scripts.</para><note><para><indexterm><primary>device-clean scripts</primary><secondary>tape drives</secondary></indexterm><indexterm><primary>Archive tape drive device-clean script</primary></indexterm><indexterm><primary>Xylogics tape drive device-clean script</primary></indexterm><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>tape drives</tertiary></indexterm><indexterm><primary>SCSI devices</primary><secondary><filename>st_clean</filename> script</secondary></indexterm><indexterm><primary><filename>st_clean</filename> script</primary><secondary>for tape drives</secondary></indexterm><indexterm><primary>device allocation</primary><secondary>allocatable devices</secondary></indexterm><indexterm><primary>object reuse requirements</primary><secondary>device-clean scripts</secondary><tertiary>tape drives</tertiary></indexterm><indexterm><primary>tape drives</primary><secondary>device-clean scripts</secondary></indexterm><trademark>Xylogics</trademark> tape
drives or Archive tape drives also use the <command>st_clean</command> script
that is supplied for SCSI devices. You need to create your own device-clean
scripts for other devices, such as modems, terminals, graphics tablets, and
other allocatable devices. The script must fulfill object-reuse requirements
for that type of device.</para>
</note>
</sect3><sect3 id="devtask-38"><title>Device-Clean Scripts</title><indexterm><primary>security</primary><secondary>protecting devices</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>description</tertiary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>description</secondary>
</indexterm><indexterm><primary>scripts</primary><secondary>for cleaning devices</secondary>
</indexterm><indexterm><primary>object reuse requirements</primary><secondary>for devices</secondary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>and object reuse</secondary>
</indexterm><para>Device allocation satisfies part of what is called the object reuse
requirement. The <emphasis>device-clean</emphasis> scripts address the security
requirement that all usable data be purged from a physical device before reuse.
The data is cleared before the device is allocatable by another user. By default,
cartridge tape drives, diskette drives, CD-ROM drives, and audio devices require
device-clean scripts. The Solaris OS provides the scripts. This section describes
what device-clean scripts do.</para><sect4 id="devtask-53"><title>Device-Clean Script for Tapes</title><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>tape drives</tertiary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>tape drives</secondary>
</indexterm><indexterm><primary>tape drives</primary><secondary>cleaning of data</secondary>
</indexterm><indexterm><primary><filename>st_clean</filename> script</primary><secondary>description</secondary>
</indexterm><itemizedlist><para>The <filename>st_clean</filename> device-clean script supports three
tape devices:</para><listitem><para>SCSI &frac14;-inch tape</para>
</listitem><listitem><para>Archive &frac14;-inch tape</para>
</listitem><listitem><para>Open-reel &frac12;-inch tape</para>
</listitem>
</itemizedlist><para><indexterm><primary><option role="nodash">rewoffl</option> option</primary><secondary><command>mt</command> command</secondary><tertiary>tape device cleanup and</tertiary></indexterm><indexterm><primary><command>mt</command> command</primary><secondary>tape device cleanup and</secondary></indexterm>The <filename>st_clean</filename> script uses the <option role="nodash">rewoffl</option> option
to the <command>mt</command> command to clean up the device. For more information,
see the <olink targetdoc="group-refman" targetptr="mt-1" remap="external"><citerefentry><refentrytitle>mt</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page. If the script runs during system boot, the script queries the device
to determine if the device is online. If the device is online, the script
determines if the device has media in it. The &frac14;-inch tape devices that
have media in them are placed in the allocate error state. The allocate error
state forces the administrator to manually clean up the device.</para><para>During normal system operation, when the <command>deallocate</command> command
is executed in interactive mode, the user is prompted to remove the media.
Deallocation is delayed until the media is removed from the device.</para>
</sect4><sect4 id="devtask-54"><title>Device-Clean Scripts for Diskettes and CD-ROM
Drives</title><indexterm><primary>CD-ROM drives</primary><secondary>security</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>CD-ROM drives</tertiary>
</indexterm><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>diskette drives</tertiary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>CD-ROM drives</secondary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>diskette drives</secondary>
</indexterm><indexterm><primary>diskette drives</primary><secondary>device-clean scripts</secondary>
</indexterm><itemizedlist><para>The following device-clean scripts are provided for diskettes and CD-ROM
drives:</para><listitem><para><indexterm><primary><filename>fd_clean</filename> script</primary><secondary>description</secondary></indexterm><userinput>fd_clean</userinput> <emphasis role="strong">script &ndash;</emphasis> Is a device-clean script for diskettes.</para>
</listitem><listitem><para><indexterm><primary><filename>sr_clean</filename> script</primary><secondary>description</secondary></indexterm><userinput>sr_clean</userinput> <emphasis role="strong">script &ndash;</emphasis> Is a device-clean script for CD-ROM
drives.</para>
</listitem>
</itemizedlist><para><indexterm><primary><command>eject</command> command</primary><secondary>device cleanup and</secondary></indexterm>The scripts use the <command>eject</command> command
to remove the media from the drive. If the <command>eject</command> command
fails, the device is placed in the allocate error state. For more information,
see the <olink targetdoc="group-refman" targetptr="eject-1" remap="external"><citerefentry><refentrytitle>eject</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
page.</para>
</sect4><sect4 id="devtask-55"><title>Device-Clean Script for Audio</title><indexterm><primary>system calls</primary><secondary>ioctl to clean audio device</secondary>
</indexterm><indexterm><primary>audio devices</primary><secondary>security</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>audio devices</tertiary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>audio devices</secondary>
</indexterm><indexterm><primary><function>ioctl</function> system calls</primary><secondary><function>AUDIO_SETINFO</function></secondary>
</indexterm><para>Audio devices are cleaned up with an <command>audio_clean</command> script.
The script performs an <literal>AUDIO_GETINFO</literal> ioctl system call
to read the device. The script then performs an <literal>AUDIO_SETINFO</literal> ioctl
system call to reset the device configuration to the default.</para>
</sect4><sect4 id="devtask-7"><title>Writing New Device-Clean Scripts</title><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>writing new scripts</tertiary>
</indexterm><indexterm><primary>device-clean scripts</primary><secondary>writing new scripts</secondary>
</indexterm><indexterm><primary>object reuse requirements</primary><secondary>device-clean scripts</secondary><tertiary>writing new scripts</tertiary>
</indexterm><indexterm><primary>creating</primary><secondary>new device-clean scripts</secondary>
</indexterm><indexterm><primary><command>deallocate</command> command</primary><secondary>device-clean scripts and</secondary>
</indexterm><indexterm><primary>device allocation</primary><secondary><command>deallocate</command> command</secondary><tertiary>device-clean scripts and</tertiary>
</indexterm><para>If you add more allocatable devices to the system, you might need to
create your own device-clean scripts. The <command>deallocate</command> command
passes a parameter to the device-clean scripts. The parameter, which is shown
here, is a string that contains the device name. For more information, see
the <olink targetdoc="group-refman" targetptr="device-allocate-4" remap="external"><citerefentry><refentrytitle>device_allocate</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page.</para><screen><replaceable>clean-script</replaceable> -[I|i|f|S] <replaceable>device-name</replaceable></screen><para><indexterm><primary>device allocation</primary><secondary>device-clean scripts</secondary><tertiary>options</tertiary></indexterm><indexterm><primary>device-clean scripts</primary><secondary>options</secondary></indexterm>Device-clean scripts
must return &ldquo;<literal>0</literal>&rdquo; for success and greater than &ldquo;<literal>0</literal>&rdquo; for failure. The options <option>I</option>, <option>f</option>,
and <option>S</option> determine the running mode of the script:</para><variablelist><varlistentry><term><option>I</option></term><listitem><para><indexterm><primary sortas="i2"><option>I</option> option</primary><secondary><filename>st_clean</filename> script</secondary></indexterm>Is
needed during system boot only. All output must go to the system console.
Failure or inability to forcibly eject the media must put the device in the
allocate error state.</para>
</listitem>
</varlistentry><varlistentry><term><option>i</option></term><listitem><para><indexterm><primary><option>i</option> option</primary><secondary><filename>st_clean</filename> script</secondary></indexterm>Similar
to the <option>I</option> option, except that output is suppressed.</para>
</listitem>
</varlistentry><varlistentry><term><option>f</option></term><listitem><para><indexterm><primary sortas="f1"><option>f</option> option</primary><secondary><filename>st_clean</filename> script</secondary></indexterm><indexterm><primary>forced cleanup</primary><secondary><filename>st_clean</filename> script</secondary></indexterm>Is for forced cleanup. The option is interactive and assumes that
the user is available to respond to prompts. A script with this option must
attempt to complete the cleanup if one part of the cleanup fails.</para>
</listitem>
</varlistentry><varlistentry><term><option>S</option></term><listitem><para><indexterm><primary sortas="s2"><option>S</option> option</primary><secondary><filename>st_clean</filename> script</secondary></indexterm><indexterm><primary>standard cleanup</primary><secondary><filename>st_clean</filename> script</secondary></indexterm>Is for standard cleanup. The option is interactive
and assumes that the user is available to respond to prompts.</para>
</listitem>
</varlistentry>
</variablelist>
</sect4>
</sect3>
</sect2>
</sect1>
</chapter><?Pub *0000091827 0?>