source: postlfs/security/sudo.xml@ acf7e2c

basic
Last change on this file since acf7e2c was acf7e2c, checked in by Bruce Dubbs <bdubbs@…>, 6 years ago

Updates to Basic BLFS Chapter 3

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/basic@20519 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 11.1 KB
RevLine 
[cf341b4]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[cf341b4]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[06915b3]7 <!ENTITY sudo-download-http "http://www.sudo.ws/dist/sudo-&sudo-version;.tar.gz">
[926d146d]8 <!ENTITY sudo-download-ftp "ftp://ftp.sudo.ws/pub/sudo/sudo-&sudo-version;.tar.gz">
[f0948db]9 <!ENTITY sudo-md5sum "26ce5ce9c4b8f0127ff4225330a87cd0">
[714b5e4c]10 <!ENTITY sudo-size "3.0 MB">
[f0948db]11 <!ENTITY sudo-buildsize "37 MB (with tests)">
[714b5e4c]12 <!ENTITY sudo-time "0.4 SBU (with tests)">
[cf341b4]13]>
14
[bcd2922]15<sect1 id="sudo" xreflabel="Sudo-&sudo-version;">
[cf341b4]16 <?dbhtml filename="sudo.html"?>
17
18 <sect1info>
[e19ad480]19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
[cf341b4]21 </sect1info>
22
23 <title>Sudo-&sudo-version;</title>
24
25 <indexterm zone="sudo">
[bcd2922]26 <primary sortas="a-Sudo">Sudo</primary>
[cf341b4]27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to Sudo</title>
31
[bcd2922]32 <para>
33 The <application>Sudo</application> package allows a system administrator
34 to give certain users (or groups of users) the ability to run
35 some (or all) commands as
36 <systemitem class="username">root</systemitem> or another user while
37 logging the commands and arguments.
38 </para>
[cf341b4]39
[cdd5a33b]40 &lfs83_checked;
[a8d3d55a]41
[cf341b4]42 <bridgehead renderas="sect3">Package Information</bridgehead>
43 <itemizedlist spacing="compact">
44 <listitem>
[bcd2922]45 <para>
46 Download (HTTP): <ulink url="&sudo-download-http;"/>
47 </para>
[cf341b4]48 </listitem>
49 <listitem>
[bcd2922]50 <para>
51 Download (FTP): <ulink url="&sudo-download-ftp;"/>
52 </para>
[cf341b4]53 </listitem>
54 <listitem>
[bcd2922]55 <para>
56 Download MD5 sum: &sudo-md5sum;
57 </para>
[cf341b4]58 </listitem>
59 <listitem>
[bcd2922]60 <para>
61 Download size: &sudo-size;
62 </para>
[cf341b4]63 </listitem>
64 <listitem>
[bcd2922]65 <para>
66 Estimated disk space required: &sudo-buildsize;
67 </para>
[cf341b4]68 </listitem>
69 <listitem>
[bcd2922]70 <para>
71 Estimated build time: &sudo-time;
72 </para>
[cf341b4]73 </listitem>
74 </itemizedlist>
75
76 <bridgehead renderas="sect3">Sudo Dependencies</bridgehead>
[acf7e2c]77
[cf341b4]78 <bridgehead renderas="sect4">Optional</bridgehead>
[bcd2922]79 <para role="optional">
[acf7e2c]80 <ulink url="&blfs-book;/postlfs/linux-pam.html">linux-pam</ulink>,
81 <ulink url="&blfs-book;postlfs/mitkrb.html">MIT Kerberos</ulink>,
82 <ulink url="&blfs-book;postlfs/openldap.html">openldap</ulink>
83 <xref linkend="postfix"/> (or an equivalent package that provides a
84 <command>sendmail</command> command),
[6b4f8529]85 <ulink url="http://www.openafs.org/">AFS</ulink>,
[06915b3]86 <ulink url="http://www.fwtk.org/">FWTK</ulink>, and
[8dfc5c3]87 <ulink url="&sourceforge-dl;/opie/">Opie</ulink>
[bcd2922]88 </para>
[b35e86b2]89
[3597eb6]90 <para condition="html" role="usernotes">User Notes:
[bcd2922]91 <ulink url="&blfs-wiki;/sudo"/>
92 </para>
[cf341b4]93 </sect2>
94
95 <sect2 role="installation">
96 <title>Installation of Sudo</title>
97
[bcd2922]98 <para>
[6e5d584]99 Install <application>Sudo</application> by running the following commands:
[bcd2922]100 </para>
[cf341b4]101
[1c69133]102<!-- Developer: apparently it is disabled by default, although in configure it
103is written otherwise -disable-static \-->
[b9d56ad4]104<screen><userinput>./configure --prefix=/usr \
[edaee95]105 --libexecdir=/usr/lib \
[1a657ca]106 --with-secure-path \
[b9d56ad4]107 --with-all-insults \
108 --with-env-editor \
109 --docdir=/usr/share/doc/sudo-&sudo-version; \
[9dabcf3]110 --with-passprompt="[sudo] password for %p: " &amp;&amp;
[cf341b4]111make</userinput></screen>
112
[bcd2922]113 <para>
[6b4f8529]114 To test the results, issue: <command>env LC_ALL=C make check 2&gt;&amp;1
115 | tee ../make-check.log</command>. Check the results with <command>grep
[ecd8cc2]116 failed ../make-check.log</command>. One test, test3, is known to fail
117 if the tests are run as the root user.
[bcd2922]118 </para>
[21755bc]119
[bcd2922]120 <para>
121 Now, as the <systemitem class="username">root</systemitem> user:
122 </para>
[cf341b4]123
[2809c8c]124<screen role="root"><userinput>make install &amp;&amp;
125ln -sfv libsudo_util.so.0.0.0 /usr/lib/sudo/libsudo_util.so.0</userinput></screen>
[cf341b4]126
127 </sect2>
128
129 <sect2 role="commands">
130 <title>Command Explanations</title>
131
[663b79c2]132 <para>
[edaee95]133 <parameter>--libexecdir=/usr/lib</parameter>: This switch controls where
[663b79c2]134 private programs are installed. Everything in that directory is a library, so
135 they belong under <filename class="directory">/usr/lib</filename> instead of
136 <filename class="directory">/usr/libexec</filename>.
[8466229]137 </para>
138
139 <para>
140 <parameter>--with-secure-path</parameter>: This switch transparently adds
141 <filename class="directory">/sbin</filename> and <filename
142 class="directory">/usr/sbin</filename> directories to the
143 <envar>PATH</envar> environment variable.
[663b79c2]144 </para>
145
[bcd2922]146 <para>
[f3d174f]147 <parameter>--with-all-insults</parameter>: This switch includes all the
[bcd2922]148 <application>sudo</application> insult sets.
149 </para>
[cf341b4]150
[bcd2922]151 <para>
[f3d174f]152 <parameter>--with-env-editor</parameter>: This switch enables use of the
[bcd2922]153 environment variable EDITOR for <command>visudo</command>.
154 </para>
[8890b85f]155
[f3d174f]156 <para>
[ecea644]157 <parameter>--with-passprompt</parameter>: This switch sets the password prompt.
[f3d174f]158 </para>
159
[14c71e0]160 <para>
[f586237]161 <option>--without-pam</option>: This switch avoids building
162 <application>Linux-PAM</application> support when
163 <application>Linux-PAM</application> is installed on the system.
[14c71e0]164 </para>
[17b685f1]165<!-- See the developer note above before the configure command
[b9d56ad4]166 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[f1d7196]167 href="../../xincludes/static-libraries.xml"/>-->
[b9d56ad4]168
[33d90fe]169 <note>
[bcd2922]170 <para>
171 There are many options to <application>sudo</application>'s
172 <command>configure</command> command. Check the
173 <command>configure --help</command> output for a complete list.
174 </para>
[33d90fe]175 </note>
[cf341b4]176
[2809c8c]177 <para>
[f586237]178 <command>ln -sfv libsudo_util...</command>: Works around a bug in the
[2809c8c]179 installation process, which links to the previously installed
180 version (if there is one) instead of the new one.
181 </para>
182
[cf341b4]183 </sect2>
184
185 <sect2 role="configuration">
186 <title>Configuring Sudo</title>
187
188 <sect3 id="sudo-config">
189 <title>Config File</title>
190
[7a47afc]191 <para>
192 <filename>/etc/sudoers</filename>
193 </para>
[cf341b4]194
195 <indexterm zone="sudo sudo-config">
196 <primary sortas="e-etc-sudoers">/etc/sudoers</primary>
197 </indexterm>
198
199 </sect3>
200
201 <sect3>
202 <title>Configuration Information</title>
203
[bcd2922]204 <para>
205 The <filename>sudoers</filename> file can be quite complicated. It
206 is composed of two types of entries: aliases (basically variables) and
207 user specifications (which specify who may run what). The installation
[b4c31a6]208 installs a default configuration that has no privileges installed for
209 any user.
[bcd2922]210 </para>
[cf341b4]211
[bcd2922]212 <para>
213 One example usage is to allow the system administrator to execute
214 any program without typing a password each time root privileges are
215 needed. This can be configured as:
216 </para>
[bccbdaea]217
[ed025d6]218<screen># User alias specification
[b4c31a6]219User_Alias ADMIN = <replaceable>YourLoginId</replaceable>
[cf341b4]220
221# Allow people in group ADMIN to run all commands without a password
222ADMIN ALL = NOPASSWD: ALL</screen>
223
[bcd2922]224 <para>
225 For details, see <command>man sudoers</command>.
226 </para>
[cf341b4]227
[3c0f868f]228 <note>
[bcd2922]229 <para>
230 The <application>Sudo</application> developers highly recommend
231 using the <command>visudo</command> program to edit the
232 <filename>sudoers</filename> file. This will provide basic sanity
[b4c31a6]233 checking like syntax parsing and file permission to avoid some
234 possible mistakes that could lead to a vulnerable configuration.
[bcd2922]235 </para>
[3c0f868f]236 </note>
237
[bcd2922]238 <para>
[14c71e0]239 If <application>PAM</application> is installed on the system,
240 <application>Sudo</application> is built with
[b4c31a6]241 <application>PAM</application> support. In that case, issue the
242 following command as the <systemitem class="username">root</systemitem>
243 user to create the <application>PAM</application> configuration file:
[bcd2922]244 </para>
[8890b85f]245
[add8d4f]246<screen role="root"><userinput>cat &gt; /etc/pam.d/sudo &lt;&lt; "EOF"
247<literal># Begin /etc/pam.d/sudo
[b3a4f60]248
249# include the default auth settings
250auth include system-auth
251
252# include the default account settings
253account include system-account
254
255# Set default environment variables for the service user
256session required pam_env.so
257
258# include system session defaults
259session include system-session
260
[add8d4f]261# End /etc/pam.d/sudo</literal>
[b3a4f60]262EOF
263chmod 644 /etc/pam.d/sudo</userinput></screen>
[fd7e0ed6]264
[cf341b4]265 </sect3>
266
267 </sect2>
268
269 <sect2 role="content">
270 <title>Contents</title>
271
272 <segmentedlist>
273 <segtitle>Installed Programs</segtitle>
[9d53187]274 <segtitle>Installed Libraries</segtitle>
[cf341b4]275 <segtitle>Installed Directories</segtitle>
276
277 <seglistitem>
[bcd2922]278 <seg>
[a1e0f76]279 sudo, sudoedit (symlink), sudoreplay, and visudo
[bcd2922]280 </seg>
281 <seg>
[6b4f8529]282 group_file.so, libsudo_util.so,
283 sudoers.so, sudo_noexec.so, and system_group.so
[bcd2922]284 </seg>
285 <seg>
[7a47afc]286 /etc/sudoers.d,
[b378aa0]287 /usr/lib/sudo,
[06915b3]288 /usr/share/doc/sudo-&sudo-version;, and
289 /var/{lib,run}/sudo
[bcd2922]290 </seg>
[cf341b4]291 </seglistitem>
292 </segmentedlist>
293
294 <variablelist>
295 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
296 <?dbfo list-presentation="list"?>
297 <?dbhtml list-presentation="table"?>
298
299 <varlistentry id="sudo_prog">
300 <term><command>sudo</command></term>
301 <listitem>
[bcd2922]302 <para>
303 executes a command as another user as permitted by
304 the <filename>/etc/sudoers</filename> configuration file.
[cf341b4]305 </para>
306 <indexterm zone="sudo sudo">
307 <primary sortas="b-sudo">sudo</primary>
308 </indexterm>
309 </listitem>
310 </varlistentry>
311
312 <varlistentry id="sudoedit">
313 <term><command>sudoedit</command></term>
314 <listitem>
[bcd2922]315 <para>
[a1e0f76]316 is a symlink to <command>sudo</command> that implies the
[bcd2922]317 <option>-e</option> option to invoke an editor as another user.
318 </para>
[cf341b4]319 <indexterm zone="sudo sudoedit">
320 <primary sortas="b-sudoedit">sudoedit</primary>
321 </indexterm>
322 </listitem>
323 </varlistentry>
324
[72d90b67]325 <varlistentry id="sudoreplay">
326 <term><command>sudoreplay</command></term>
[3c0f868f]327 <listitem>
[bcd2922]328 <para>
[72d90b67]329 is used to play back or list the output
330 logs created by <command>sudo</command>.
[bcd2922]331 </para>
[72d90b67]332 <indexterm zone="sudo sudoreplay">
333 <primary sortas="b-sudoreplay">sudoreplay</primary>
[3c0f868f]334 </indexterm>
335 </listitem>
336 </varlistentry>
337
[72d90b67]338 <varlistentry id="visudo">
339 <term><command>visudo</command></term>
[61b8305]340 <listitem>
[bcd2922]341 <para>
[72d90b67]342 allows for safer editing of the <filename>sudoers</filename>
343 file.
[bcd2922]344 </para>
[72d90b67]345 <indexterm zone="sudo visudo">
346 <primary sortas="b-visudo">visudo</primary>
[61b8305]347 </indexterm>
348 </listitem>
349 </varlistentry>
[3c0f868f]350
[cf341b4]351 </variablelist>
352
353 </sect2>
354
355</sect1>
Note: See TracBrowser for help on using the repository browser.