<?Pub UDT _bookmark _target?><?Pub EntList bull rArr sect?><chapter id="chp-sec"><title>Security</title><highlights><para>This chapter describes the privileges that system administrators can
use to grant access to DTrace to particular users or processes. DTrace enables
visibility into all aspects of the system including user-level functions,
system calls, kernel functions, and more. It allows for powerful actions some
of which can modify a program's state. Just as it would be inappropriate to
allow a user access to another user's private files, a system administrator
should not grant every user full access to all the facilities that DTrace
offers. By default, only the super-user can use DTrace. The Least Privilege
facility can be used to allow other users controlled use of DTrace.</para>
</highlights><sect1 id="chp-sec-1"><title>Privileges</title><para><indexterm><primary>security</primary></indexterm><indexterm><primary>privileges</primary></indexterm>The Solaris Least Privilege facility enables administrators
to grant specific privileges to specific Solaris users. To give a user a privilege
on login, insert a line into the <filename>/etc/user_attr</filename> file
of the form:</para><programlisting><replaceable>user-name</replaceable>::::defaultpriv=basic,<replaceable>privilege</replaceable></programlisting><para>To give a running process an additional privilege, use the <olink targetdoc="refman1" targetptr="ppriv-1" remap="external"><citerefentry><refentrytitle>ppriv</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> command:</para><screen><userinput># ppriv -s A+<replaceable>privilege</replaceable> <replaceable>process-ID</replaceable></userinput></screen><para>The three privileges that control a user's access to DTrace features
are <literal>dtrace_proc</literal>, <literal>dtrace_user</literal>, and <literal>dtrace_kernel</literal>. Each privilege permits the use of a certain set of
DTrace providers, actions, and variables, and each corresponds to a particular
type of use of DTrace. The privilege modes are described in detail in the
following sections. System administrators should carefully weigh each user's
need against the visibility and performance impact of the different privilege
modes. Users need at least one of the three DTrace privileges in order to
use any of the DTrace functionality.</para>
</sect1><sect1 id="chp-sec-2"><title>Privileged Use of DTrace</title><para><indexterm><primary>privileges</primary><secondary>and DTrace</secondary></indexterm>Users with any of the three DTrace privileges may enable probes
provided by the <literal>dtrace</literal> provider (see <olink targetptr="chp-dtrace" remap="internal">Chapter&nbsp;17, dtrace Provider</olink>), and may
use the following actions and variables:</para><informaltable frame="topbot"><tgroup cols="4" colsep="0" rowsep="1"><?PubTbl tgroup dispwid="10.43in"?><colspec colname="colspec7" colwidth="0.82*"/><colspec colname="colspec8" colwidth="0.87*"/><colspec colname="colspec10" colwidth="1.06*"/><colspec colname="colspec9" colwidth="1.27*"/><tbody><row><entry colsep="1"><para>Providers</para>
</entry><entry><para><literal>dtrace</literal></para>
</entry><entry colname="colspec10">
</entry><entry colname="colspec9">
</entry>
</row><row><entry colname="colspec7" morerows="2" colsep="1"><para>Actions</para>
</entry><entry colname="colspec8" rowsep="0"><para><literal>exit</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>printf</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>tracemem</literal></para>
</entry>
</row><row><entry colname="colspec8" rowsep="0"><para><literal>discard</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>speculate</literal></para>
</entry><entry colname="colspec9" rowsep="0">
</entry>
</row><row><?PubTbl row rht="0.40in"?><entry colname="colspec8"><para><literal>printa</literal></para>
</entry><entry colname="colspec10"><para><literal>trace</literal></para>
</entry><entry colname="colspec9">
</entry>
</row><row><entry colname="colspec7" morerows="3" colsep="1"><para>Variables</para>
</entry><entry rowsep="0"><para><literal>args</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>probemod</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>this</literal></para>
</entry>
</row><row><entry colname="colspec8" rowsep="0"><para><literal>epid</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>probename</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>timestamp</literal></para>
</entry>
</row><row><entry colname="colspec8" rowsep="0"><para><literal>id</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>probeprov</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>vtimestamp</literal></para>
</entry>
</row><row><entry colname="colspec8"><para><literal>probefunc</literal></para>
</entry><entry colname="colspec10"><para><literal>self</literal></para>
</entry><entry colname="colspec9">
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Address Spaces</para>
</entry><entry colname="colspec8"><para>None</para>
</entry><entry colname="colspec10"><para></para>
</entry><entry colname="colspec9"><para></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="chp-sec-proc"><title><literal>dtrace_proc</literal> Privilege</title><para><indexterm><primary><literal>dtrace_proc</literal> privilege</primary></indexterm><indexterm><primary>privileges</primary><secondary><literal>dtrace_proc</literal></secondary></indexterm>The <literal>dtrace_proc</literal> privilege
permits use of the <literal>fasttrap</literal> provider for process-level
tracing. It also allows the use of the following actions and variables:</para><informaltable frame="topbot"><tgroup cols="4" colsep="0" rowsep="1"><?PubTbl tgroup dispwid="10.43in"?><colspec colname="colspec7" colwidth="0.82*"/><colspec colname="colspec8" colwidth="0.87*"/><colspec colname="colspec10" colwidth="1.06*"/><colspec colname="colspec9" colwidth="1.27*"/><tbody><row><entry colname="colspec7" morerows="1" colsep="1"><para>Actions</para>
</entry><entry colname="colspec8" rowsep="0"><para><literal>copyin</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>copyout</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>stop</literal></para>
</entry>
</row><row><entry colname="colspec8"><para><literal>copyinstr</literal></para>
</entry><entry colname="colspec10"><para><literal>raise</literal></para>
</entry><entry colname="colspec9"><para><literal>ustack</literal></para>
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Variables</para>
</entry><entry><para><literal>execname</literal></para>
</entry><entry colname="colspec10"><para><literal>pid</literal></para>
</entry><entry colname="colspec9"><para><literal>uregs</literal></para>
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Address Spaces</para>
</entry><entry colname="colspec8"><para>User</para>
</entry><entry colname="colspec10"><para></para>
</entry><entry colname="colspec9"><para></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>This privilege does not grant any visibility to Solaris kernel data
structures or to processes for which the user does not have permission.</para><para>Users with this privilege may create and enable probes in processes
that they own. If the user also has the <literal>proc_owner</literal> privilege,
probes may be created and enabled in any process. The <literal>dtrace_proc</literal> privilege
is intended for users interested in the debugging or performance analysis
of user processes. This privilege is ideal for a developer working on a new
application or an engineer trying to improve an application's performance
in a production environment.</para><note><para>Users with the <literal>dtrace_proc</literal> and <literal>proc_owner</literal> privileges may <emphasis>enable</emphasis> any <literal>pid</literal> probe
from any process, but can only create probes in processes whose privilege
set is a subset of their own privilege set. Refer to the Least Privilege documentation
for complete details.</para>
</note><para>The <literal>dtrace_proc</literal> privilege allows access to DTrace
that can impose a performance penalty only on those processes to which the
user has permission. The instrumented processes will impose more of a load
on the system resources, and as such it may have some small impact on the
overall system performance. Aside from this increase in overall load, this
privilege does not allow any instrumentation that impacts performance for
any processes other than those being traced. As this privilege grants users
no additional visibility into other processes or the kernel itself,
it is recommended that this privilege be granted to all users that may need
to better understand the inner-workings of their own processes.</para>
</sect1><sect1 id="chp-sec-user"><title><literal>dtrace_user</literal> Privilege</title><para><indexterm><primary><literal>dtrace_user</literal>privilege</primary></indexterm><indexterm><primary>privileges</primary><secondary><literal>dtrace_user</literal></secondary></indexterm>The <literal>dtrace_user</literal> privilege
permits use of the <literal>profile</literal> and <literal>syscall</literal> providers
with some caveats, and the use of the following actions and variables:</para><informaltable frame="topbot"><tgroup cols="4" colsep="0" rowsep="1"><?PubTbl tgroup dispwid="10.43in"?><colspec colname="colspec7" colwidth="0.82*"/><colspec colname="colspec8" colwidth="0.87*"/><colspec colname="colspec10" colwidth="1.06*"/><colspec colname="colspec9" colwidth="1.27*"/><tbody><row><entry colsep="1"><para>Providers</para>
</entry><entry><para><literal>profile</literal></para>
</entry><entry colname="colspec10"><para><literal>syscall</literal></para>
</entry><entry colname="colspec9"><para><literal>fasttrap</literal></para>
</entry>
</row><row><entry colname="colspec7" morerows="1" colsep="1"><para>Actions</para>
</entry><entry colname="colspec8" rowsep="0"><para><literal>copyin</literal></para>
</entry><entry colname="colspec10" rowsep="0"><para><literal>copyout</literal></para>
</entry><entry colname="colspec9" rowsep="0"><para><literal>stop</literal></para>
</entry>
</row><row><entry colname="colspec8"><para><literal>copyinstr</literal></para>
</entry><entry colname="colspec10"><para><literal>raise</literal></para>
</entry><entry colname="colspec9"><para><literal>ustack</literal></para>
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Variables</para>
</entry><entry><para><literal>execname</literal></para>
</entry><entry colname="colspec10"><para><literal>pid</literal></para>
</entry><entry colname="colspec9"><para><literal>uregs</literal></para>
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Address Spaces</para>
</entry><entry colname="colspec8"><para>User</para>
</entry><entry colname="colspec10"><para></para>
</entry><entry colname="colspec9"><para></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>The <literal>dtrace_user</literal> privilege provides only visibility
to those processes to which the user already has permission; it does not allow
any visibility into kernel state or activity. With this privilege, users may
enable the <literal>syscall</literal> provider, but the enabled probes will
only activate in processes to which the user has permission. Similarly, the <literal>profile</literal> provider may be enabled, but the enabled probes will only
activate in processes to which the user has permission, never in the Solaris
kernel.</para><para>This privilege permits the use of instrumentation that, while only allowing
visibility into particular processes, can affect overall system performance.
The <literal>syscall</literal> provider has some small performance impact
on every system call for every process. The <literal>profile</literal> provider
affects overall system performance by executing every time interval, similar
to a real-time timer. Neither of these performance degradations is so great
as to severely limit the system's progress, but system administrators should
consider the implications of granting a user this privilege. Refer to <olink targetptr="chp-syscall" remap="internal">Chapter&nbsp;21, syscall Provider</olink> and <olink targetptr="chp-profile" remap="internal">Chapter&nbsp;19, profile Provider</olink> for a discussion
of the performance impact of the <literal>syscall</literal> and <literal>profile</literal> providers.</para>
</sect1><sect1 id="chp-sec-5"><title><literal>dtrace_kernel</literal> Privilege</title><para><indexterm><primary><literal>dtrace_kernel</literal> privilege</primary></indexterm><indexterm><primary>privileges</primary><secondary><literal>dtrace_kernel</literal></secondary></indexterm>The <literal>dtrace_kernel</literal> privilege
permits the use of every provider except for the use of the <literal>pid</literal> and <literal>fasttrap</literal> providers on processes not owned by the user. This privilege
also permits the use of all actions and variables except for kernel destructive
actions (<function>breakpoint</function>, <function>panic</function>, <function>chill</function>). This privilege permits complete visibility into kernel and user
state. The facilities enabled by the <literal>dtrace_user</literal> privilege
are a strict subset of those enabled by <literal>dtrace_kernel</literal>.</para><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="1"><?PubTbl tgroup dispwid="10.43in"?><colspec colname="colspec7" colwidth="0.82*"/><colspec colname="colspec8" colwidth="0.94*"/><colspec colname="colspec10" colwidth="1.26*"/><tbody><row><entry colsep="1"><para>Providers</para>
</entry><entry><para>All with above restrictions</para>
</entry><entry colname="colspec10">
</entry>
</row><row><?PubTbl row rht="0.40in"?><entry colname="colspec7" colsep="1"><para>Actions</para>
</entry><entry colname="colspec8" rowsep="1"><para>All but destructive actions</para>
</entry><entry colname="colspec10" rowsep="1">
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Variables</para>
</entry><entry><para>All</para>
</entry><entry colname="colspec10">
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Address Spaces</para>
</entry><entry colname="colspec8"><para>User</para>
</entry><entry colname="colspec10"><para>Kernel</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="chp-sec-6"><title>Super User Privileges</title><para><indexterm><primary>superuser privileges</primary></indexterm><indexterm><primary>privileges</primary><secondary>superuser</secondary></indexterm>A
user with all privileges may use every provider and every action including
the kernel destructive actions unavailable to every other class of user.</para><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="1"><?PubTbl tgroup dispwid="10.43in"?><colspec colname="colspec7" colwidth="0.82*"/><colspec colname="colspec8" colwidth="1.06*"/><colspec colname="colspec10" colwidth="1.14*"/><tbody><row><entry colsep="1"><para>Providers</para>
</entry><entry><para>All</para>
</entry><entry colname="colspec10">
</entry>
</row><row><?PubTbl row rht="0.40in"?><entry colname="colspec7" colsep="1"><para>Actions</para>
</entry><entry colname="colspec8" rowsep="1"><para>All including destructive actions</para>
</entry><entry colname="colspec10" rowsep="1">
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Variables</para>
</entry><entry><para>All</para>
</entry><entry colname="colspec10">
</entry>
</row><row><entry colname="colspec7" colsep="1"><para>Address Spaces</para>
</entry><entry colname="colspec8"><para>User</para>
</entry><entry colname="colspec10"><para>Kernel</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
</chapter><?Pub *0000016343 0?>