lima-vm / lima-vm/lima

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

Open
#741 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

### 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:
```
{
ProxyAutoConfigEnable : 1
ProxyAutoConfigURLString : http://host.domain.com/file.dat
}
```

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.