fix: PAM on Debian, enable use_first_pass by default (#3326)

Since we use Debian's PAM autoconf, pam_unix isn't disabled and remains active.
This means pam_unix triggers first and pam_kanidm should use the password it already tried to match to a local user.

This change also moves the postinst hook for PAM config correctly to the libpam-kanidm package,
since that's the one that delivers the config that needs a reinstall!
This commit is contained in:
Jinna Kiisuo 2025-01-01 00:40:14 +02:00 committed by GitHub
parent 227853f8cd
commit 5eb9a4430f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 3 deletions

View file

@ -35,6 +35,7 @@ maintainer = "James Hodgkinson <james@terminaloutcomes.com>"
depends = ["libc6", "libpam0g"] depends = ["libc6", "libpam0g"]
section = "network" section = "network"
priority = "optional" priority = "optional"
maintainer-scripts = "debian/"
assets = [ assets = [
# Empty on purpose # Empty on purpose
] ]

View file

@ -4,7 +4,7 @@ Priority: 128
Auth-Type: Primary Auth-Type: Primary
Auth: Auth:
[success=end new_authtok_reqd=done default=ignore] pam_kanidm.so ignore_unknown_user [success=end new_authtok_reqd=done default=ignore] pam_kanidm.so ignore_unknown_user use_first_pass
Account-Type: Primary Account-Type: Primary
Account: Account:

View file

@ -0,0 +1,29 @@
#!/bin/sh
# postinst script for libpam-kanidm
#
# see: dh_installdeb(1)
set -e
case "$1" in
configure)
echo "Updating PAM configuration"
pam-auth-update --package
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View file

@ -8,13 +8,12 @@ set -e
case "$1" in case "$1" in
configure) configure)
pam-auth-update --package
echo "=============================" echo "============================="
echo "Thanks for installing Kanidm!" echo "Thanks for installing Kanidm!"
echo "=============================" echo "============================="
echo "Please ensure you modify the configuration files at /etc/kanidm/unixd and /etc/kanidm/config" echo "Please ensure you modify the configuration files at /etc/kanidm/unixd and /etc/kanidm/config"
echo "Full examples are in /usr/share/kanidm-unixd/" echo "Full examples are in /usr/share/kanidm-unixd/"
echo "To configure nsswitch, please follow instructions in https://kanidm.github.io/kanidm/master/integrations/pam_and_nsswitch.html" echo "PAM has already been autoconfigured by the libpam-kanidm package. To configure nsswitch, please follow instructions in https://kanidm.github.io/kanidm/master/integrations/pam_and_nsswitch.html"
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)