Posted on 06-13-2016 01:58 PM
We pushed out a new homepage to our company Macs. We pushed out a terminal command that changed Safari and Firefox homepages and a pkg for Chrome homepages.
We are now looking for an EA that will detect the homepage of each browser to make sure everything went through successfully. I've tried looking around and haven't seen anything that will work.
Anyone have any suggestions?
Posted on 06-13-2016 02:23 PM
That's not going to be simple, as that's a user account based setting. So if you have multiple users, you'll need to loop through each one- unless all computers have the same user name on them! And do that for Firefox and Safari.
Two easier ways to set the home page are either create a profile to set it, or use your JAMF tool
/usr/local/jamf/bin/jamf setHomePage -feu -fut -homepage http://homepage/url/here
Posted on 06-13-2016 05:58 PM
I wrote this small EA to read Safari Homepage for specific computers in my environment:
#!/bin/bash
checkHome=`/usr/bin/defaults read com.apple.Safari HomePage`
echo "<result>$checkHome</result>"
Posted on 06-13-2016 07:38 PM
@Chuey You do realize in your EA that it will be reading the Safari preferences for the root account only, right?
Posted on 06-14-2016 01:16 AM
@thoule You can use wildcards when using find:
find /Users/*/Library/Preferences -maxdepth 1 -name com.apple.Safari.plist -exec defaults read {} HomePage 2>/dev/null ;
@jpilege For Safari, profile/mcx would make sense. Of course Firefox can be managed too. There's plenty of threads about that on this forum and Mozilla have pages on this too. For example, you could use defaultPref or lockPref for "browser.startup.homepage", "startup.homepage_override_url", "startup.homepage_welcome_url" in a mozilla.cfg file and push this when you push Firefox.
If you wish to report on success of a script with an EA, it may be wise to include in the script a section that builds a plist for you on completion and then set an EA to read this custom plist.
Posted on 06-14-2016 03:51 AM
@mm2270 Yes, this is only a snippet of how I was reading the homePageURL.
Posted on 06-14-2016 06:04 AM
@sean - I hadn't thought of using find. I always used to do a for loop through the users. Nice trick. thx
Posted on 06-14-2016 06:14 AM
I tried using MCX, but it would be successful on a few computers and then fail on others. I was able to scope out a custom policy with this command in it to change the homepage for Safari and Firefox.
sudo jamf setHomePage -homepage homepage.com -feu -fut
With Chrome, I sent out a package with the changes to the Master and Default profile preference files. During my testing and push to production Macs, I didn't have any issues.
Some of our Macs travel or work from home a lot. I've seen in my testing that the policy can say success, but no changes appeared on the computer. With an EA, I can track who has the new homepage and who doesn't for reassurance that everything is good.
Thanks for everyone's reply and feedback!
Posted on 06-28-2016 10:29 PM
Worked on a related task today, EA to show Firefox ESR homepage. So I thought I'd share. Thank you @mm2270 and @stevewood and Google for all the help...good practice.
#!/bin/sh
CONFIGFILE="/Applications/Firefox.app/Contents/Resources/mozilla.cfg"
HOMEPAGE=`cat /Applications/Firefox.app/Contents/Resources/mozilla.cfg | grep -Eo '(http|https)://[^/"]+'`
if [ -e $CONFIGFILE ] ; then
echo "<result>$HOMEPAGE</result>"
else
echo "<result>NotSet</result>"
fi
Posted on 07-12-2016 09:34 AM
Any luck with this lately? Like on Safari 9.1.1?
We can run the command to set it and run the command to verify/test it - looks good.
But it never really changes it.
If you look in Safari, it keeps the old Homepage.
Strangely, if I manually set the HomePage to XXXXXXXX, when I open the Safari plist, there is no XXXXXXXX anywhere.
Posted on 08-12-2016 11:38 AM
The Homepage seems to be in com.apple.internetconfigpriv.plist now.
Posted on 08-25-2016 06:12 AM
com.apple.internetconfigpriv.plist looks as if it holds the homepage from the surface, but it actually doesn't. Changing the homepage in Safari yields no effect on this plist file. My guess is that the homepage is being encrypted somewhere for security purposes, possibly to fill a security hole. The only way to set it for an image is to use a profile.
Posted on 08-25-2016 10:47 AM
This method, still works for me.