Skip to content

Instantly share code, notes, and snippets.

@adamcstephens
Created November 26, 2013 16:18
Show Gist options
  • Save adamcstephens/7661208 to your computer and use it in GitHub Desktop.
Save adamcstephens/7661208 to your computer and use it in GitHub Desktop.
#!/bin/bash
#DoD Root Certificate Installer Version 2
#Downloads and installs the DoD root certificates so browsers like Google Chrome can open and use DoD sites without bugging the hell out of you.
#Marcus Dean Adams ([email protected]) 30 September 2011
#Adam C Stephens ([email protected]) 26 November 2013
#Makes sure the script is running as a normal user, so the certificates will get imported into their personal certificate store, and not the one for the root account.
if [[ $EUID = 0 ]]; then
echo "This script must be run as your normal user account, if you REALLY want to import these certs as root, just edit this script and remove this whole section." 1>&2
exit 1
fi
if not which certutil
then
echo "Installing pre-requisite..."
echo ""
if which apt-get
then
sudo apt-get -y install libnss3-tools
elif which yum
then
sudo yum -y install nss-tools
fi
fi
#This makes a temporary folder in the $HOME of the current user named .dodcerts, downloads the certificates to there, installs them, then removes the folder.
echo "Downloading and installing certificates..."
mkdir $HOME/.dodcerts
cd $HOME/.dodcerts
wget http://dodpki.c3pki.chamb.disa.mil/rel3_dodroot_2048.cac
wget http://dodpki.c3pki.chamb.disa.mil/dodeca.cac
wget http://dodpki.c3pki.chamb.disa.mil/dodeca2.cac
for n in *.cac; do certutil -d sql:$HOME/.pki/nssdb -A -t TC -n $n -i $n; done
rm -rf $HOME/.dodcerts
#Exits properly.
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment