Skip to content

Commit

Permalink
Update sos-firefoxstig.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
simeononsecurity authored May 13, 2024
1 parent 752b80d commit 6cf35c6
Showing 1 changed file with 51 additions and 10 deletions.
61 changes: 51 additions & 10 deletions sos-firefoxstig.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,55 @@
# /bin/bash
#!/bin/bash

# Function to display messages in red and exit
die() {
echo -e "\033[91m$1\033[0m" >&2
exit 1
}

# Testing if root...
if [ $UID -ne 0 ]
then
RED "You must run this script as root!" && echo
exit
testRoot() {
if [ $UID -ne 0 ] ; then
die "You must run this script as root"
fi
}

# Check if config_dir exists
checkInstall() {
if [ ! -d "$config_dir" ]; then
die "The specified Firefox directory does not exist. Firefox may not be installed or not in the default directory."
fi
}

testRoot

# Define the directories
if [ `uname -s` = "Darwin" ] ; then
# For macos - firefox 124.0.2
preferences_dir="/Applications/Firefox.app/Contents/Resources/defaults/pref/"
config_dir="/Applications/Firefox.app/Contents/Resources/"

checkInstall

rm /Library/Preferences/org.mozilla.firefox.plist
defaults import /Library/Preferences/org.mozilla.firefox ./Files/distribution/org.mozilla.firefox.plist

else
# For linux
config_dir="/lib/firefox/"
preferences_dir="/lib/firefox/browser/defaults/preferences/"

checkInstall

distribution_dir="/lib/firefox/distribution/"
mkdir -p "$distribution_dir"
cp ./Files/distribution/policies.json "$distribution_dir"

fi

mkdir -p /lib/firefox/browser/defaults/preferences/
mkdir -p /lib/firefox/distribution/extensions/
cp ./Files/browser/defaults/preferences/* /lib/firefox/browser/defaults/preferences/*
cp ./Files/distribution/extensions/* /lib/firefox/distribution/extensions/*
cp ./Files/browser/distribution/* /lib/firefox/distribution/*
# Create directories if they don't exist
mkdir -p "$preferences_dir"
mkdir -p "$extensions_dir"

# Copy files to the directories
cp ./Files/Config/mozilla.cfg "$config_dir"
cp -r ./Files/Config/browser/defaults/preferences/* "$preferences_dir"

0 comments on commit 6cf35c6

Please sign in to comment.