# 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
```bash
wget https://github.com/schurzi/pam-tester/releases/download/latest/pam-tester
chmod +x pam-tester
./pam-tester
```
### Build
```bash
git clone https://github.com/schurzi/pam-tester
cd pam-tester
pip install -r requirements.txt
python pam-tester.py
```
## Usage
```text
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
```bash
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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/dev-sec/pam-tester",
"name": "pam-tester",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Martin Schurz",
"author_email": "Martin.Schurz@telekom.de",
"download_url": "https://files.pythonhosted.org/packages/80/ee/ed0904f55f2f7d455ea2dae844101b3397e64ff8e6386572d0714d0b6f8d/pam_tester-0.0.3.tar.gz",
"platform": null,
"description": "# pam-tester\n\npam-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.\n\nFeatures:\n\n* support username and password auth with one factor\n* check different pam stacks\n* check for failed auth conditions\n\n## Installation\n\nYou 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.\n\n### Download\n\n```bash\nwget https://github.com/schurzi/pam-tester/releases/download/latest/pam-tester\nchmod +x pam-tester\n./pam-tester\n```\n\n### Build\n\n```bash\ngit clone https://github.com/schurzi/pam-tester\ncd pam-tester\npip install -r requirements.txt\npython pam-tester.py\n```\n\n## Usage\n\n```text\nUsage: pam-tester [OPTIONS]\n\n A basic testing programm for PAM tests.\n\nOptions:\n --user TEXT username for authentication.\n --password TEXT Password of the user.\n --stack TEXT PAM stack to test.\n --expectfail invert return code (True if PAM stack failed, False if success).\n\n --help Show this message and exit.\n```\n\nIf 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.\n\n### Examples\n\n```bash\nuseradd -m testuser\necho \"Sup3rPassw0rd\" | passwd testuser --stdin\n# --------------------------------------------------\n./pam-tester --user testuser --password Sup3rPassw0rd\n# authenticating user testuser in PAM stack login, status: PAM code 0, PAM reason Success\necho $?\n# 0\n# --------------------------------------------------\n./pam-tester --user testuser --password test\n# authenticating user testuser in PAM stack login, status: PAM code 7, PAM reason Authentication failure\necho $?\n# 1\n# --------------------------------------------------\n./pam-tester --user testuser --password Sup3rPassw0rd --expectfail\n# authenticating user testuser in PAM stack login, status: PAM code 0, PAM reason Success\necho $?\n# 1\n# --------------------------------------------------\n./pam-tester --user testuser --password test --expectfail\n# authenticating user testuser in PAM stack login, status: PAM code 7, PAM reason Authentication failure\necho $?\n# 0\n```\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "Tool for testing PAM configurations",
"version": "0.0.3",
"project_urls": {
"Changelog": "https://github.com/dev-sec/pam-tester/blob/master/CHANGELOG.md",
"Documentation": "https://github.com/dev-sec/pam-tester",
"Homepage": "https://github.com/dev-sec/pam-tester",
"Repository": "https://github.com/dev-sec/pam-tester"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "759be00acd2246685f7ba33cc39fa7984061af7b77cd6c8eab240f3d50cef622",
"md5": "2ce1e4621a4084625039cb430bf93c39",
"sha256": "c88b2537a4f81c0ab91f4a7b6a5bc5fbf52e7078f5aff2f9271329dd62bbbe03"
},
"downloads": -1,
"filename": "pam_tester-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ce1e4621a4084625039cb430bf93c39",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 3104,
"upload_time": "2023-08-04T14:42:44",
"upload_time_iso_8601": "2023-08-04T14:42:44.775590Z",
"url": "https://files.pythonhosted.org/packages/75/9b/e00acd2246685f7ba33cc39fa7984061af7b77cd6c8eab240f3d50cef622/pam_tester-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "80eeed0904f55f2f7d455ea2dae844101b3397e64ff8e6386572d0714d0b6f8d",
"md5": "aaf255b997e910db6c1502addc1f4ebb",
"sha256": "2f823c94e1d5cd2bae9a0c1fbad09d255bd2eb05907c9fb990c6c95b048787a7"
},
"downloads": -1,
"filename": "pam_tester-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "aaf255b997e910db6c1502addc1f4ebb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 2374,
"upload_time": "2023-08-04T14:42:46",
"upload_time_iso_8601": "2023-08-04T14:42:46.134102Z",
"url": "https://files.pythonhosted.org/packages/80/ee/ed0904f55f2f7d455ea2dae844101b3397e64ff8e6386572d0714d0b6f8d/pam_tester-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-04 14:42:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dev-sec",
"github_project": "pam-tester",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pam-tester"
}