feat: add pam-pkcs11 configuration

Recommends libpam-pkcs11 package.
Add configuration for Safenet module (pam_pkcs11.conf)
Add UID mapper generator (pkcs11_generate_uids)
Configure certificates for pam_pkcs11 from postinst.
This commit is contained in:
Michel Decima
2021-10-08 11:01:34 +02:00
parent 3ad734c384
commit 1574958cf5
6 changed files with 287 additions and 1 deletions

19
usr/sbin/pkcs11_generate_uids Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
#
# Written by Michel Decima
# Copyright 2021 Orange
#
# Generate uid mapping for pam_pkcs11 using /etc/passwd
#
(( EUID == 0 )) || { echo 2>&1 "Not root." ; exit 1 ; }
mkdir -p /etc/pam_pkcs11
# generate uid mapping for uppercase login ABCD1234 -> abcd1234
getent -s files passwd \
| awk -F: '
/[a-z]{4}[0-9]{4}/ {
printf "%s -> %s\n", toupper($1), $1
}' \
>> /etc/pam_pkcs11/uid_mapping
sort -u -o /etc/pam_pkcs11/uid_mapping /etc/pam_pkcs11/uid_mapping