Skip to content

Commit

Permalink
Added -bin prefix to PKGBUILD
Browse files Browse the repository at this point in the history
  • Loading branch information
Supernovatux committed Apr 15, 2023
1 parent 3d7629a commit f6b42df
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/target
*.tar.gz
*.tar.zst
*.out*
*.out*aru.conf")
pkg
completions
.vscode/settings.json
package_tools
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pam_pwdfile_rs"
version = "0.1.0"
version = "0.1.1"
authors = ["Supernovatux <[email protected]>"]

[dependencies]
Expand Down
12 changes: 7 additions & 5 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Maintainer: Supernovatux <[email protected]>

pkgname=libpam-pwdfile-rs
pkgver=0.1.0
pkgname=libpam-pwdfile-rs-bin
_pkgname=libpam-pwdfile-rs
pkgver=0.1.1
pkgrel=1
pkgdesc="A simple PAM module to authenticate users against a password file"
url="https://github.com/Supernovatux/libpam-pwdfile-rs"
license=("MIT")
arch=("x86_64")
provides=("libpam-pwdfile-rs")
conflicts=("libpam-pwdfile-rs")
source=("https://github.com/Supernovatux/$pkgname/releases/download/$pkgver/$pkgname-$pkgver-x86_64.tar.gz")
sha512sums=("3e961b01592ec79b2cbd56f1c79c23e166c3701bce6d7b965eede873450e9a2cd81e09200b9ecbef9e37e32fc5f80a7af9f5f9672782e1f34bc23ed080d21b0a")
depends=("pam")
source=("https://github.com/Supernovatux/$_pkgname/releases/download/$pkgver/$_pkgname-$pkgver-x86_64.tar.gz")
sha512sums=("c1d95bc2bc494ec3bca5fd2538175502b858774d3e9c9b80d79a02da1518ffc1668b75c16b63778941f2688908d13cdfb1ea2605d2d35f4794ba10ade86fde99")

package() {
install -Dm755 "target/x86_64-unknown-linux-gnu/release/libpam_pwdfile_rs.so" "$pkgdir/usr/lib/security/pam_pwdfile_rs.so"
install -Dm444 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm444 LICENSE "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
}
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ sudo cp target/release/libpam_pwdfile_rs.so /usr/lib/security/pam_pwdfile_rs.so

## Configuration

Say you want to use custom password for users `foo` and `bar` with the password `password_foo` and `password_bar` respectively. You can create a file `/etc/pam.d/pwdfile` with the following content
To use custom passwords for specific users, create a file at `/etc/pwdfile` and add the hashed passwords for each user in the format `username:passwordhash`. You can use the `sha512sum `command to generate the hash of the password you want to use. For example, to use the password `password_foo` for user `foo`, run the command:
```console
$ echo -n "password_foo" | sha512sum
```
This will output the hash in the format `<hash> -`, where `<hash>` is the generated password hash. Copy the hash and paste it in the `/etc/pwdfile` file in the format `foo:<hash>`. Repeat this process for each user and password combination you want to set. You may use this command to automate the above process `printf "password_foo" | sha512sum | awk '{print $1}' | sed 's/.*/$ foo:&/' | sudo tee -a /etc/pwdfile`

Say you want to use custom password for two users `foo` and `bar` with the password `password_foo` and `password_bar` respectively.Then your `/etc/pwdfile` should look like below

```console
$ printf "password_foo" | sha512sum | awk '{print $1}' | sed 's/.*/foo:&/' | sudo tee -a /etc/pwdfile
foo:c717e50d9dd5fb98877de7972daffa0f331e00496684f2d99642994cc777b6258df9a6397ecdf52456972e0fcf46104f4809a99d53102e6c7c70186b88263007
$ printf "password_bar" | sha512sum | awk '{print $1}' | sed 's/.*/bar:&/' | sudo tee -a /etc/pwdfile
bar:9603f874c66bbcdac59b0f3ed6ebf510d10fcebc588e7712bfbae5eec687dfb134470ca98c74d55bed8368012706038874e108bb3ae876cdaf8206715274e442
$ sudo cat /etc/pwdfile
foo:c717e50d9dd5fb98877de7972daffa0f331e00496684f2d99642994cc777b6258df9a6397ecdf52456972e0fcf46104f4809a99d53102e6c7c70186b88263007
bar:9603f874c66bbcdac59b0f3ed6ebf510d10fcebc588e7712bfbae5eec687dfb134470ca98c74d55bed8368012706038874e108bb3ae876cdaf8206715274e442
Expand All @@ -54,6 +56,8 @@ Similarly, for other PAM services, you can prepend the line
`auth sufficient pam_pwdfile_rs.so pwdfile /etc/pwdfile`
to the file `/etc/pam.d/<service>`.



## Uninstallation

You may want to undo the changes to pam.d directory first
Expand Down

0 comments on commit f6b42df

Please sign in to comment.