─liudanking@Daniel-rMBP.local /Library/Application Support/Websense Endpoint ‹ruby-2.3.1›
╰─➤ sudo cat ff_config.sh
Password:
#!/bin/bash
TARGETDIR=/Library/Application\ Support/Websense\ Endpoint
FIREFOX_DEFAULT_PATH=/Applications/Firefox.app/Contents/Resources
FIREFOX_APP_PATH=/Applications/Firefox.app/Contents/MacOS/firefox
FIREFOX_WEBEX_PATH=/Applications/Firefox.app/Contents/Resources/browser/extensions
FP_FFCFG=fp_firefox.cfg
FP_LSET=local-settings.js
FP_WEBEX_XPI={c748f1fa-f022-428c-9276-8dff4b830d33}.xpi
DLP_PATH=/Library/Application\ Support/Websense\ Endpoint/DLP
PXY_PATH=/Library/Application\ Support/Websense\ Endpoint/Proxy
if [ -d "$DLP_PATH" ]
then
DLP_IS_INSTALLED=1
else
DLP_IS_INSTALLED=0
fi
if [ -d "$PXY_PATH" ]
then
PROXY_IS_INSTALLED=1
else
PROXY_IS_INSTALLED=0
fi
CMD=$1
START_ALL=0
STOP_ALL=0
if [ $CMD -eq "1" ]
then
START_ALL=1
fi
if [ $CMD -eq "2" ]
then
STOP_ALL=1
fi
#############################################################################
# Do start stuff
#############################################################################
# Determine whether or not Forcepoint Firefox CFG file (fp_firefox.cfg) is installed
if [ -d "$FIREFOX_DEFAULT_PATH" -a -f "$FIREFOX_APP_PATH" ]
then
FIREFOX_WAS_INSTALLED=1
else
FIREFOX_WAS_INSTALLED=0
fi
if [ $FIREFOX_WAS_INSTALLED -eq 1 ]
then
# If starting Proxy or DLP and neither is installed, erase ff cfg file and start it anew
if [ $START_ALL -eq 1 ]
then
rm -rf "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
if [ $PROXY_IS_INSTALLED -eq 1 ]
then
echo "//" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
echo "lockPref(\"network.proxy.type\", 2);" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
echo "lockPref(\"network.captive-portal-service.enabled\", false);" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
fi
if [ $DLP_IS_INSTALLED -eq 1 ]
then
echo "//" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
echo "defaultPref(\"extensions.autoDisableScopes\", 0);" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
echo "defaultPref(\"extensions.enabledScopes\", 15);" >> "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
mkdir -p "$FIREFOX_WEBEX_PATH"
cp -f "$DLP_PATH/$FP_WEBEX_XPI" "$FIREFOX_WEBEX_PATH/$FP_WEBEX_XPI"
chmod 644 "$FIREFOX_WEBEX_PATH/$FP_WEBEX_XPI"
else
# Remove Firefox .xpi file
rm -rf "$FIREFOX_WEBEX_PATH/$FP_WEBEX_XPI"
rm -rf "$DLP_PATH/*.xpi"
fi
if [ $PROXY_IS_INSTALLED -eq 1 -o $DLP_IS_INSTALLED -eq 1 ]
then
cp -f "$TARGETDIR/$FP_LSET" "$FIREFOX_DEFAULT_PATH/defaults/pref"
chmod 644 "$FIREFOX_DEFAULT_PATH/defaults/pref/$FP_LSET"
fi
fi
if [ $STOP_ALL -eq 1 ]
then
rm -rf "$FIREFOX_DEFAULT_PATH/$FP_FFCFG"
rm -rf "$FIREFOX_DEFAULT_PATH/defaults/pref/$FP_LSET"
rm -rf "$FIREFOX_WEBEX_PATH/$FP_WEBEX_XPI"
fi
fi