Created
January 14, 2019 17:27
-
-
Save MartijnBraam/036559de17813149be3f8504abf8f36e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NSSDB=$HOME/.pki/nssdb | |
MODUTIL="/usr/bin/modutil -force -dbdir sql:$NSSDB" | |
CERTUTIL="/usr/bin/certutil -d sql:$NSSDB" | |
LIBFILE=/usr/local/AWP/lib/libOcsPKCS11Wrapper.so | |
if [ -n "`which apt-get`" ]; | |
then | |
sudo apt-get -y install libnss3-tools 2>/dev/null | |
fi | |
if [ -n "`which yum`" ]; | |
then | |
sudo yum install libnss3-tools 2>/dev/null | |
fi | |
echo "Adding smartcard support in Google Chrome ..." | |
if [ ! -f $NSSDB/cert9.db ]; then | |
echo "Initializing new database" | |
sudo -i -u $SUDO_USER mkdir -p $HOME/.pki | |
sudo -i -u $SUDO_USER mkdir -p $NSSDB | |
sudo -i -u $SUDO_USER $CERTUTIL -N --empty-password | |
fi | |
if [ -f $LIBFILE ]; then | |
sudo -i -u $SUDO_USER $MODUTIL -delete idemia-pkcs11 2>/dev/null | |
sudo -i -u $SUDO_USER $MODUTIL -add idemia-pkcs11 -libfile $LIBFILE -mechanisms FRIENDLY 2>/dev/null | |
exit | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment