Posted on 02-20-2020 07:36 AM
Hey Guys,
I'm using Jamf Now plus. To create profile I use profile creator. I want to create a profile where all the laptops in my company have 9.9.9.9 as their standard DNS. So when I go to home and I connect to my home Wi-fi the DNS will be 9.9.9.9. I don't want to do it manually is it possible to fix this?
Posted on 02-20-2020 08:46 AM
Is this for purposes of a web filter? If so may inquire which one?
Posted on 02-20-2020 08:51 AM
Here is how Securly does it for their web filter using an MDM pushed script:
https://support.securly.com/hc/en-us/articles/217657128-How-to-filter-Mac-OS-X-devices-off-site-?mobile_site=true
Posted on 02-20-2020 08:51 AM
There would be a couple ways you could approach this task. You could create a policy utilizing Files and Processes --> then Execute Command below
networksetup -setdnsservers Wi-Fi 9.9.9.9
You could take it one step further and create an Extension Attribute to report what their DNS is
#!/bin/sh
echo "<result>`/usr/sbin/networksetup -getdnsservers Wi-Fi`</result>"
Next create some smart groups to report on said dns (is 9.9.9.9) (is not 9.9.9.9)
Then scope smart group to report on said Extension Attribute to execute the policy on their device again if it were to no longer be using 9.9.9.9
I wrote all of this from off the top of my head, so I would recommend testing it before going live. Hope this helps and welcome to jamf :)
Posted on 02-20-2020 08:55 AM
@blackholemac I like your method a little better, adds more functionality..
#!/bin/bash
servers="9.9.9.9"
networksetup -listallnetworkservices | sed 1d $file | while read adapter
do
networksetup -setdnsservers "$adapter" $servers
networksetup -setv6off "$adapter"
done
dscacheutil -flushcache
exit 0
Posted on 02-25-2020 02:16 AM
@mojo21221 Where do you add the script in Jamf NOW plus. Sorry for the question I'm not that good with JAMF. Should I add in into a package and thanks for the warm welcome :)
Posted on 02-25-2020 02:21 AM
@blackholemac we are currently using quad 9 (https://www.quad9.net/)
Posted on 09-08-2020 11:13 PM
Is it possible to use this kind of script on iOS? I need to get global DNS to work and i have absolutely no experience with jamf/iOS at all