|
|
@ -21,6 +21,9 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Updated by Timothy Pearson <kb9vqf@pearsoncomputing.net> 9/15/2015
|
|
|
|
# Updated by Timothy Pearson <kb9vqf@pearsoncomputing.net> 9/15/2015
|
|
|
|
# Rewrite to use on-card RSA encryption
|
|
|
|
# Rewrite to use on-card RSA encryption
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# Updated by Timothy Pearson <kb9vqf@pearsoncomputing.net> 6/02/2020
|
|
|
|
|
|
|
|
# Use central variable for PKCS library location
|
|
|
|
|
|
|
|
|
|
|
|
# define counter-intuitive shell logic values (based on /bin/true & /bin/false)
|
|
|
|
# define counter-intuitive shell logic values (based on /bin/true & /bin/false)
|
|
|
|
TRUE=0
|
|
|
|
TRUE=0
|
|
|
@ -37,6 +40,9 @@ fi
|
|
|
|
# Find plymouth
|
|
|
|
# Find plymouth
|
|
|
|
PLYDIR=/bin/plymouth
|
|
|
|
PLYDIR=/bin/plymouth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set system PKCS library path
|
|
|
|
|
|
|
|
SYSTEM_PKCS_LIBRARY=/usr/lib/opensc-pkcs11.so
|
|
|
|
|
|
|
|
|
|
|
|
# print message to usplash or stderr
|
|
|
|
# print message to usplash or stderr
|
|
|
|
# usage: msg <command> "message" [switch]
|
|
|
|
# usage: msg <command> "message" [switch]
|
|
|
|
# command: TEXT | STATUS | SUCCESS | FAILURE | CLEAR (see 'man usplash_write' for all commands)
|
|
|
|
# command: TEXT | STATUS | SUCCESS | FAILURE | CLEAR (see 'man usplash_write' for all commands)
|
|
|
@ -143,14 +149,14 @@ if [ $LUKS_KEY_COUNT -gt 0 ]; then
|
|
|
|
rm -f /tmp/kmsg
|
|
|
|
rm -f /tmp/kmsg
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
PIN=$(cardpincheck /usr/lib/opensc-pkcs11.so)
|
|
|
|
PIN=$(cardpincheck $SYSTEM_PKCS_LIBRARY)
|
|
|
|
RET=$?
|
|
|
|
RET=$?
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
# PIN valid
|
|
|
|
# PIN valid
|
|
|
|
msg "SmartCard unlocked"
|
|
|
|
msg "SmartCard unlocked"
|
|
|
|
for KEYFILE in ${LUKS_KEY_DIR}/${DISK_UUID}_slot*; do
|
|
|
|
for KEYFILE in ${LUKS_KEY_DIR}/${DISK_UUID}_slot*; do
|
|
|
|
# Try decrypting
|
|
|
|
# Try decrypting
|
|
|
|
echo "$PIN" | cardpincheck /usr/lib/opensc-pkcs11.so $KEYFILE 2> /dev/null
|
|
|
|
echo "$PIN" | cardpincheck $SYSTEM_PKCS_LIBRARY $KEYFILE 2> /dev/null
|
|
|
|
RET=$?
|
|
|
|
RET=$?
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
if [ $RET -eq 0 ]; then
|
|
|
|
OPENED=$TRUE
|
|
|
|
OPENED=$TRUE
|
|
|
|