Skip to main content

Hi all,
what is the most efficient way to push proxy.pac settings via JSS?
And how can we verify which settings are in use?
We are using Sierra 10.12.3 and Jamf Pro 9.97
Thanks a lot!

@mteget65 .pac files are usually as apart of a URL and you can point a mac or macs to this URL to utilize the .pac file.



If you're doing it this way, you can just set the proxy pac URL in system preferences (network > advanced > proxies) via script. Here is something you can use:



#!/bin/bash

# HARDCODED VALUES ARE SET HERE
autoProxyURL=""

# CHECK TO SEE IF A VALUE WAS PASSED FOR $4, AND IF SO, ASSIGN IT
if [ "$4" != "" ] && [ "$autoProxyURL" == "" ]; then
autoProxyURL=$4
echo "[$(date)] Proxy URL is $autoProxyURL" >>"$LOGFILE"
fi

# Detects all network hardware & creates services for all installed network hardware
/usr/sbin/networksetup -detectnewhardware

IFS=$'
'

#Loops through the list of network services
for i in $(networksetup -listallnetworkservices | tail +2 );
do

# Get a list of all services
autoProxyURLLocal=`/usr/sbin/networksetup -getautoproxyurl "$i" | head -1 | cut -c 6-`

# Echo's the name of any matching services & the autoproxyURL's set
echo "$i Proxy set to $autoProxyURLLocal"

# If the value returned of $autoProxyURLLocal does not match the value of $autoProxyURL for the interface $i, change it.
if [[ $autoProxyURLLocal != $autoProxyURL ]]; then
networksetup -setautoproxyurl $i $autoProxyURL
echo "Set proxy for $i to $autoProxyURL"
fi
done

echo "Proxies All Present And Correct..."

unset IFS


You can run this from Self Service or as apart of your first run script/workflow. You can also set the .pac file URL as the $4 variable in the JSS or just hard-code it into this script. Up to you but I would just use the variable instead of hard-coding. Hopefully it helps you out.


@perrycj that looks oddly familiar



Good to know it still works.



You can also use a profile for this now


@bentoms Yea? ha. It was here when I started but yea, it still works.


Thanks perrycj ! Works absolutely fine! ;-)


I do it via a single entry in Files & Processes > execute command:



networksetup -listallnetworkservices | grep -v "*" | while read a; do networksetup -setautoproxyurl "$a" http://proxy.company.net/accelerated_pac_base.pac ; networksetup -setproxyautodiscovery "$a" on ; done


I have to set autoconfigure and autodiscovery since Sierra gets cranky if both aren't set even though we're actually only using autoconfigure.