annotate pam-http/README.md @ 44:50371046c61a

Add support for pam_get_authtok and minor cleanups. This change adds the pam_get_authtok function for PAM modules, as well as performing a few cleanups: - Pattern match in a few more places. - Pull out string-copying into a function. - Format and run clippy. - Replace outdated PAM doc links with man7.org pages.
author Paul Fisher <paul@pfish.zone>
date Sat, 08 Mar 2025 19:29:46 -0500
parents cc32be79a949
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
1 pam-http
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
2 ========
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
3
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
4 A PAM HTTP BasicAuth module built using pam-rs
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
5
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
6 # Prerequisites
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
7
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
8 You need some libraries before you build like libpam and libssl.
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
9
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
10 If you're going to build on Ubuntu, just run this:
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
11
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
12 ```
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
13 sudo apt-get install -y build-essential libpam0g-dev libpam0g libssl-dev
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
14 ```
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
15
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
16 # Building
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
17
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
18 Just use `cargo build`.
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
19
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
20 # Usage
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
21
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
22 You need to move the build product to a folder where PAM is looking for modules.
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
23
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
24 If you're using Ubuntu you can move `libpam_http.so` to `/lib/security`.
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
25 After doing so you need to make sure it has proper permissions: `sudo chmod 755 /lib/security/libpam_http.so`.
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
26 Then you can place a configuration file in `/etc/pam.d/`. It can look something like this:
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
27
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
28 ```
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
29 auth sufficient libpam_http.so url=https://theserver.example.com/someendpoint
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
30 account sufficient libpam_http.so
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
31 ```
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
32
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
33 Make sure the endpoint you're specifying can receive GET requests and supports
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
34 [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side).
cc32be79a949 Add simple README with example usage of pam-http
Rostislav Raykov <z@zbrox.org>
parents:
diff changeset
35 If the user is authenticated successfully it should return HTTP 200.