Network Limitations, being based on the IP address as reported at last recon, have a serious limitation: if your last recon was on-site, and you run Self Service over VPN, you'll still be able to run all policies as though you were on-site. To get around this, we've written a script that looks for the virtual interfaces that our VPN clients create, and if they are absent, call a trigger passed as a variable. This does mean that you need two policies (the one that the user will see in Self Service, which runs the script, and the custom-triggered policy that the script will call).
In our case, we do assume that the policy can only be run via VPN or on-site, since we have no management point in the DMZ.
Self Service Policy
Name: Upgrade to OS X 10.9 Mavericks
Triggered by None, Ongoing
Scope: Some Smart Group
Enable for Self Service
Script: vpnPreCheck.sh, with variable 4 set to mavericksupgrade
No reboots, no reckons, etc - just call the script
Script: vpnPreCheck.sh
#!/bin/bash
# vpnPreCheck.sh - Checks to see if a client seems to be on the VPN
# Built to exit 1 if VPN is detected, or call the specified trigger: $4
# Checking ifconfig output for the known virtual interfaces
pulseConnected=`ifconfig | grep utun`
ncConnected=`ifconfig | grep jnc`
if [ "$pulseConnected" ] || [ "$ncConnected" ]; then
# A virtual interface is detected; we're on VPN
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -windowPosition ur -icon "/System/Library/CoreServices/Problem Reporter.app/Contents/Resources/ProblemReporter.icns" -heading 'VPN Connection Detected' -description 'This policy may not be run from the VPN. Please try again when you are on-site.' > /dev/null 2>&1 &
exit 1
else
# We're on-site; proceed to call the passed trigger
echo "No Remote Access detected."
jamf policy -trigger $4
exit 0
fi
Manually-triggered Policy
Name: Triggered Mavericks Upgrade (naming things is hard)
Triggered by Other: mavericksupgrade, Ongoing
Scope: All (since we expect this to only ever be manually triggered)
Packages: Our Mavericks upgrade package (via createOSXinstallerpkg) and our recon-and-delete launchdaemon
Reboot: Immediately, to Current, No-bless
So the first policy runs the script, and the script triggers the policy, so that we can be sure that a VPN user can't run the upgrade. HTH, use at your own risk, test extensively, YMMV, etc.
