Skip to main content

Setting firefox preferences in macs for Oracle SSO to work.

#!/bin/bash
#Written by Tausif for FICO
#RESULT!
bloke=$(ls -l /dev/console | awk '{print $3}' )
place=$(sudo dscl . -read /Users/$bloke NFSHomeDirectory | awk '{print $2}')
logFile="/private/var/log/ff-mod.log"
log () {
echo $1
echo $(date "+%Y-%m-%d %H:%M:%S: ") $1 >> $logFile
}

set(){



if grep 'network.negotiate-auth.trusted-uris' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.trusted-uris/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
     log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http";

fi
if grep 'network.negotiate-auth.gsslib' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.gsslib/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1 using SED";
else
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
     log "USER $bloke: network.negotiate-auth.gsslib is now set to 1";

fi
if grep 'network.negotiate-auth.delegation-uris' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
then
sudo sed '/network.negotiate-auth.delegation-uris/d' /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js > /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e;
mv /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js.e /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> /Applications/Firefox.app/Contents/MacOS/defaults/pref/channel-prefs.js;
    log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http";

fi
}


pset(){
bloke=$(ls -l /dev/console | awk '{print $3}' )
place=$(sudo dscl . -read /Users/$bloke NFSHomeDirectory | awk '{print $2}')
#Get an array of all users
declare -a userarray
userarray=$(sudo /usr/bin/dscl . list /Users UniqueID | awk '$2 >= 500 && $2 < 100000000000000000 { print $1; }')
#Iterate through the array of all users
for i in ${userarray[@]};
do
if [ -d $place/Library/Application\ Support/Firefox/Profiles ];
then
#Get an array of all profiles under this User for Firefox
declare -a parray
parray=( `ls $place/Library/Application\ Support/Firefox/Profiles | grep -v DS_Store` )
for p in ${parray[@]};
do
if grep 'network.negotiate-auth.trusted-uris' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.trusted-uris/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.trusted-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.trusted-uris is now set to http";
fi
if grep 'network.negotiate-auth.gsslib' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.gsslib/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1 using SED";
else
echo 'user_pref("network.negotiate-auth.gsslib", "1");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.gsslib is now set to 1";
fi
if grep 'network.negotiate-auth.delegation-uris' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
then
sudo sed '/network.negotiate-auth.delegation-uris/d' $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js > $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e;
mv $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js.e $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http using SED";
else
echo 'user_pref("network.negotiate-auth.delegation-uris", "http://,https://");' >> $place/Library/Application\ Support/Firefox/Profiles/$p/prefs.js;
log "USER $bloke: network.negotiate-auth.delegation-uris is now set to http";
fi
done
fi
done

}

killFirefox(){

#LoginWindowPID=`pgrep firefox`; This command only works with 10.8 machines
ps -ax | grep -i "Firefox.app" | grep -v grep
if [ $? == 0 ];
then
firefoxPID=`ps -ax | grep -i firefox | head -1 | cut -d "?" -f1 | sed 's/^[ \t]*//;s/[ \t]*$//'`;
kill -9 $firefoxPID
log "Killing Firefox"
fi

}

killFirefox;
set;
pset;

exit 0;

Comments

Popular posts from this blog

Removing corporate wireless restrictions completely : "The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."

So i was recently tasked with removing wireless restrictions from a VP's windows 7 laptop that some infrastructure company had placed while contracted with our network, since he needed to enable setting up of adhoc connections on his laptop and he always got

"The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."


A little bit of probing revealed that adhoc and peer to peer connections were blocked as evidenced by the the command 

netsh wlan show filter on an  elevated command prompt revealed that adhoc network type was blocked by group policy:

I removed the restrictions by:

1: open services.msc as administrator, scroll down to WLAN AutoConfig:

Migrating Outlook Profile to Office 365

We had a migration from Hosted Exchange to Office 365 and i was tasked with automating the local Outloook profile migration for Users:

I Created a GUI utility using powershell which would allow users to create an Office365 Profile and set it as default, I prepared PRF files for each version of office and an autodiscover.xml to be used for local autodiscover and uploaded them to a hosted site:

The PRF file to set settings for Office 365 are hard to find: i used the below entries:


;AutomaticallygeneratedPRFfilefromtheMicrosoftOfficeCustomizationandInstallationWizard;**************************************************************;Section1-ProfileDefaults;**************************************************************[General]Custom=1ProfileName=%UserName%-O365DefaultProfile=YesOverwriteProfile=YesModifyDefaultProfileIfPresent=false;**************************************************************;Section2-ServicesinProfile;**************************************************************[Service…

To Unlock Windows Update locked due to group policy.

To Unlock Windows Update locked due to group policy.




Open gpedit.msc and browse to the location /Computer Configuration/Administrative Templates/System/Internet Communication Management/Internet Communication Settings and double click "turn off access to all windows update features" and set it to disabled.