跳转到主要内容

PAM配置测试工具

项目描述

pam-tester

pam-tester是一个用于验证PAM认证配置的工具。它旨在在CI设置中运行,以确保您正在生成有效的PAM配置。但它也可以在许多其他环境中使用。

特性

  • 支持单因素的用户名和密码认证
  • 检查不同的PAM堆栈
  • 检查失败的认证条件

安装

您可以选择克隆此存储库并使用本地Python运行pam-tester.py。或者,您可以使用预构建的可执行文件,该文件应在大多数当前Linux发行版上可用。

下载

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

构建

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

用法

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.

如果您不提供任何选项地调用此工具,它将尝试以root身份进行认证。如果未通过选项指定密码,将查询密码。如果默认PAM堆栈login,则使用默认堆栈,如果想要检查任何其他堆栈(由/etc/pam.d中的文件名指示),您必须通过名称指定此堆栈。

示例

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

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

pam_tester-0.0.3.tar.gz (2.4 kB 查看散列值)

上传时间 源代码

构建分发

pam_tester-0.0.3-py3-none-any.whl (3.1 kB 查看散列值)

上传时间 Python 3

支持者