Skip to main content

pam-tester

pam-tester is a tool to verify PAM auth configurations. It is intended to run in CI settings where you want to make sure you are generating a working PAM configuration. But it can also be used in many other settings.

Features:

  • support username and password auth with one factor
  • check different pam stacks
  • check for failed auth conditions

Installation

You can either clone this repository and run pam-tester.py with your local Python. Or you can use a prebuild executable that should be usable on most current Linux distributions.

Download

wget https://github.com/schurzi/pam-tester/releases/download/latest/pam-tester
chmod +x pam-tester
./pam-tester

Build

git clone https://github.com/schurzi/pam-tester
cd pam-tester
pip install -r requirements.txt
python pam-tester.py

Usage

Usage: pam-tester [OPTIONS]

  A basic testing programm for PAM tests.

Options:
  --user TEXT      username for authentication.
  --password TEXT  Password of the user.
  --stack TEXT     PAM stack to test.
  --expectfail     invert return code (True if PAM stack failed, False if success).

  --help           Show this message and exit.

If you call this tool without any options, it will try to authenticate as root. The password will be queried, if you do not specify one via option. The default PAM stack login is used, if you want to check any other stack (indicated by the filename in /etc/pam.d) you have to specify this stack by name.

Examples

useradd -m testuser
echo "Sup3rPassw0rd" | passwd testuser --stdin
# --------------------------------------------------
./pam-tester --user testuser --password Sup3rPassw0rd
# authenticating user testuser in PAM stack login, status: PAM code 0, PAM reason Success
echo $?
# 0
# --------------------------------------------------
./pam-tester --user testuser --password test
# authenticating user testuser in PAM stack login, status: PAM code 7, PAM reason Authentication failure
echo $?
# 1
# --------------------------------------------------
./pam-tester --user testuser --password Sup3rPassw0rd --expectfail
# authenticating user testuser in PAM stack login, status: PAM code 0, PAM reason Success
echo $?
# 1
# --------------------------------------------------
./pam-tester --user testuser --password test --expectfail
# authenticating user testuser in PAM stack login, status: PAM code 7, PAM reason Authentication failure
echo $?
# 0

Metadata

Release files for pam-tester 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pam-tester 0.0.3
File Size Uploaded
pam_tester-0.0.3.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pam-tester 0.0.3
File Interpreter ABI Platform
pam_tester-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / pam_tester-0.0.3.tar.gz

Download URL pam_tester-0.0.3.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2f823c94e1d5cd2bae9a0c1fbad09d255bd2eb05907c9fb990c6c95b048787a7
BLAKE2b-256 checksum
How to use checksums
80eeed0904f55f2f7d455ea2dae844101b3397e64ff8e6386572d0714d0b6f8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / pam_tester-0.0.3-py3-none-any.whl

Download URL pam_tester-0.0.3-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c88b2537a4f81c0ab91f4a7b6a5bc5fbf52e7078f5aff2f9271329dd62bbbe03
BLAKE2b-256 checksum
How to use checksums
759be00acd2246685f7ba33cc39fa7984061af7b77cd6c8eab240f3d50cef622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page