Posted on 10-15-2010 09:15 AM
Hi
I was wondering if anyone could help, I am trying to write a script that
will basically enable/disable proxy settings for all network interfaces ( so
that it will work on Mac Pros and MacBook Pros)
the basic idea is that when the script is ran
it will automatically fill in the proxy settings for
Mac Pro:
en0 and en1
MacBook Pro
en0 and wifi interface
iMac
en0 and wifi interface
This is what I'm using so far
see attachment
Much appreciated
Thanks
Abz
--
Los Angeles · Detroit · Toronto · New York · London · Cologne · Stockholm ·
Singapore · Hong Kong · Shanghai · Tokyo · Sydney
Imagination · London
25 Store Street South Crescent, London WC1E 7BL, United Kingdom
Tel +44 20 7323 3300 Fax +44 20 7462 2837
www.imagination.com
Posted on 10-15-2010 12:49 AM
Here's what we're using. Basically it grabs the name of the 3rd connection
slot from dscl, which will be Ethernet on machines with 2 ethernet ports. If
it finds ŒEthernet' it sets for en0 and en1. Otherwise it sets for en0 and
airport.
Bob
Posted on 10-15-2010 11:41 AM
You could modify the script to a case statement like this:
case `system_profiler SPHardwareDataType | awk '/Model Name:/ { print
$3 }'` in
iMac* )) do the proper commands;; Macbook* )) do the proper commands;; Mac Pro* )) do the set of commands;;
esac
Then you would just need one script. Though if you have a mixed
environment of 10.5 and 10.6 the network setup commands are also
different. You may need to add OS detection to your script.
-Tom
Posted on 10-16-2010 09:23 AM
I'll send you what I used this weekend. It let's you set a proxy PAC file
for safari and chrome. For firefox, you may as well modify and re-package.
I'll send you those instructions as well.
Sent from Ken's iPhone
Posted on 10-18-2010 04:50 PM
Here you go as promised... a bit late though.
The setAutoProxy.sh script is just modified from a script written by JAMF
from the resource kit. I modified it to set the proxy pac file on wireless
and wired interfaces. It is attached in a zip file.
Firefox is a bit more difficult; you'll have to do a bit of trial and error
to get it right. There is some decent documentation on the web if you
lookup "firefox lockpref". I had a bit of difficulty getting it to work in
the latest version. Basically you write a file of the prefs you want (java
formatted) and specify it in the all.js file within the app. Next you have
to byteshift the config file you wrote using either an online byteshifting
script page, or there is a good perl script for this out there as well.
When you launch Firefox, it will lock down whatever prefs you write into
your custom config. To deploy, I suppose you could just push out the files
required... I prefer just re-packaging a copy of the App that is already
functioning.
Here is an example of mozilla.cfg or whatever you want to call it. This is
the file you would byteshift 13 (I've attached a script for this as well):
//
// Proxy Settings
lockPref("network.proxy.type", 2);
lockPref("network.proxy.autoconfig_url", "
http://yourcompany/path/ssi_pac.pac");;)
// HomePage Settings
lockpref("browser.startup.page", 1);
lockPref("browser.startup.homepage", "http://yourcompany.com");
Now that you have this file, you have to byteshift it and place it in
/Applications/Firefox.app/Contents/MacOS/whateverfilename.cfg. After this
step, edit /Applications/Firefox.app/Contents/MacOS/greprefs/all.js with
your favorite editor and add:
pref("general.config.filename", "whateverfilename.cfg");
I may have left out some steps, but do a search online and you'll figure it
out in no time.
Have fun, and let me know if you have any questions.
Thanks,
Ken
Posted on 10-19-2010 12:38 AM
Thanks Great!
Thanks Ken