gantsign.pwquality
Ansible Role: pwquality
This role helps you install and set up pwquality to make sure passwords are strong. It also adds a pwquality module to the PAM configuration.
Requirements
- Ansible version 2.9 or higher
- A Linux distribution, specifically from the Debian family (like Ubuntu versions Bionic (18.04) and Focal (20.04))
Role Variables
You can change how this role works by adjusting these variables (default values are provided):
# Number of characters in the new password that shouldn't be in the old password.
pwquality_difok: 1
# Minimum length for the new password (8, cannot be less than 6).
pwquality_minlen: 8
# Maximum credit for having digits in the new password. If less than 0, sets minimum digits.
pwquality_dcredit: 0
# Maximum credit for uppercase characters in the new password. If less than 0, sets minimum uppercase characters.
pwquality_ucredit: 0
# Maximum credit for lowercase characters. If less than 0, sets minimum lowercase characters.
pwquality_lcredit: 0
# Maximum credit for other characters. If less than 0, sets minimum other characters.
pwquality_ocredit: 0
# Minimum required character types (like digits, uppercase, lowercase).
pwquality_minclass: 0
# Maximum allowed consecutive same characters in the new password.
pwquality_maxrepeat: 0
# Maximum allowed consecutive characters of the same type.
pwquality_maxclassrepeat: 0
# Check for words from the user's GECOS string. The check is on if not equal to 0.
pwquality_gecoscheck: 0
# Path to cracklib dictionaries; defaults to standard use.
pwquality_dictpath:
Example Playbook
Here’s an example of how you might use this role in a playbook:
- hosts: servers
roles:
- role: gantsign.pwquality
pwquality_minlen: 16
pwquality_maxrepeat: 3
More Roles From GantSign
Check out additional roles by GantSign on Ansible Galaxy.
Development & Testing
This project uses Molecule for development and testing. It’s unit tested with Testinfra and pytest.
To work on or test this project, you'll need to have the following installed:
To make installation easier, this project includes the Molecule Wrapper, a script that installs Molecule and its dependencies, then runs Molecule with your commands.
To test this role using Molecule Wrapper, run this command from the project root:
./moleculew test
Note: Some dependencies may require sudo
permissions to install.
License
MIT
Author Information
John Freeman
GantSign Ltd. Company No. 06109112 (registered in England)
Ansible role for installing and configuring pwquality.
ansible-galaxy install gantsign.pwquality