Script to Set proxy failing

jhuhmann
Contributor

I'm using a script to set the proxy for the Ethernet and Wi-Fi interfaces run at reboot. If I run the script manually it works great. Everything comes out set as it should. If I run it as part of the imaging workflow it will set the proxy for ethernet but fail to set it for the Wi-Fi interface. It's a pretty simple script. I can run it via policy, type it in, really any way other than as part of imaging, which is the one I want.

Anyone have any experience that would tell me what I can do to get a working networksetup script to work correctly as part of imaging for Wi-Fi?

6 REPLIES 6

calumhunter
Valued Contributor

can you post the script?
how are you running the script in your imaging workflow? are you using casper imaging? firstboot packages? deploy studio?

bentoms
Release Candidate Programs Tester

We use the following to set proxies for all Ethernet interfaces (incl. USB or Thunderbolt), Wireless & VPN.

Should be simple enough to adapt as needed: http://macmule.com/2011/09/09/how-to-change-the-automatic-proxy-configuration-url-in-system-preferen...

jhuhmann
Contributor

We're using Casper Imaging, the script is part of the imaging workflow. The script is really just the networksetup command a few times over.

/usr/sbin/networksetup -setwebproxy "Wi-Fi" "our.proxy.com" "port#"
/usr/sbin/networksetup -setsecurewebproxy "Wi-Fi" "our.proxy.com" "port#"

/usr/sbin/networksetup -setwebproxy "Ethernet" "our.proxy.com" "port#"
/usr/sbin/networksetup -setsecurewebproxy "Ethernet" "our.proxy.com" "port#"

I like @bentoms script though, and may borrow some portions of it. However, I'm not sure it will actually change it's functionality. Ultimately it comes down to the same command. Maybe I'm wasting my time trying to get it to run during imaging and should just schedule it as policy.

"Wi-Fi" is the correct way to specify the particular network service right? I got it from running networksetup -listallnetworkservices, but it feels like such a sloppy way to reference an interface.

jleomcdo
Contributor

Have you figured out how to accomplish this? I'm trying to do the same thing and using a similar script.

jhuhmann
Contributor

@jleomcdo I never got it to work correctly as part of my imaging workflow. I ended up running it as a reoccuring check-in item daily.

bentoms
Release Candidate Programs Tester

@jleomcdo & @jhuhmann When I used the above linked script, I use to run it at imaging as part of my postflight policy with no issues.