Skip to main content
Question

Jamf Pro country scoping for admins

  • August 1, 2023
  • 5 replies
  • 26 views

Forum|alt.badge.img+1

Hello

I would like to ask if there is a way to "scope" the Jamf Pro admin interface?

 

To give some context, we have Support teams in several countries and we will have them do basic Mac management soon. However, I would like them to be able to see only the Macs from their specific countries, and not the others.

 

Thanks

 

5 replies

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • August 1, 2023

You would do this with JAMF sites, but it is probably more work then its worth.

Sites - Jamf Pro Administrator's Guide | Jamf


Forum|alt.badge.img+15

Hey @DenisT ! You could use an EA to determine the computer's country based on IP, or you could grab the set locale information to determine. 
Country By IP (VPNs could give inaccurate results, just FYI):

#!/bin/bash # Gathers the country of the computer based on IP address # Created 10.27.2022 @robjschroeder jamfURL=$(defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url) externalIP=$(curl -s ifconfig.me) geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1) if [[ $externalIP ]]; then geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1) # echo $geoData country=$(echo ${geoData} | plutil -extract "data"."geo"."country_name" raw -o - -) else RESULT="Error - IP Address lookup failed" fi if [[ ${country} ]]; then RESULT=${country} fi echo "<result>${RESULT}</result>"

Apple Locale Information (User's could have chosen an inaccurate region during Setup Assistant, FYI):

#!/bin/bash # Determine user location based on region selected during Setup Assistant # @robjschroeder 08.01.2023 # Gather the logged in User loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) # Determine locale locale=$(defaults read /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleLocale) echo "<result>$locale</result>"

 


jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • August 1, 2023

Hey @DenisT ! You could use an EA to determine the computer's country based on IP, or you could grab the set locale information to determine. 
Country By IP (VPNs could give inaccurate results, just FYI):

#!/bin/bash # Gathers the country of the computer based on IP address # Created 10.27.2022 @robjschroeder jamfURL=$(defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url) externalIP=$(curl -s ifconfig.me) geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1) if [[ $externalIP ]]; then geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1) # echo $geoData country=$(echo ${geoData} | plutil -extract "data"."geo"."country_name" raw -o - -) else RESULT="Error - IP Address lookup failed" fi if [[ ${country} ]]; then RESULT=${country} fi echo "<result>${RESULT}</result>"

Apple Locale Information (User's could have chosen an inaccurate region during Setup Assistant, FYI):

#!/bin/bash # Determine user location based on region selected during Setup Assistant # @robjschroeder 08.01.2023 # Gather the logged in User loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) # Determine locale locale=$(defaults read /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleLocale) echo "<result>$locale</result>"

 


two liner.. but many ways as ever.. 😎

 

result=$(/usr/bin/curl ipinfo.io -s | awk '/"country": / { print $NF }' | tr -d ' ",') echo "<result>$result</result>"

 

 


Forum|alt.badge.img+15

two liner.. but many ways as ever.. 😎

 

result=$(/usr/bin/curl ipinfo.io -s | awk '/"country": / { print $NF }' | tr -d ' ",') echo "<result>$result</result>"

 

 


Nice! 


chris_kemp
Forum|alt.badge.img+20
  • Jamf Heroes
  • August 7, 2023

I think Sites is the way to go here.