[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 |
|
---|
[c6b192c] | 7 | <!ENTITY sudo-download-http "https://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">
|
---|
[5327b2af] | 9 | <!ENTITY sudo-md5sum "2c67b10f2aca4698eef0491142653382">
|
---|
[bf14832] | 10 | <!ENTITY sudo-size "4.7 MB">
|
---|
[5327b2af] | 11 | <!ENTITY sudo-buildsize "52 MB (add 16 MB for tests)">
|
---|
[3ee1d76] | 12 | <!ENTITY sudo-time "0.4 SBU (add 0.1 SBU for tests)">
|
---|
[cf341b4] | 13 | ]>
|
---|
| 14 |
|
---|
[bcd2922] | 15 | <sect1 id="sudo" xreflabel="Sudo-&sudo-version;">
|
---|
[cf341b4] | 16 | <?dbhtml filename="sudo.html"?>
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | <title>Sudo-&sudo-version;</title>
|
---|
| 20 |
|
---|
| 21 | <indexterm zone="sudo">
|
---|
[bcd2922] | 22 | <primary sortas="a-Sudo">Sudo</primary>
|
---|
[cf341b4] | 23 | </indexterm>
|
---|
| 24 |
|
---|
| 25 | <sect2 role="package">
|
---|
| 26 | <title>Introduction to Sudo</title>
|
---|
| 27 |
|
---|
[bcd2922] | 28 | <para>
|
---|
| 29 | The <application>Sudo</application> package allows a system administrator
|
---|
| 30 | to give certain users (or groups of users) the ability to run
|
---|
| 31 | some (or all) commands as
|
---|
| 32 | <systemitem class="username">root</systemitem> or another user while
|
---|
| 33 | logging the commands and arguments.
|
---|
| 34 | </para>
|
---|
[cf341b4] | 35 |
|
---|
[05299f4f] | 36 | &lfs112_checked;
|
---|
[a8d3d55a] | 37 |
|
---|
[cf341b4] | 38 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 39 | <itemizedlist spacing="compact">
|
---|
| 40 | <listitem>
|
---|
[bcd2922] | 41 | <para>
|
---|
| 42 | Download (HTTP): <ulink url="&sudo-download-http;"/>
|
---|
| 43 | </para>
|
---|
[cf341b4] | 44 | </listitem>
|
---|
| 45 | <listitem>
|
---|
[bcd2922] | 46 | <para>
|
---|
| 47 | Download (FTP): <ulink url="&sudo-download-ftp;"/>
|
---|
| 48 | </para>
|
---|
[cf341b4] | 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
[bcd2922] | 51 | <para>
|
---|
| 52 | Download MD5 sum: &sudo-md5sum;
|
---|
| 53 | </para>
|
---|
[cf341b4] | 54 | </listitem>
|
---|
| 55 | <listitem>
|
---|
[bcd2922] | 56 | <para>
|
---|
| 57 | Download size: &sudo-size;
|
---|
| 58 | </para>
|
---|
[cf341b4] | 59 | </listitem>
|
---|
| 60 | <listitem>
|
---|
[bcd2922] | 61 | <para>
|
---|
| 62 | Estimated disk space required: &sudo-buildsize;
|
---|
| 63 | </para>
|
---|
[cf341b4] | 64 | </listitem>
|
---|
| 65 | <listitem>
|
---|
[bcd2922] | 66 | <para>
|
---|
| 67 | Estimated build time: &sudo-time;
|
---|
| 68 | </para>
|
---|
[cf341b4] | 69 | </listitem>
|
---|
| 70 | </itemizedlist>
|
---|
| 71 |
|
---|
| 72 | <bridgehead renderas="sect3">Sudo Dependencies</bridgehead>
|
---|
| 73 |
|
---|
| 74 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[bcd2922] | 75 | <para role="optional">
|
---|
| 76 | <xref linkend="linux-pam"/>,
|
---|
| 77 | <xref linkend="mitkrb"/>,
|
---|
| 78 | <xref linkend="openldap"/>,
|
---|
[6b4f8529] | 79 | <xref linkend="server-mail"/> (that provides a
|
---|
| 80 | <command>sendmail</command> command),
|
---|
[cd29bc9] | 81 | <ulink url="https://www.openafs.org/">AFS</ulink>,
|
---|
| 82 | <ulink url="https://www.fwtk.org/">FWTK</ulink>, and
|
---|
[8dfc5c3] | 83 | <ulink url="&sourceforge-dl;/opie/">Opie</ulink>
|
---|
[bcd2922] | 84 | </para>
|
---|
[b35e86b2] | 85 |
|
---|
[3597eb6] | 86 | <para condition="html" role="usernotes">User Notes:
|
---|
[bcd2922] | 87 | <ulink url="&blfs-wiki;/sudo"/>
|
---|
| 88 | </para>
|
---|
[cf341b4] | 89 | </sect2>
|
---|
| 90 |
|
---|
| 91 | <sect2 role="installation">
|
---|
| 92 | <title>Installation of Sudo</title>
|
---|
| 93 |
|
---|
[bcd2922] | 94 | <para>
|
---|
[6e5d584] | 95 | Install <application>Sudo</application> by running the following commands:
|
---|
[bcd2922] | 96 | </para>
|
---|
[cf341b4] | 97 |
|
---|
[b9d56ad4] | 98 | <screen><userinput>./configure --prefix=/usr \
|
---|
[edaee95] | 99 | --libexecdir=/usr/lib \
|
---|
[1a657ca] | 100 | --with-secure-path \
|
---|
[b9d56ad4] | 101 | --with-all-insults \
|
---|
| 102 | --with-env-editor \
|
---|
| 103 | --docdir=/usr/share/doc/sudo-&sudo-version; \
|
---|
[9dabcf3] | 104 | --with-passprompt="[sudo] password for %p: " &&
|
---|
[cf341b4] | 105 | make</userinput></screen>
|
---|
| 106 |
|
---|
[bcd2922] | 107 | <para>
|
---|
[6b4f8529] | 108 | To test the results, issue: <command>env LC_ALL=C make check 2>&1
|
---|
[36a32ef] | 109 | | tee make-check.log</command>. Check the results with <command>grep
|
---|
[8558044] | 110 | failed make-check.log</command>.
|
---|
[bcd2922] | 111 | </para>
|
---|
[21755bc] | 112 |
|
---|
[bcd2922] | 113 | <para>
|
---|
| 114 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 115 | </para>
|
---|
[cf341b4] | 116 |
|
---|
[2809c8c] | 117 | <screen role="root"><userinput>make install &&
|
---|
| 118 | ln -sfv libsudo_util.so.0.0.0 /usr/lib/sudo/libsudo_util.so.0</userinput></screen>
|
---|
[cf341b4] | 119 |
|
---|
| 120 | </sect2>
|
---|
| 121 |
|
---|
| 122 | <sect2 role="commands">
|
---|
| 123 | <title>Command Explanations</title>
|
---|
| 124 |
|
---|
[663b79c2] | 125 | <para>
|
---|
[edaee95] | 126 | <parameter>--libexecdir=/usr/lib</parameter>: This switch controls where
|
---|
[663b79c2] | 127 | private programs are installed. Everything in that directory is a library, so
|
---|
| 128 | they belong under <filename class="directory">/usr/lib</filename> instead of
|
---|
| 129 | <filename class="directory">/usr/libexec</filename>.
|
---|
[8466229] | 130 | </para>
|
---|
| 131 |
|
---|
| 132 | <para>
|
---|
| 133 | <parameter>--with-secure-path</parameter>: This switch transparently adds
|
---|
| 134 | <filename class="directory">/sbin</filename> and <filename
|
---|
| 135 | class="directory">/usr/sbin</filename> directories to the
|
---|
| 136 | <envar>PATH</envar> environment variable.
|
---|
[663b79c2] | 137 | </para>
|
---|
| 138 |
|
---|
[bcd2922] | 139 | <para>
|
---|
[f3d174f] | 140 | <parameter>--with-all-insults</parameter>: This switch includes all the
|
---|
[bcd2922] | 141 | <application>sudo</application> insult sets.
|
---|
| 142 | </para>
|
---|
[cf341b4] | 143 |
|
---|
[bcd2922] | 144 | <para>
|
---|
[f3d174f] | 145 | <parameter>--with-env-editor</parameter>: This switch enables use of the
|
---|
[bcd2922] | 146 | environment variable EDITOR for <command>visudo</command>.
|
---|
| 147 | </para>
|
---|
[8890b85f] | 148 |
|
---|
[f3d174f] | 149 | <para>
|
---|
[ecea644] | 150 | <parameter>--with-passprompt</parameter>: This switch sets the password prompt.
|
---|
[7f99ddf] | 151 | The <parameter>%p</parameter> will be expanded to the name of the user whose password is being requested.
|
---|
[f3d174f] | 152 | </para>
|
---|
| 153 |
|
---|
[14c71e0a] | 154 | <para>
|
---|
[f586237] | 155 | <option>--without-pam</option>: This switch avoids building
|
---|
| 156 | <application>Linux-PAM</application> support when
|
---|
| 157 | <application>Linux-PAM</application> is installed on the system.
|
---|
[14c71e0a] | 158 | </para>
|
---|
[17b685f1] | 159 | <!-- See the developer note above before the configure command
|
---|
[b9d56ad4] | 160 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
[f1d7196] | 161 | href="../../xincludes/static-libraries.xml"/>-->
|
---|
[b9d56ad4] | 162 |
|
---|
[33d90fe] | 163 | <note>
|
---|
[bcd2922] | 164 | <para>
|
---|
| 165 | There are many options to <application>sudo</application>'s
|
---|
| 166 | <command>configure</command> command. Check the
|
---|
| 167 | <command>configure --help</command> output for a complete list.
|
---|
| 168 | </para>
|
---|
[33d90fe] | 169 | </note>
|
---|
[cf341b4] | 170 |
|
---|
[2809c8c] | 171 | <para>
|
---|
[f586237] | 172 | <command>ln -sfv libsudo_util...</command>: Works around a bug in the
|
---|
[2809c8c] | 173 | installation process, which links to the previously installed
|
---|
| 174 | version (if there is one) instead of the new one.
|
---|
| 175 | </para>
|
---|
| 176 |
|
---|
[cf341b4] | 177 | </sect2>
|
---|
| 178 |
|
---|
| 179 | <sect2 role="configuration">
|
---|
| 180 | <title>Configuring Sudo</title>
|
---|
| 181 |
|
---|
| 182 | <sect3 id="sudo-config">
|
---|
| 183 | <title>Config File</title>
|
---|
| 184 |
|
---|
[7a47afc] | 185 | <para>
|
---|
| 186 | <filename>/etc/sudoers</filename>
|
---|
| 187 | </para>
|
---|
[cf341b4] | 188 |
|
---|
| 189 | <indexterm zone="sudo sudo-config">
|
---|
| 190 | <primary sortas="e-etc-sudoers">/etc/sudoers</primary>
|
---|
| 191 | </indexterm>
|
---|
| 192 |
|
---|
| 193 | </sect3>
|
---|
| 194 |
|
---|
| 195 | <sect3>
|
---|
| 196 | <title>Configuration Information</title>
|
---|
| 197 |
|
---|
[bcd2922] | 198 | <para>
|
---|
| 199 | The <filename>sudoers</filename> file can be quite complicated. It
|
---|
| 200 | is composed of two types of entries: aliases (basically variables) and
|
---|
| 201 | user specifications (which specify who may run what). The installation
|
---|
[b4c31a6] | 202 | installs a default configuration that has no privileges installed for
|
---|
| 203 | any user.
|
---|
[bcd2922] | 204 | </para>
|
---|
[bccbdaea] | 205 |
|
---|
[a5b9f1e] | 206 | <para>
|
---|
[c513d6e6] | 207 | A couple of common configuration changes are to set the path for the
|
---|
[77b64bd] | 208 | super user and to allow members of the wheel group to execute all
|
---|
| 209 | commands after providing their own credientials. Use the following
|
---|
[7826062] | 210 | commands to create the <filename>/etc/sudoers.d/00-sudo</filename>
|
---|
[77b64bd] | 211 | configuration file as the
|
---|
| 212 | <systemitem class="username">root</systemitem> user:
|
---|
[a5b9f1e] | 213 | </para>
|
---|
| 214 |
|
---|
[193bdf3] | 215 | <screen role="root"><userinput>cat > /etc/sudoers.d/00-sudo << "EOF"
|
---|
[2f4e6181] | 216 | <literal>Defaults secure_path="/usr/sbin:/usr/bin"
|
---|
[77b64bd] | 217 | %wheel ALL=(ALL) ALL</literal>
|
---|
| 218 | EOF</userinput></screen>
|
---|
[8558044] | 219 |
|
---|
[193bdf3] | 220 | <note>
|
---|
| 221 | <para>
|
---|
| 222 | In very simple installations where there is only one user, it
|
---|
| 223 | may be easier to just edit the <filename>/etc/sudoers</filename>
|
---|
| 224 | file directly. In that case, the <varname>secure_path</varname>
|
---|
| 225 | entry may not be needed and using <command>sudo -E ...</command> can
|
---|
[7a9a7b26] | 226 | import the non-privileged user's full environment into the
|
---|
[193bdf3] | 227 | privileged session.
|
---|
| 228 | </para>
|
---|
[7a9a7b26] | 229 |
|
---|
[193bdf3] | 230 | <para>
|
---|
[7a9a7b26] | 231 | The files in the <filename class="directory">/etc/sudoers.d</filename>
|
---|
| 232 | directory are parsed in sorted lexical order. Be careful that entries
|
---|
[193bdf3] | 233 | in an added file do not overwrite previous entries.
|
---|
| 234 | </para>
|
---|
| 235 | </note>
|
---|
| 236 |
|
---|
[bcd2922] | 237 | <para>
|
---|
| 238 | For details, see <command>man sudoers</command>.
|
---|
| 239 | </para>
|
---|
[cf341b4] | 240 |
|
---|
[3c0f868f] | 241 | <note>
|
---|
[bcd2922] | 242 | <para>
|
---|
| 243 | The <application>Sudo</application> developers highly recommend
|
---|
| 244 | using the <command>visudo</command> program to edit the
|
---|
| 245 | <filename>sudoers</filename> file. This will provide basic sanity
|
---|
[b4c31a6] | 246 | checking like syntax parsing and file permission to avoid some
|
---|
| 247 | possible mistakes that could lead to a vulnerable configuration.
|
---|
[bcd2922] | 248 | </para>
|
---|
[3c0f868f] | 249 | </note>
|
---|
| 250 |
|
---|
[bcd2922] | 251 | <para>
|
---|
[14c71e0a] | 252 | If <application>PAM</application> is installed on the system,
|
---|
| 253 | <application>Sudo</application> is built with
|
---|
[b4c31a6] | 254 | <application>PAM</application> support. In that case, issue the
|
---|
| 255 | following command as the <systemitem class="username">root</systemitem>
|
---|
| 256 | user to create the <application>PAM</application> configuration file:
|
---|
[bcd2922] | 257 | </para>
|
---|
[8890b85f] | 258 |
|
---|
[add8d4f] | 259 | <screen role="root"><userinput>cat > /etc/pam.d/sudo << "EOF"
|
---|
| 260 | <literal># Begin /etc/pam.d/sudo
|
---|
[b3a4f60] | 261 |
|
---|
| 262 | # include the default auth settings
|
---|
| 263 | auth include system-auth
|
---|
| 264 |
|
---|
| 265 | # include the default account settings
|
---|
| 266 | account include system-account
|
---|
| 267 |
|
---|
| 268 | # Set default environment variables for the service user
|
---|
| 269 | session required pam_env.so
|
---|
| 270 |
|
---|
| 271 | # include system session defaults
|
---|
| 272 | session include system-session
|
---|
| 273 |
|
---|
[add8d4f] | 274 | # End /etc/pam.d/sudo</literal>
|
---|
[b3a4f60] | 275 | EOF
|
---|
| 276 | chmod 644 /etc/pam.d/sudo</userinput></screen>
|
---|
[fd7e0ed6] | 277 |
|
---|
[cf341b4] | 278 | </sect3>
|
---|
| 279 |
|
---|
| 280 | </sect2>
|
---|
| 281 |
|
---|
| 282 | <sect2 role="content">
|
---|
| 283 | <title>Contents</title>
|
---|
| 284 |
|
---|
| 285 | <segmentedlist>
|
---|
| 286 | <segtitle>Installed Programs</segtitle>
|
---|
[9d53187] | 287 | <segtitle>Installed Libraries</segtitle>
|
---|
[cf341b4] | 288 | <segtitle>Installed Directories</segtitle>
|
---|
| 289 |
|
---|
| 290 | <seglistitem>
|
---|
[bcd2922] | 291 | <seg>
|
---|
[a82b5f44] | 292 | cvtsudoers, sudo, sudo_logsrvd, sudo_sendlog,
|
---|
| 293 | sudoedit (symlink), sudoreplay, and visudo
|
---|
[bcd2922] | 294 | </seg>
|
---|
| 295 | <seg>
|
---|
[a82b5f44] | 296 | <!-- [pierre, September 25, 2020] except libsudo_util, the other
|
---|
| 297 | shared objects in /usr/lib/sudo look more like modules than
|
---|
| 298 | libraries. Leaving them now, and updating the list, but I think
|
---|
| 299 | they should not be listed. -->
|
---|
| 300 | audit_json.so, group_file.so, libsudo_util.so, sample_approval.so,
|
---|
[6b4f8529] | 301 | sudoers.so, sudo_noexec.so, and system_group.so
|
---|
[bcd2922] | 302 | </seg>
|
---|
| 303 | <seg>
|
---|
[7a47afc] | 304 | /etc/sudoers.d,
|
---|
[b378aa0] | 305 | /usr/lib/sudo,
|
---|
[06915b3] | 306 | /usr/share/doc/sudo-&sudo-version;, and
|
---|
[a82b5f44] | 307 | /var/lib/sudo
|
---|
[bcd2922] | 308 | </seg>
|
---|
[cf341b4] | 309 | </seglistitem>
|
---|
| 310 | </segmentedlist>
|
---|
| 311 |
|
---|
| 312 | <variablelist>
|
---|
| 313 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 314 | <?dbfo list-presentation="list"?>
|
---|
| 315 | <?dbhtml list-presentation="table"?>
|
---|
| 316 |
|
---|
[d7bbb40] | 317 | <varlistentry id="cvtsudoers">
|
---|
| 318 | <term><command>cvtsudoers</command></term>
|
---|
| 319 | <listitem>
|
---|
| 320 | <para>
|
---|
[4c24eb0a] | 321 | converts between sudoers file formats
|
---|
[d7bbb40] | 322 | </para>
|
---|
| 323 | <indexterm zone="sudo cvtsudoers">
|
---|
| 324 | <primary sortas="b-cvtsudoers">cvtsudoers</primary>
|
---|
| 325 | </indexterm>
|
---|
| 326 | </listitem>
|
---|
| 327 | </varlistentry>
|
---|
| 328 |
|
---|
[cf341b4] | 329 | <varlistentry id="sudo_prog">
|
---|
| 330 | <term><command>sudo</command></term>
|
---|
| 331 | <listitem>
|
---|
[bcd2922] | 332 | <para>
|
---|
| 333 | executes a command as another user as permitted by
|
---|
[4c24eb0a] | 334 | the <filename>/etc/sudoers</filename> configuration file
|
---|
[cf341b4] | 335 | </para>
|
---|
| 336 | <indexterm zone="sudo sudo">
|
---|
| 337 | <primary sortas="b-sudo">sudo</primary>
|
---|
| 338 | </indexterm>
|
---|
| 339 | </listitem>
|
---|
| 340 | </varlistentry>
|
---|
| 341 |
|
---|
[a82b5f44] | 342 | <varlistentry id="sudo_logsrvd">
|
---|
| 343 | <term><command>sudo_logsrvd</command></term>
|
---|
| 344 | <listitem>
|
---|
| 345 | <para>
|
---|
[4c24eb0a] | 346 | is a sudo event and I/O log server
|
---|
[a82b5f44] | 347 | </para>
|
---|
| 348 | <indexterm zone="sudo sudo_logsrvd">
|
---|
| 349 | <primary sortas="b-sudo_logsrvd">sudo_logsrvd</primary>
|
---|
| 350 | </indexterm>
|
---|
| 351 | </listitem>
|
---|
| 352 | </varlistentry>
|
---|
| 353 |
|
---|
| 354 | <varlistentry id="sudo_sendlog">
|
---|
| 355 | <term><command>sudo_sendlog</command></term>
|
---|
| 356 | <listitem>
|
---|
| 357 | <para>
|
---|
[4c24eb0a] | 358 | sends sudo I/O logs to the log server
|
---|
[a82b5f44] | 359 | </para>
|
---|
| 360 | <indexterm zone="sudo sudo_sendlog">
|
---|
| 361 | <primary sortas="b-sudo_sendlog">sudo_sendlog</primary>
|
---|
| 362 | </indexterm>
|
---|
| 363 | </listitem>
|
---|
| 364 | </varlistentry>
|
---|
| 365 |
|
---|
[cf341b4] | 366 | <varlistentry id="sudoedit">
|
---|
| 367 | <term><command>sudoedit</command></term>
|
---|
| 368 | <listitem>
|
---|
[bcd2922] | 369 | <para>
|
---|
[a1e0f76] | 370 | is a symlink to <command>sudo</command> that implies the
|
---|
[4c24eb0a] | 371 | <option>-e</option> option to invoke an editor as another user
|
---|
[bcd2922] | 372 | </para>
|
---|
[cf341b4] | 373 | <indexterm zone="sudo sudoedit">
|
---|
| 374 | <primary sortas="b-sudoedit">sudoedit</primary>
|
---|
| 375 | </indexterm>
|
---|
| 376 | </listitem>
|
---|
| 377 | </varlistentry>
|
---|
| 378 |
|
---|
[72d90b67] | 379 | <varlistentry id="sudoreplay">
|
---|
| 380 | <term><command>sudoreplay</command></term>
|
---|
[3c0f868f] | 381 | <listitem>
|
---|
[bcd2922] | 382 | <para>
|
---|
[72d90b67] | 383 | is used to play back or list the output
|
---|
[4c24eb0a] | 384 | logs created by <command>sudo</command>
|
---|
[bcd2922] | 385 | </para>
|
---|
[72d90b67] | 386 | <indexterm zone="sudo sudoreplay">
|
---|
| 387 | <primary sortas="b-sudoreplay">sudoreplay</primary>
|
---|
[3c0f868f] | 388 | </indexterm>
|
---|
| 389 | </listitem>
|
---|
| 390 | </varlistentry>
|
---|
| 391 |
|
---|
[72d90b67] | 392 | <varlistentry id="visudo">
|
---|
| 393 | <term><command>visudo</command></term>
|
---|
[61b8305] | 394 | <listitem>
|
---|
[bcd2922] | 395 | <para>
|
---|
[72d90b67] | 396 | allows for safer editing of the <filename>sudoers</filename>
|
---|
[4c24eb0a] | 397 | file
|
---|
[bcd2922] | 398 | </para>
|
---|
[72d90b67] | 399 | <indexterm zone="sudo visudo">
|
---|
| 400 | <primary sortas="b-visudo">visudo</primary>
|
---|
[61b8305] | 401 | </indexterm>
|
---|
| 402 | </listitem>
|
---|
| 403 | </varlistentry>
|
---|
[3c0f868f] | 404 |
|
---|
[cf341b4] | 405 | </variablelist>
|
---|
| 406 |
|
---|
| 407 | </sect2>
|
---|
| 408 |
|
---|
| 409 | </sect1>
|
---|