slim start breaks Apple Container (vmnet) networking by enabling macOS packet filter

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, macos

Research direction

Start by tracing the macOS behavior of slim start, focusing on how it modifies /etc/pf.conf, loads /etc/pf.anchors/com.slim, and invokes pfctl. Reproduce the failure with the listed Apple Container networking commands, then verify that Slim's redirects work without breaking the 192.168.64.0/24 network and that stopping Slim restores normal behavior.

Written by the indexing model from the issue text.

Description

bug
Description

Love the idea of this, but ran into a brick wall.

Running slim start completely breaks networking for all Apple Containers. Containers lose the ability to reach the internet, the gateway (192.168.64.1), and any external host. API calls from inside containers time out with no error, just silence.

Root cause:

Slim adds its redirect anchor to /etc/pf.conf:

rdr-anchor "com.slim"
load anchor "com.slim" from "/etc/pf.anchors/com.slim"

The anchor itself is benign as the loopback-only redirects:

rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 80 -> 127.0.0.1 port 10080
rdr pass on lo0 inet proto tcp from any to 127.0.0.1 port 443 -> 127.0.0.1 port 10443

The problem is that slim start runs pfctl -e -f /etc/pf.conf, which loads the entire ruleset, including:

scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"

These Apple anchors are designed to be loaded on-demand by Apple's own services (the comment in pf.conf says "each component which utilizes PF is responsible for enabling and disabling PF via -E and -X").

When Slim force-enables pf and reloads the full ruleset, it interferes with Apple Container's vmnet NAT layer on the 192.168.64.0/24 subnet. The result is that all container network traffic is silently dropped.

Steps to Reproduce
  1. Start an Apple Container with network access: container run --net=bridged alpine sh -c "apk add curl && curl -s https://1.1.1.1"
  2. This succeeds.
  3. Run slim start on any domain (e.g. slim start myapp --port 3000).
  4. Run the same container command again and it now hangs indefinitely. Even ping 192.168.64.1 (the vmnet gateway) fails from inside the container.
  5. slim stop alone does not fix it. You must also run:
    sudo pfctl -d
    container system stop && container system start
  6. Then containers work again.
  7. Running slim start again immediately re-breaks container networking. Confirmed this cycle multiple times.
Expected Behavior

Slim's loopback redirect rules should not affect networking on other interfaces. Slim should either:

  1. Load only its own anchor instead of reloading the entire /etc/pf.conf ruleset. Something like: pfctl -a com.slim -f /etc/pf.anchors/com.slim
  2. This would activate Slim's rules without touching the Apple anchors or enabling the global packet filter.
  3. Use -E/-X reference counting as Apple's pf.conf comments recommend, rather than pfctl -e which force-enables the entire filter.
  4. Document the incompatibility with Apple Container / vmnet networking if a fix isn't feasible.
Actual Behavior

Running slim start completely breaks networking for all Apple Containers. Containers lose the ability to reach the internet, the gateway (192.168.64.1), and any external host. API calls from inside containers time out with no error, just silence.

Slim Version

0.8.0

Operating System

macOS

Configuration

Logs

Dominant language
Go
Stars
2.2k
Forks
139
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nilbuild/slim

All issues in nilbuild/slim

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.