recommended way to toggle a network filter using BTT

I typically use quad9’s configuration profile on my macbook, but for whatever reason I’ve found that my university’s network doesn’t play nicely with this setup, refusing to connect me to the internet until I disable quad9 secured DNS over HTTPS in System Settings > Network > VPN & Filters. I started to set up a Did Connect to Wifi with Name trigger to toggle the profile but after looking up a terminal command to do so I came to find that there really isn’t a great option. Be it command-line, applescript, or BTT’s javascript API, I wasn’t able to dig up a way of changing the status of anything in the Filters & Proxies list (in the case of quad9, its classification on the list is “DNS Settings”). VPNs can be toggled with networksetup, but anything else seems tantalizingly difficult to automate.

I played around with automating the System Settings UI but wasn’t able to get that working consistently either (triggering the Enabled/Disabled drop-down via the Interact With / Click Specific UI Element action seemed to be pretty finicky). Ultimately I determined that for an automatically triggered routine, the process of opening System Settings, navigating to the page, and toggling the Enabled/Disabled option would interrupt user control for long enough that it’d become more of an annoyance than a convenience (you can open System Settings > Network with a URI, but because there’s no way to directly open the System Settings > Network > VPN & Filters sub-menu nested within I have to wait for an extra Interact With / Click Specific UI Element action to take effect before the drop-down becomes accessible).

Point is, if I want the process of connecting to the campus internet to be seamless the only viable route seems to be finding a way to set the Enabled status of a network filter that doesn’t involve a UI. It’s possible I overlooked some esoteric system call and equally possible I missed something obvious, but thus far all attempts to set this up on my own have hit a dead-end. I’m hoping some of the experienced macOS wizards around here can either point me in the right direction or, if no such direction exists, advise me to give up.

Thank you for taking the time to read / ponder my automation woes and have a wonderful day!

I think it is intentionally hard to script to make it impossible for apps to turn off firewalls etc.

Unfortunately I also don't know of a reliable way to achieve this. Some of the network filters do have command line tools that allow you to enable disable them, but there doesn't seem a way on system level.

1 Like