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.
20 lines
509 B
Bash
Executable File
20 lines
509 B
Bash
Executable File
#!/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
|