29 lines
921 B
Bash
Executable File
29 lines
921 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Software Name : orange-yourdev-login
|
|
# SPDX-License-Identifier: Orange-InnerSource
|
|
# SPDX-FileCopyrightText: Copyright (c) 2020-2022 Orange SA
|
|
#
|
|
# This software is confidential and proprietary information of Orange SA.
|
|
# You shall not disclose such Confidential Information and shall not copy,
|
|
# use or distribute it in whole or in part without the prior written
|
|
# consent of Orange SA.
|
|
#
|
|
# Author: Michel Decima <michel.decima@orange.com>
|
|
#
|
|
#
|
|
# 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
|