Local service access and trust
ArcBox gives local workload services stable names and browser-ready URLs. It connects one control path across host DNS, guest routing, local certificate trust, and HTTPS relays so that a service can be reached by name instead of by an exposed port.
Access model
Local service names
ArcBox treats DNS ownership as the source of truth for local service access. Running machines and workload services receive names under the configured local domain, and the same ownership record is used to decide whether a name may resolve and whether it may receive a URL.
Machine names use a machine-specific namespace and resolve to the machine bridge address. Container names and aliases resolve to the container address. The built-in index uses the local-domain apex and the System VM gateway. These names are withdrawn when their owner or usable address is gone.
References: app/…/machine_dns.rs• L1-16 app/…/machine_dns.rs• L39-105 app/…/dns_reservations.rs• L8-10
Host DNS publication
The daemon serves local DNS on loopback and forwards other names upstream. A host resolver entry points local-domain lookups to that service, while the shared registry supplies the current local answers. Unknown names below the local domain return NODATA so macOS can continue its mDNS lookup without waiting for a negative unicast answer.
The registry is also mirrored to the host's local name service. This keeps unicast DNS and Bonjour ownership aligned and limits local service names to the host.
References: app/…/dns_service.rs• L1-25 app/…/dns_service.rs• L89-169 app/…/dns_reservations.rs• L22-131
Service URL directory
The service directory turns validated guest routes into HTTP and HTTPS URLs. It uses the current DNS owner, address, and installed route together, so a stale route does not become a usable link. Clients should use these URLs instead of rebuilding them from published ports.
ArcBox reports three HTTPS modes:
- Managed HTTPS uses an ArcBox certificate and forwards cleartext HTTP to the service.
- Passthrough HTTPS keeps the service's own TLS handshake and certificate.
- No HTTPS reports only HTTP access.
Managed HTTPS applies to names inside the local certificate namespace. Foreign aliases can still use HTTP or the service's native TLS, but ArcBox does not claim them with its local CA.
References: common/…/web_services.rs• L7-72 app/…/web_services.rs• L191-267 app/…/web_services.rs• L8-26
Trusted HTTPS path
Local certificate authority
ArcBox uses a local certificate authority (CA) for managed HTTPS. The CA is limited to local DNS names and excludes IP addresses. Its private key stays in the macOS Keychain, while the public certificate can be shared with the host and guests.
The helper stores the public certificate in the System Keychain. Native Admin trust is a separate login-session action and is restricted to TLS server use. This separation lets ArcBox inspect certificate state without silently changing host trust.
For the full CA creation, rotation, storage, and trust process, see Local CA and trust lifecycle.
References: common/…/authority.rs• L3-31 app/…/ca.rs• L17-54 common/…/trust.rs• L33-85
Guest certificate trust
The daemon delivers the active public CA to the guest through the guest agent. The guest installs it into the trust store that its services use and acknowledges only after the installation is complete. The daemon matches the acknowledgement to the CA fingerprint and the physical VM run.
If the CA is unavailable, the guest keeps its last usable trust state. A VM change or a CA change starts a new reconciliation, which prevents a certificate from one guest run from being accepted for another.
References: app/…/guest_trust.rs• L22-31 app/…/guest_trust.rs• L87-143 engine/…/guest_trust.rs• L14-64
Managed HTTPS termination
The guest owns the HTTPS frontend for managed routes. It receives the original destination from the redirected connection, checks the SNI name against current DNS ownership, obtains or reuses a leaf certificate signed by the active CA, and relays the request to the selected HTTP port.
The route is checked again during the handshake and before upstream traffic starts. If the owner, DNS revision, address, or installed route changes, ArcBox stops the connection rather than forwarding it to a new service by accident.
Native HTTPS routes do not use this certificate path. They pass the application's TLS endpoint through unchanged.
References: guest/…/https.rs• L1-14 guest/…/https.rs• L145-233 guest/…/services.rs• L77-112
Guest relay path
Workload service relay
The guest agent is the traffic point between a local name and a workload listener. It installs destination-based rules for the service's HTTP and HTTPS entry points, then tracks the route as the workload starts, changes its listeners, or stops.
The relay hides workload ports from the user-facing URL. It can discover an HTTP listener, preserve a native TLS listener, or place managed TLS in front of an HTTP listener. The guest performs the relay so host traffic does not need to pass through the daemon for each request.
References: guest/…/mod.rs• L1-31 guest/…/routes.rs• L70-131 guest/…/routes.rs• L150-189
Browser access observation
When managed HTTPS is not trusted on the Mac, the guest can report a browser connection to the daemon. The daemon accepts that report only for a current owned name, the captured guest run, and an expected host address. A short lease limits the observation window.
The API then gives a login-session client one pending access request. Acknowledging that request records the result of the user action; it does not grant native trust by itself.
References: guest/…/access.rs• L32-123 app/…/https_access.rs• L84-163 app/…/https_access.rs• L21-137
Machine web publication
Machine web access uses the same naming and trust model as container access, but its route is owned by the machine guest. The daemon captures the machine identity, canonical hostname, bridge address, saved port policy, and current public CA before opening a retained guest session.
The guest accepts one exclusive machine web session. It validates the live bridge address, installs the route, and publishes the exact machine DNS claim only after its frontend is ready. Policy replacements use increasing revisions and replace the complete policy. Disconnect, cancellation, VM replacement, or shutdown withdraws the DNS claim, route authority, and certificate authority.
For the machine-specific discovery, listener, relay, and cleanup flow, see Machine web-service access.
References: app/…/machine_web.rs• L25-61 app/…/machine_web.rs• L64-205 guest/…/machine_web.rs• L49-75 guest/…/machine_web.rs• L154-299
Access flow
The flow below shows how a local name becomes a trusted HTTPS request and how each boundary contributes to the result.
flowchart LR
Client[Host browser or client] --> DNS[Host local DNS]
DNS --> Registry[Shared DNS ownership]
Registry --> Name[Workload or machine name]
Client --> HTTPS[Host-facing HTTPS connection]
HTTPS --> Guest[Guest relay and route]
Guest --> Service[Workload service]
CA[Local CA and host trust] --> HTTPS
CA --> Guest
Control[Daemon and engine control] --> Registry
Control --> Guest
The name is usable only when DNS ownership and the guest route describe the same address. Managed HTTPS is usable only when the client trusts the active CA and the guest has received the matching public root.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep DNS claims, route snapshots, and projected URLs aligned. A URL must not outlive its owner, address, or installed guest route.
- Keep the configured local suffix consistent across host DNS, guest DNS, certificate name constraints, SNI checks, and URL projection.
- When changing CA identity or publication, update host trust, guest trust, certificate signing, and fingerprint checks as one lifecycle.
- Preserve the distinction between managed HTTPS and native TLS. Only the managed path depends on ArcBox CA trust.
- For machine web changes, keep the captured VM identity, bridge address, DNS claim, full policy revision, and guest session tied together.
- On cleanup changes, withdraw DNS and route authority before allowing a replaced VM or service to receive new traffic.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| DNS ownership changes while an HTTPS handshake is in progress | The connection could reach a different workload | Recheck the owner, address, revision, and installed route during the handshake |
| The host trusts a different CA than the guest uses | Browsers reject managed certificates or the guest rejects its own trust chain | Match CA fingerprints and deliver the current public root to the guest |
| A machine bridge address is stale or belongs to another VM run | A machine name can reach the wrong guest | Capture and validate the physical VM identity and live bridge address |
| A local-domain miss returns NXDOMAIN from the host DNS service | macOS may wait for the mDNS timeout instead of completing the lookup | Return NODATA for unknown names under the local domain |
| A guest route remains after service or VM teardown | A stale name can connect to a dead or reused endpoint | Withdraw route authority and DNS ownership during cleanup |
Key files
| File | Why to read it |
|---|---|
| app/…/web_services.rs | Shows how validated guest routes become public service URLs. |
| app/…/machine_dns.rs | Shows the canonical machine name and machine DNS ownership. |
| app/…/dns_service.rs | Shows host-local DNS behavior and forwarding boundaries. |
| common/…/web_services.rs | Defines the HTTP, managed HTTPS, and passthrough URL model. |
| common/…/authority.rs | Defines the CA scope used for local HTTPS names. |
| app/…/guest_trust.rs | Shows how the active public CA reaches physical guests. |
| guest/…/https.rs | Shows the guest HTTPS frontend and workload relay boundary. |
| app/…/machine_web.rs | Shows daemon-side machine web policy delivery and lifecycle supervision. |
| guest/…/machine_web.rs | Shows guest-side machine route ownership and cleanup. |