Renamed chkpw to chkpwd. (1.3.0)
This commit is contained in:
parent
0fb2bc12e7
commit
a2bcc55b38
6 changed files with 61 additions and 61 deletions
20
Makefile
20
Makefile
|
|
@ -1,21 +1,21 @@
|
||||||
all:
|
all:
|
||||||
$(CC) -Wall -o ./chkpw ./chkpw.c -lpam
|
$(CC) -Wall -o ./chkpwd ./chkpwd.c -lpam
|
||||||
gzip -fk ./chkpw.1
|
gzip -fk ./chkpwd.1
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ./chkpw
|
rm -f ./chkpwd
|
||||||
rm -f ./chkpw.1.gz
|
rm -f ./chkpwd.1.gz
|
||||||
rm -f ./test
|
rm -f ./test
|
||||||
|
|
||||||
install:
|
install:
|
||||||
install -g 0 -o 0 -m 0655 ./chkpw /usr/bin/
|
install -g 0 -o 0 -m 0655 ./chkpwd /usr/bin/
|
||||||
install -g 0 -o 0 -m 0644 ./chkpw.h /usr/include/
|
install -g 0 -o 0 -m 0644 ./chkpwd.h /usr/include/
|
||||||
install -g 0 -o 0 -m 0644 ./chkpw.1.gz /usr/share/man/man1/
|
install -g 0 -o 0 -m 0644 ./chkpwd.1.gz /usr/share/man/man1/
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f /usr/bin/chkpw
|
rm -f /usr/bin/chkpwd
|
||||||
rm -f /usr/include/chkpw.h
|
rm -f /usr/include/chkpwd.h
|
||||||
rm -f /usr/share/man/man1/chkpw.1.gz
|
rm -f /usr/share/man/man1/chkpwd.1.gz
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(CC) -Wall -DPAM_DEBUG -o test test.c
|
$(CC) -Wall -DPAM_DEBUG -o test test.c
|
||||||
|
|
|
||||||
46
README.md
46
README.md
|
|
@ -1,8 +1,8 @@
|
||||||
# chkpw
|
# chkpwd
|
||||||
|
|
||||||
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.
|
chkpwd 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 chkpw 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.
|
Currently chkpwd 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.
|
||||||
|
|
||||||
## The idea
|
## The idea
|
||||||
|
|
||||||
|
|
@ -12,35 +12,35 @@ I needed a program to verify passwords of users on Linux/UNIX systems using PAM
|
||||||
|
|
||||||
You need the PAM development package installed. On Alpine it is named linux-pam-dev, on Debian based systems it is libpam0g-dev.
|
You need the PAM development package installed. On Alpine it is named linux-pam-dev, on Debian based systems it is libpam0g-dev.
|
||||||
|
|
||||||
## Building chkpw
|
## Building chkpwd
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://git.xw3.org/hanez/chkpw.git
|
git clone https://git.xw3.org/hanez/chkpwd.git
|
||||||
cd chkpw
|
cd chkpwd
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
The code only supports verifying passwords for user id 1000 by default. Look at the file chkpw.h for some compile time options!
|
The code only supports verifying passwords for user id 1000 by default. Look at the file chkpwd.h for some compile time options!
|
||||||
|
|
||||||
### Custom build example
|
### Custom build example
|
||||||
|
|
||||||
Set MAX_UID and MIN_UID at compile time:
|
Set MAX_UID and MIN_UID at compile time:
|
||||||
|
|
||||||
```
|
```
|
||||||
gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o chkpw chkpw.c -lpam -lpam_misc
|
gcc -Wall -DMAX_UID=1000 -DMIN_UID=1000 -o chkpwd chkpwd.c -lpam -lpam_misc
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
**WARNING:** Install this software with care. chkpw could easily be used for bruteforcing passwords from local users!
|
**WARNING:** Install this software with care. chkpwd could easily be used for bruteforcing passwords from local users!
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
chkpw is installed to /usr/bin/.
|
chkpwd is installed to /usr/bin/.
|
||||||
|
|
||||||
chkpw.h is installed to /usr/include/ for use in other applications.
|
chkpwd.h is installed to /usr/include/ for use in other applications.
|
||||||
|
|
||||||
## Uninstall
|
## Uninstall
|
||||||
|
|
||||||
|
|
@ -51,8 +51,8 @@ sudo make uninstall
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
chkpw -h
|
chkpwd -h
|
||||||
Usage: chkpw [-u <username>] [-p <password>] [-v] [-V] [-h]
|
Usage: chkpwd [-u <username>] [-p <password>] [-v] [-V] [-h]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-u <username> Set username.
|
-u <username> Set username.
|
||||||
|
|
@ -62,15 +62,15 @@ Options:
|
||||||
-h Show this help.
|
-h Show this help.
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use chkpw even without installing by just running the following command:
|
You can also use chkpwd even without installing by just running the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
./chkpw
|
./chkpwd
|
||||||
```
|
```
|
||||||
|
|
||||||
### Return codes
|
### Return codes
|
||||||
|
|
||||||
chkpw returns 0 on success, 1 otherwise.
|
chkpwd returns 0 on success, 1 otherwise.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
|
@ -78,19 +78,19 @@ chkpw returns 0 on success, 1 otherwise.
|
||||||
#### Interactive mode asking for a username and a password
|
#### Interactive mode asking for a username and a password
|
||||||
|
|
||||||
```
|
```
|
||||||
chkpw
|
chkpwd
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Interactive mode only asking for a password
|
#### Interactive mode only asking for a password
|
||||||
|
|
||||||
```
|
```
|
||||||
chkpw -u hanez
|
chkpwd -u hanez
|
||||||
```
|
```
|
||||||
|
|
||||||
#### None interactive mode with username and password provided as arguments to chkpw
|
#### None interactive mode with username and password provided as arguments to chkpwd
|
||||||
|
|
||||||
```
|
```
|
||||||
chkpw -u hanez -p password
|
chkpwd -u hanez -p password
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Request the result from the above commands
|
#### Request the result from the above commands
|
||||||
|
|
@ -101,14 +101,14 @@ echo $?
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
chkpw is licensed under the Apache License, Version 2.0.
|
chkpwd is licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
See LICENSE for details.
|
See LICENSE for details.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [https://git.xw3.org/hanez/chkpw](https://git.xw3.org/hanez/chkpw)
|
- [https://git.xw3.org/hanez/chkpwd](https://git.xw3.org/hanez/chkpwd)
|
||||||
- [https://linux.die.net/man/8/unix_chkpwd](https://linux.die.net/man/8/unix_chkpwd)
|
- [https://linux.die.net/man/8/unix_chkpwdd](https://linux.die.net/man/8/unix_chkpwd)
|
||||||
- [https://cr.yp.to/checkpwd.html](https://cr.yp.to/checkpwd.html)
|
- [https://cr.yp.to/checkpwd.html](https://cr.yp.to/checkpwd.html)
|
||||||
- [https://pamtester.sourceforge.net/](https://pamtester.sourceforge.net/)
|
- [https://pamtester.sourceforge.net/](https://pamtester.sourceforge.net/)
|
||||||
|
|
||||||
|
|
|
||||||
24
chkpw.1
24
chkpw.1
|
|
@ -1,24 +0,0 @@
|
||||||
.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)
|
|
||||||
24
chkpwd.1
Normal file
24
chkpwd.1
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
.TH man 1 "01 Jun 2025" "chkpwd 1.3.0" "chkpwd man page"
|
||||||
|
.SH NAME
|
||||||
|
chkpwd \- checks the validity of a users password on a UNIX/PAM-based system.
|
||||||
|
.SH SYNOPSIS
|
||||||
|
chkpwd [OPTION]...
|
||||||
|
.SH DESCRIPTION
|
||||||
|
chkpwd 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 chkpwd command are:
|
||||||
|
|
||||||
|
-u <username> Set username.
|
||||||
|
-p <password> Set password.
|
||||||
|
-v Enable verbose mode.
|
||||||
|
-V Print program version.
|
||||||
|
-h Show this help.
|
||||||
|
|
||||||
|
chkpwd 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)
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* chkpw is a program that checks the validity of a users password on a
|
* chkpwd is a program that checks the validity of a users password on a
|
||||||
* UNIX/PAM-based system.
|
* UNIX/PAM-based system.
|
||||||
*
|
*
|
||||||
* Author: Johannes Findeisen <you@hanez.org> - 2024
|
* Author: Johannes Findeisen <you@hanez.org> - 2024
|
||||||
* License: Apache-2.0 (see LICENSE)
|
* License: Apache-2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "chkpw.h"
|
#include "chkpwd.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* chkpw.h is part of chkpw, a program that checks the validity of a users
|
* chkpwd.h is part of chkpwd, a program that checks the validity of a users
|
||||||
* password on a UNIX/PAM-based system.
|
* password on a UNIX/PAM-based system.
|
||||||
*
|
*
|
||||||
* Author: Johannes Findeisen <you@hanez.org> - 2025
|
* Author: Johannes Findeisen <you@hanez.org> - 2025
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <security/pam_misc.h>
|
#include <security/pam_misc.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define VERSION "1.2.0"
|
#define VERSION "1.3.0"
|
||||||
|
|
||||||
bool checkpw_authenticate(const char *username, const char *password,
|
bool checkpw_authenticate(const char *username, const char *password,
|
||||||
bool verbose);
|
bool verbose);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue