Request an invite
Docs menu
View as Markdown

Limit what a machine reaches

Choose the destinations a machine can connect to, and see what it tried to reach.

Limit what a machine reaches

New machines are Open. Agents can narrow a machine's access, and only you can widen it.

  1. Choose Machine > Machine Settings, then click Network. In a machine window, choose I/O > Network Access instead.
  2. Under Network Access, choose Open, Allowed Destinations Only, or Blocked.
  3. For Allowed Destinations Only, click + to add destinations, or turn on Package Registries, GitHub, or Model APIs.

To set the mode in Terminal:

sh
osmates vm egress dev --mode allowlist --allow example.com --allow preset:github
osmates vm egress dev --mode blocked

A clone keeps its source's access. A clone with the agent-sandbox preset is never open: see Give an agent a sandbox.

Add destination rules

A rule is [tcp |udp ]destination[:ports]. Without ports, a name allows TCP 80 and 443, and a range allows every port.

Rule Allows
example.com That name
*.example.com Names below that domain
udp example.com:53 That name on UDP 53. UDP rules need ports
10.0.0.0/8 That range, except your Mac's addresses
[2001:db8::/32]:443 That IPv6 range on port 443
tcp host:8080 Port 8080 on your Mac, except loopback
preset:github GitHub. Also preset:packages and preset:models

An unlisted name looks as if it doesn't exist. An allowed name that resolves to a private address is dropped and logged as rebinding. Add that address range too.

Apply a network change

A stopped machine uses the new mode at its next start. A machine on the OSMates engine, or one that started with limited access, changes at once.

A machine on Apple Virtualization that started Open works differently:

  • Blocked cuts its network at once. SSH and forwarded ports keep working.
  • Allowed Destinations Only needs a restart. Click Restart, or click Restart Later and choose Machine > Restart when you're ready. Until then, the machine shows Network Off Until Restart.

A restart from inside the guest doesn't apply the change.

Review network activity

  1. In the machine window, choose I/O > Network Access > Show Network Activity.
  2. Set Show to Refused.
  3. Control-click a row and choose Allow.
  4. Check the proposed rule, then click Allow.

Network activity showing refused connections with their time, destination, port, and reasonNetwork activity showing refused connections with their time, destination, port, and reason

A machine on Apple Virtualization that started Open shows Traffic Not Shown. To follow the log in Terminal:

sh
osmates vm logs dev --source egress --follow

Logs are in ~/Library/Application Support/OSMates/Egress, and are deleted after 14 days. An agent session's recording keeps the lines written during it.

Limits

  • A machine can't reach services that listen only on your Mac's loopback, in any mode. It can't send to IPv6 multicast groups either, though IPv4 discovery works.
  • A machine on Apple Virtualization that started Open is the exception. Its packets to 127.0.0.0/8 are dropped, but services on ::1 can get its datagrams.
  • On Apple Virtualization, limited access slows transfers to about a sixth of normal speed.

osmates vm info dev says what a machine reaches. What each system supports compares the engines.

Report a problem with this page