Renamed project from checkpw to chkpw. (1.2.0)

This commit is contained in:
Johannes Findeisen 2025-06-01 19:23:47 +02:00
commit 22e4f0790a
7 changed files with 58 additions and 58 deletions

6
.gitignore vendored
View file

@ -1,5 +1,5 @@
checkpw
checkpw.o
checkpw.1.gz
chkpw
chkpw.o
chkpw.1.gz
test
test.c

View file

@ -1,21 +1,21 @@
all:
$(CC) -Wall -o ./checkpw ./checkpw.c -lpam
gzip -fk ./checkpw.1
$(CC) -Wall -o ./chkpw ./chkpw.c -lpam
gzip -fk ./chkpw.1
clean:
rm -f ./checkpw
rm -f ./checkpw.1.gz
rm -f ./chkpw
rm -f ./chkpw.1.gz
rm -f ./test
install:
install -g 0 -o 0 -m 0655 ./checkpw /usr/bin/
install -g 0 -o 0 -m 0644 ./checkpw.h /usr/include/
install -g 0 -o 0 -m 0644 ./checkpw.1.gz /usr/share/man/man1/
install -g 0 -o 0 -m 0655 ./chkpw /usr/bin/
install -g 0 -o 0 -m 0644 ./chkpw.h /usr/include/
install -g 0 -o 0 -m 0644 ./chkpw.1.gz /usr/share/man/man1/
uninstall:
rm -f /usr/bin/checkpw
rm -f /usr/include/checkpw.h
rm -f /usr/share/man/man1/checkpw.1.gz
rm -f /usr/bin/chkpw
rm -f /usr/include/chkpw.h
rm -f /usr/share/man/man1/chkpw.1.gz
test:
$(CC) -Wall -DPAM_DEBUG -o test test.c

View file

@ -1,6 +1,6 @@
# checkpw
# chkpw
checkpw is a program that checks the validity of a users password on a UNIX/[PAM](https://en.wikipedia.org/wiki/Pluggable_Authentication_Module)-based system.
chkpw is a program that checks the validity of a users password on a UNIX/[PAM](https://en.wikipedia.org/wiki/Pluggable_Authentication_Module)-based system.
Currently checkpw is only tested on Linux, but it should work on a [AIX](https://en.wikipedia.org/wiki/IBM_AIX), [DragonFly BSD](https://www.dragonflybsd.org/), [FreeBSD](https://www.freebsd.org/), [HP-UX](https://en.wikipedia.org/wiki/HP-UX), [Linux](https://kernel.org/), [macOS](https://en.wikipedia.org/wiki/MacOS), [NetBSD](https://netbsd.org/) and [Solaris](https://en.wikipedia.org/wiki/Oracle_Solaris) operating system too.
@ -15,32 +15,32 @@ You need the PAM development package installed. On Alpine it is named linux-pam-
## Building checkpw
```
git clone https://git.xw3.org/hanez/checkpw.git
git clone https://git.xw3.org/hanez/chkpw.git
cd checkpw
make
```
The code only supports verifying passwords for user id 1000 by default. Look at the file checkpw.h for some compile time options!
The code only supports verifying passwords for user id 1000 by default. Look at the file chkpw.h for some compile time options!
### Custom build example
Set MAX_UID and MIN_UID at compile time:
```
gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o checkpw checkpw.c -lpam -lpam_misc
gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o chkpw chkpw.c -lpam -lpam_misc
```
## Installation
**WARNING:** Install this software with care. checkpw could easily be used for bruteforcing passwords from local users!
**WARNING:** Install this software with care. chkpw could easily be used for bruteforcing passwords from local users!
```
sudo make install
```
checkpw is installed to /usr/bin/.
chkpw is installed to /usr/bin/.
checkpw.h is installed to /usr/include/ for use in other applications.
chkpw.h is installed to /usr/include/ for use in other applications.
## Uninstall
@ -52,7 +52,7 @@ sudo make uninstall
```
checkpw -h
Usage: checkpw [-u <username>] [-p <password>] [-v] [-V] [-h]
Usage: chkpw [-u <username>] [-p <password>] [-v] [-V] [-h]
Options:
-u <username> Set username.
@ -62,15 +62,15 @@ Options:
-h Show this help.
```
You can also use checkpw even without installing by just running the following command:
You can also use chkpw even without installing by just running the following command:
```
./checkpw
./chkpw
```
### Return codes
checkpw returns 0 on success, 1 otherwise.
chkpw returns 0 on success, 1 otherwise.
### Examples
@ -78,19 +78,19 @@ checkpw returns 0 on success, 1 otherwise.
#### Interactive mode asking for a username and a password
```
checkpw
chkpw
```
#### Interactive mode only asking for a password
```
checkpw -u hanez
chkpw -u hanez
```
#### None interactive mode with username and password provided as arguments to checkpw
```
checkpw -u hanez -p password
chkpw -u hanez -p password
```
#### Request the result from the above commands
@ -101,13 +101,13 @@ echo $?
## License
checkpw is licensed under the Apache License, Version 2.0.
chkpw is licensed under the Apache License, Version 2.0.
See LICENSE for details.
## Links
- [https://git.xw3.org/hanez/checkpw](https://git.xw3.org/hanez/checkpw)
- [https://git.xw3.org/hanez/chkpw](https://git.xw3.org/hanez/chkpw)
- [https://cr.yp.to/checkpwd.html](https://cr.yp.to/checkpwd.html)
- [https://pamtester.sourceforge.net/](https://pamtester.sourceforge.net/)

View file

@ -1,24 +0,0 @@
.TH man 1 "11 Jan 2025" "checkpw 1.1.3" "checkpw man page"
.SH NAME
checkpw \- checks the validity of a users password on a UNIX/PAM-based system.
.SH SYNOPSIS
checkpw [OPTION]...
.SH DESCRIPTION
checkpw is a program that checks the validity of a users password on a UNIX/PAM-based system.
.SH OPTIONS
The options which apply to the checkpw command are:
-u <username> Set username.
-p <password> Set password.
-v Enable verbose mode.
-V Print program version.
-h Show this help.
checkpw runs in an interactive mode when no username and/or password are set. A missing username and/or password will then be asked for program execution.
.SH SEE ALSO
pam(3), pam_authenticate(3), PAM(8)
.SH BUGS
No known bugs.
.SH AUTHOR
Johannes Findeisen (you@hanez.org)

24
chkpw.1 Normal file
View file

@ -0,0 +1,24 @@
.TH man 1 "01 Jun 2025" "chkpw 1.2.0" "chkpw man page"
.SH NAME
chkpw \- checks the validity of a users password on a UNIX/PAM-based system.
.SH SYNOPSIS
chkpw [OPTION]...
.SH DESCRIPTION
chkpw is a program that checks the validity of a users password on a UNIX/PAM-based system.
.SH OPTIONS
The options which apply to the chkpw command are:
-u <username> Set username.
-p <password> Set password.
-v Enable verbose mode.
-V Print program version.
-h Show this help.
chkpw runs in an interactive mode when no username and/or password are set. A missing username and/or password will then be asked for program execution.
.SH SEE ALSO
pam(3), pam_authenticate(3), PAM(8)
.SH BUGS
No known bugs.
.SH AUTHOR
Johannes Findeisen (you@hanez.org)

View file

@ -1,12 +1,12 @@
/**
* checkpw is a program that checks the validity of a users password on a
* chkpw is a program that checks the validity of a users password on a
* UNIX/PAM-based system.
*
* Author: Johannes Findeisen <you@hanez.org> - 2024
* License: Apache-2.0 (see LICENSE)
*/
#include "checkpw.h"
#include "chkpw.h"
#include <stdbool.h>
#include <stdio.h>

View file

@ -1,5 +1,5 @@
/**
* checkpw.h is part of checkpw, a program that checks the validity of a users
* chkpw.h is part of chkpw, a program that checks the validity of a users
* password on a UNIX/PAM-based system.
*
* Author: Johannes Findeisen <you@hanez.org> - 2025
@ -11,7 +11,7 @@
#include <security/pam_misc.h>
#include <stdbool.h>
#define VERSION "1.1.3"
#define VERSION "1.2.0"
bool checkpw_authenticate(const char *username, const char *password,
bool verbose);