Skip to content
rdavidPublic

About

A PAM module that logs authentication data for auditing and security research

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

93 Commits

Folders and files

Repository files navigation

PamTap

                                              __
                       ____  ____ _____ ___  / /_____ _____
                      / __ \/ __ `/ __ `__ \/ __/ __ `/ __ \
                     / /_/ / /_/ / / / / / / /_/ /_/ / /_/ /
                    / .___/\__,_/_/ /_/ /_/\__/\__,_/ .___/
                   /_/                             /_/
build hits of code license

About

This project implements a Pluggable Authentication Module (PAM) that hooks into the pam_sm_authenticate API to capture the username, password, process ID, and triggering command on every login. The collected data is appended to /tmp/pamtap.log in a structured format for auditing and research. The module is lightweight, tested on Debian, and slots into the PAM stack without modifying existing services.

Install

Disable the authentication timeout for sudo, as described in this Ask Ubuntu answer. Then add the module to the sudo PAM stack and install it:

sudo sed -i '2s/^/auth sufficient pamtap.so/' /etc/pam.d/sudo
make install

From this point on, every sudo command logs to /tmp/pamtap.log.

Using

Run any sudo command, then inspect the log:

sudo ls
cat /tmp/pamtap.log

Each authentication appends a single line:

user:david, pass:s3cr3t, pid:12345, cmd:sudo ls.
Caution
The module records the entered password in clear text in a world-readable file under /tmp. Use it only for controlled auditing or research, never on systems that handle real credentials.

Build

The module builds with make:

make main     # compile main.o with -Wall -Wextra -Werror
make install  # link pamtap.so into the PAM modules directory
make test     # load the module into a throwaway PAM service and check it

The make test target builds the module, loads it into a disposable PAM service, drives an authentication with pamtester, and asserts the attempt reaches the log. It needs sudo to write the service file under /etc/pam.d.

Continuous integration compiles main.c with both gcc and clang, runs the behavioral make test, runs the cppcheck static analyzer, and applies the following linters: actionlint, checkmake, conform, gitleaks, reuse, typos, yamllint, zizmor.

License

pamtap belongs to David Rabkin and uses a Zero-Clause BSD license.

About

A PAM module that logs authentication data for auditing and security research

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages