Bookmark this page

Lab: Controlling Authentication with PAM

Configure system authentication with PAM to use SSSD for authentication, enforce a specified password complexity policy on password changes, and lock user accounts after a specified number of failed logins.

Outcomes

  • Apply an authselect security profile.

  • Configure accounts to lock after failed logins.

  • Configure password quality requirements.

As the student user on the workstation machine, use the lab command to prepare your environment for this exercise, and to ensure that all required resources are available.

[student@workstation ~]$ lab start pam-review

Instructions

  1. Log in to the serverd machine as the root user.

    1. Use the ssh student@serverd command to log in to the serverd machine.

      [student@workstation ~]$ ssh student@serverd
      ...output omitted...
      [student@serverd ~]$
    2. Use the sudo -i command to change to the root user with the student sudo password.

      [student@serverd ~]$ sudo -i
      [sudo] password for student: student
      [root@serverd ~]#
  2. Apply the minimal security profile with the with-faillock additional option.

    1. Use the authselect select minimal with-faillock command to select the minimal security profile with the with-faillock option.

      [root@serverd ~]# authselect select minimal with-faillock
      Profile "minimal" was selected.
      The following nsswitch maps are overwritten by the profile:
      - aliases
      - automount
      - ethers
      - group
      - hosts
      - initgroups
      - netgroup
      - networks
      - passwd
      - protocols
      - publickey
      - rpc
      - services
      - shadow
  3. Configure the pam_faillock module to lock an account after two failed attempts within a five-minute period and to unlock after five minutes.

    1. Use a text editor to modify the /etc/security/faillock.conf configuration file to contain the following settings:

      deny = 2
      fail_interval = 300
      unlock_time = 300
  4. Configure the pam_pwquality module to use the password credit mechanism with the following requirements:

    FieldValue
    Minimum password length or complexity15
    Minimum required lowercase characters1
    Credits for uppercase characters2
    Credits for digits2
    Credits for special characters3
    1. Use a text editor to modify the /etc/security/pwquality.conf configuration file to contain the following settings:

      minlen = 15
      lcredit = -1
      ucredit = 2
      dcredit = 2
      ocredit = 3
    2. Return to the workstation machine.

      [root@serverd ~]# logout
      [student@serverd ~]$ logout
      Connection to closed serverd closed.
      [student@workstation ~]$

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade pam-review

Finish

As the student user on the workstation machine, use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish pam-review

Revision: rh415-9.2-a821299