lima icon indicating copy to clipboard operation
lima copied to clipboard

Lima should get proxy and dns settings from SystemConfiguration instead of from System_Profiler

Open pboushy opened this issue 3 years ago • 0 comments

Description

This is a request to change the default behavior requested by @jandubois in #563 and resolved in #570.

The current method parses SystemProfiler output which only shows "Network Services" not all network interfaces. (e.g. most enterprise VPN interfaces are not included)

Apple provides a framework called SystemConfiguration that can provide more information about the network configuration of a Mac, AND give you the actual primary proxy and dns settings. The documentation for the Swift framework is here: https://developer.apple.com/documentation/systemconfiguration

To take a look at what SystemConfiguration can provide, you can use the Mac built-in binary scutil: scutil --dns will give you the list of DNS servers you should attempt in order of default routes/dns. scutil --proxy will give you the proxy settings. scutil --nwi will give you a true output of interfaces that the client has.

For instance right now, in System Preferences and System_Profiler I have 2 active services:

  • Wi-Fi
  • Thunderbolt Bridge

However, neither of those have proxy settings, and if you tried to send traffic out either, or use the DNS for either it would fail because I also have Cisco AnyConnect running configured with full tunnel.

If I run scutil --nwi, it outputs this instead:

Network information

IPv4 network interface information
   utun3 : flags      : 0x5 (IPv4,DNS)
           address    : 10.209.164.105
           reach      : 0x00000002 (Reachable)
     en0 : flags      : 0x5 (IPv4,DNS)
           address    : 172.16.32.47
           reach      : 0x00000002 (Reachable)

   REACH : flags 0x00000002 (Reachable)

IPv6 network interface information
   No IPv6 states found


   REACH : flags 0x00000000 (Not Reachable)

Network interfaces: utun3 en0

And scutil --proxy outputs:

<dictionary> {
  ProxyAutoConfigEnable : 1
  ProxyAutoConfigURLString : http://host.domain.com/file.dat
}

DNS is super verbose too, but I'd have to redact half of it...

pboushy avatar Mar 16 '22 07:03 pboushy