Sudo-1.8.27

#### Beyond Linux® From Scratch (systemd Edition) - Version 9.0

### Chapter 4. Security

- Prev

  stunnel-5.55

- Next

  Tripwire-2.4.3.7

- Up
- Home

# Sudo-1.8.27

## Introduction to Sudo

The Sudo package allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as `root` or another user while logging the commands and arguments.

This package is known to build and work properly using an LFS-9.0 platform.

### Package Information

- Download (HTTP): http://www.sudo.ws/dist/sudo-1.8.27.tar.gz

- Download (FTP): ftp://ftp.sudo.ws/pub/sudo/sudo-1.8.27.tar.gz

- Download MD5 sum: b5c184b13b6b5de32af630af2fd013fd

- Download size: 3.1 MB

- Estimated disk space required: 38 MB (with tests)

- Estimated build time: 0.4 SBU (with tests)

### Sudo Dependencies

#### Optional

Linux-PAM-1.3.1, MIT Kerberos V5-1.17, OpenLDAP-2.4.48, MTA (that provides a sendmail command), AFS, FWTK, and Opie

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/sudo

## Installation of Sudo

Install Sudo by running the following commands:

    ./configure --prefix=/usr              \
                --libexecdir=/usr/lib      \
                --with-secure-path         \
                --with-all-insults         \
                --with-env-editor          \
                --docdir=/usr/share/doc/sudo-1.8.27 \
                --with-passprompt="[sudo] password for %p: " &&
    make

To test the results, issue: env LC_ALL=C make check 2>&1 | tee ../make-check.log. Check the results with grep failed ../make-check.log. One test, test3, is known to fail if the tests are run as the root user.

Now, as the `root` user:

    make install &&
    ln -sfv libsudo_util.so.0.0.0 /usr/lib/sudo/libsudo_util.so.0

## Command Explanations

`--libexecdir=/usr/lib`: This switch controls where private programs are installed. Everything in that directory is a library, so they belong under `/usr/lib` instead of `/usr/libexec`.

`--with-secure-path`: This switch transparently adds `/sbin` and `/usr/sbin` directories to the `PATH` environment variable.

`--with-all-insults`: This switch includes all the sudo insult sets.

`--with-env-editor`: This switch enables use of the environment variable EDITOR for visudo.

`--with-passprompt`: This switch sets the password prompt.

`--without-pam`: This switch avoids building Linux-PAM support when Linux-PAM is installed on the system.

### Note

There are many options to sudo's configure command. Check the configure --help output for a complete list.

ln -sfv libsudo_util...: Works around a bug in the installation process, which links to the previously installed version (if there is one) instead of the new one.

## Configuring Sudo

### Config File

`/etc/sudoers`

### Configuration Information

The `sudoers` file can be quite complicated. It is composed of two types of entries: aliases (basically variables) and user specifications (which specify who may run what). The installation installs a default configuration that has no privileges installed for any user.

A couple of common configuration chanes are to set the path for the super user and to allow members of the wheel group to execute all commands after providing their own credientials. Use the following commands to create the `/etc/sudoers.d/sudo` configuration file as the `root` user:

    cat > /etc/sudoers.d/sudo << "EOF"
    Defaults secure_path="/usr/bin:/bin:/usr/sbin:/sbin"
    %wheel ALL=(ALL) ALL
    EOF

For details, see man sudoers.

### Note

The Sudo developers highly recommend using the visudo program to edit the `sudoers` file. This will provide basic sanity checking like syntax parsing and file permission to avoid some possible mistakes that could lead to a vulnerable configuration.

If PAM is installed on the system, Sudo is built with PAM support. In that case, issue the following command as the `root` user to create the PAM configuration file:

    cat > /etc/pam.d/sudo << "EOF"
    # Begin /etc/pam.d/sudo

    # include the default auth settings
    auth      include     system-auth

    # include the default account settings
    account   include     system-account

    # Set default environment variables for the service user
    session   required    pam_env.so

    # include system session defaults
    session   include     system-session

    # End /etc/pam.d/sudo
    EOF
    chmod 644 /etc/pam.d/sudo

## Contents

Installed Programs: sudo, sudoedit (symlink), sudoreplay, and visudo
Installed Libraries: group_file.so, libsudo_util.so, sudoers.so, sudo_noexec.so, and system_group.so
Installed Directories: /etc/sudoers.d, /usr/lib/sudo, /usr/share/doc/sudo-1.8.27, and /var/{lib,run}/sudo

### Short Descriptions

sudo | executes a command as another user as permitted by the `/etc/sudoers` configuration file.
sudoedit | is a symlink to sudo that implies the `-e` option to invoke an editor as another user.
sudoreplay | is used to play back or list the output logs created by sudo.
visudo | allows for safer editing of the `sudoers` file.

Last updated on 2019-08-15 16:08:28 -0700

- Prev

  stunnel-5.55

- Next

  Tripwire-2.4.3.7

- Up
- Home