summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-02 20:45:44 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2020-06-03 06:43:05 -0500
commit6c785628a1babe3a5415f32b88d323ac2070c486 (patch)
treec3f29d5e59c8464e97331fdc9305b6851e708235
parentef2c98aa2bb834de42014b1588440230118e4789 (diff)
downloadsmartcardauth-6c785628a1babe3a5415f32b88d323ac2070c486.tar.gz
smartcardauth-6c785628a1babe3a5415f32b88d323ac2070c486.zip
Use central variable to define system PKCS library location
Signed-off-by: Timothy Pearson <kb9vqf@pearsoncomputing.net>
-rwxr-xr-xusr/bin/cryptosmartcard.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/bin/cryptosmartcard.sh b/usr/bin/cryptosmartcard.sh
index ac8c206..75d9251 100755
--- a/usr/bin/cryptosmartcard.sh
+++ b/usr/bin/cryptosmartcard.sh
@@ -21,6 +21,9 @@
#
# Updated by Timothy Pearson <kb9vqf@pearsoncomputing.net> 9/15/2015
# 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)
TRUE=0
@@ -37,6 +40,9 @@ fi
# Find plymouth
PLYDIR=/bin/plymouth
+# Set system PKCS library path
+SYSTEM_PKCS_LIBRARY=/usr/lib/opensc-pkcs11.so
+
# print message to usplash or stderr
# usage: msg <command> "message" [switch]
# 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
fi
- PIN=$(cardpincheck /usr/lib/opensc-pkcs11.so)
+ PIN=$(cardpincheck $SYSTEM_PKCS_LIBRARY)
RET=$?
if [ $RET -eq 0 ]; then
# PIN valid
msg "SmartCard unlocked"
for KEYFILE in ${LUKS_KEY_DIR}/${DISK_UUID}_slot*; do
# 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=$?
if [ $RET -eq 0 ]; then
OPENED=$TRUE