Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ################################################################################
- # Author: Michael Altfield <[email protected]>
- # Created: 2019-03-03
- # Updated: 2019-03-06
- # Version: 0.2
- # Purpose: Start an Ephemeral Firefox session with basic extensions
- ################################################################################
- ############
- # SETTINGS #
- ############
- TMP_PATH="/media/veracrypt28/ephemeralFirefox"
- #TMP_PATH="/mnt/ramdisk2/"
- SKEL_PATH="$HOME/.mozilla/firefox/ephemeralFirefoxSkel"
- ###############################
- # CLEANUP OLD ORPHAN TMP DATA #
- ###############################
- # loop through all the Ephemeral Firefox temp dirs
- for tmpDir in $(find "${TMP_PATH}" -mindepth 1 -maxdepth 1 -type d); do
- # is this temp dir for an Ephemeral Firefox that's still running? Or is it no longer needed?
- if [[ -z `firejail --list | grep "${tmpDir}"` ]]; then
- # this temp dir is no longer needed; delete it
- echo "INFO: shredding data from old Ephemeral Firefox temp dir = ${tmpDir}"
- srm -rfll "${tmpDir}"
- fi
- done
- ###################
- # CREATE TEMP DIR #
- ###################
- # first create a temp dir in our (hopefully encrypted) $HOME dir, if first run
- [ ! -d "${TMP_PATH}" ] && mkdir -p "${TMP_PATH}"
- # create temp dir for ephemeral session
- tmpDir=`/bin/mktemp -p "$TMP_PATH" -d`
- tmpProfileDir="${tmpDir}/firefoxProfile"
- mkdir -p "${tmpProfileDir}"
- echo $tmpProfileDir
- echo "INFO: created Ephemeral Firefox temp profile dir = ${tmpProfileDir}"
- ###########################
- # START EPHEMERAL FIREFOX #
- ###########################
- # what should the homepage be?
- url="${1}"
- if [[ -z ${url} ]]; then
- url="https://start.duckduckgo.com"
- fi
- # prepare extensions
- cp -r "${SKEL_PATH}/extensions" "${tmpProfileDir}/extensions"
- #cp -r "${SKEL_PATH}/browser-extension-data" ${tmpProfileDir}/
- cp "${SKEL_PATH}/user.js" "${tmpProfileDir}/"
- cp "${SKEL_PATH}/extensions.json" "${tmpProfileDir}/"
- # try disabling 'seccomp' if you encounter issues
- #firejail --ignore=seccomp --whitelist="${tmpProfileDir}" firefox -no-remote -new-instance -profile "${tmpProfileDir}" "${url}"
- firejail --whitelist="${tmpProfileDir}" firefox -no-remote -new-instance -profile "${tmpProfileDir}" "${url}"
- ###########
- # CLEANUP #
- ###########
- # fast (secure enough) wipe of tmp dir
- srm -vrfll "${tmpDir}"
- # clean exit
- exit 0
- EOF
Advertisement
Add Comment
Please, Sign In to add comment