Skip to content

Instantly share code, notes, and snippets.

@PhilipSchmid
Created December 20, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilipSchmid/a82b9642e1ec2bf2d16823d72cffc589 to your computer and use it in GitHub Desktop.
Save PhilipSchmid/a82b9642e1ec2bf2d16823d72cffc589 to your computer and use it in GitHub Desktop.

Add Firefox Security Device (via CLI)

Use the following commands to add a security device module to Firefox. Ensure Firefox is closed while running these commands! modutil comes with the installation of libnss3-tools.

securityModuleDeviceName="My Awesome Module"
securityModulePath="/usr/lib/libBlaBla.so"
# We use cert9.db and "sql:..." since cert8.db is in the legacy format
for devicedDB in $(find  ~/.mozilla* -name "cert9.db")
do
  certDir=$(dirname ${devicedDB});
  modutil -dbdir "sql:${certDir}" -create -force
  modutil -dbdir "sql:${certDir}" -add "${securityModuleDeviceName}" -libfile "${securityModulePath}" -force
  modutil -dbdir "sql:${certDir}" -enable "${securityModuleDeviceName}" -force
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment