Skip to content

Conversation

@jmgurney
Copy link

I would like to add support to enable/disable all proxies. This is primarily do that when you go to a captive wifi portal, you can disable all, login, and then reenable all proxies.

I've attached a patch that adds the UI elements, but it turns out that networksetup only processes the first command line argument, so it is unable to do it all in one go. I could iterate over the proxies, but then I believe it would ask me for the password n times, which is annoying.

Comments?

Thanks.

networksetup only processes one commandline arg (and doesn't error
out at the remaining args)..  So I don't know of a good way to
change multiple ones at a time..
@robertklep
Copy link
Owner

@jmgurney one of the things I still want to look in to is how to toggle the proxies programmatically (without an external command). Hopefully, that may solve excessive password dialogs.

Aside from that, have you considered using network locations to define a separate set of proxies depending on which network you are in? I have several locations defined depending on where I am, and you can switch between them pretty quickly throught the Apple menu:

screen shot 2015-08-15 at 8 50 52

@jmgurney
Copy link
Author

ahh, they still have it, just recently upgraded, and getting used to the new OS...

Per programmatically changing it, I agree, I did spend some time looking... I did find the SCDynamicStoreCopyProxies function call, but I can't seem to make any changes to it... The docs that MacOSX aren't clear how to make these changes, or even where to find the information to do it.

@robertklep
Copy link
Owner

@jmgurney I think that in the end, a call to SCNetworkProtocolSetConfiguration should be sufficient.

However, this requires particular privileges (if you don't have those, you can still call the function but they don't stick) that can be obtained using SCPreferencesCreateWithAuthorization, which is part of a framework that doesn't seem to be available in PyObjC.

I'll look into it a bit further, because AFAICS this would require the user to authenticate just once, which is much better than having to authorize every change.

@robertklep
Copy link
Owner

Made some progress: https://gist.github.com/robertklep/188d552ca519005e0c1c

It's asking the user to authenticate now, and it seems to disable the proxy. However, the settings don't seem to actually stick. Will need to dig deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants