Accessing information about a connection with scutil

Got a problem with Viscosity or need help? Ask here!

dtrebbien

Posts: 4
Joined: Sun Sep 21, 2014 9:59 pm

Post by dtrebbien » Sun Sep 21, 2014 10:24 pm
I have seen some posts mention certain System Configuration keys for accessing information about a VPN connection: (these all mention a "State:/Network/Service/com.viscosityvpn.vpn-tun0/DNS" key). However, when I connect to a VPN, the only key that I see is "State:/Network/Interface/tun0/IPv4" and there isn't a network service created by Viscosity.

Is there some configuration option that enables exposing the information about a connection to System Configuration? I am looking for a "State:/Network/Service/com.viscosityvpn.vpn-tun0/IPv4" key or similar and for the "com.viscosityvpn.vpn-tun0" service to be added to the "Setup:/Network/Global/IPv4" ServiceOrder in order to complete a script that I am working on to monitor my client IP address.

I also tried accessing this information through AppleScript, but I am only able to determine the connection name and status ("Connected").

I am using Viscosity 1.5.1 (1232) for Mac OS 10.9.5.

James

User avatar
Posts: 2103
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Mon Sep 22, 2014 10:57 am
Hi dtrebbien,

I'm afraid the information linked is all pretty dated and not really relevant to newer versions of Viscosity. You'll need to have DNS Support enabled for your connection for information to be added to the System Configuration store. The exact keys added are going to vary significantly depending on the connection configuration.

In addition, as OpenVPN relies directly on routing to control traffic flow (rather than leaving it up to Mac OS X based on network service order) the System Configuration store won't necessarily give you the correct primary IP address (if that's what you're after). You may be better off wrapping a command line tool like "route" and check which interface is used by default for traffic (e.g. "route get 0/1") and checking the interface. From there you could get the IP address for the interface from more traditional methods or by wrapping "ifconfig". You can find some additional information in the "Checking All Traffic Is Routed Over The VPN Connection" section of the following article:
http://www.sparklabs.com/support/preven ... fic_leaks/

Cheers,
James
James Bekkema
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
2 posts Page 1 of 1