Repository navigation
Conversation
The daemon served the full gvisor-tap-vsock API (vn.Mux()) without authentication on 192.168.127.254:80. Any process in the VM, including any container, could reach it through host.crc.testing and, besides managing port forwards: - overwrite DNS zones such as crc.testing. and apps-crc.testing. - attach to the virtual switch through /connect - open connections through /tunnel - read stats, the switch CAM table and DHCP leases Serve vn.GatewayMux() instead, which only exposes the forwarder /all, /expose and /unexpose endpoints. crc itself sets up port forwards from the host through /network/ on the daemon socket, which is unchanged. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Matus Skvarla <mskvarla@redhat.com>
The forwarder endpoints on 192.168.127.254:80 accepted requests from any process in the VM. Pass the REST API token to the virtual network with SetAPIToken() before calling GatewayMux(), so that /all, /expose and /unexpose require the same Authorization: Bearer <token> header as the /hosts endpoints on the gateway. Requests without it, or with a wrong token, get 401. routes-controller in existing bundles doesn't send the token yet, so its NodePort forwarding stops working until it is updated to read CRC_REST_API_TOKEN and send it on expose and unexpose. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Matus Skvarla <mskvarla@redhat.com>
The virtual network DNS server lets /services/dns/add merge records into an existing zone or replace its default IP. None of the zones crc configures were marked as protected, so anyone who could reach the API could point api.crc.testing, api-int.crc.testing or every *.apps-crc.testing name at another address. Mark apps-crc.testing., crc.testing., containers.internal. and docker.internal. as Protected, so gvisor-tap-vsock rejects any attempt to modify them through the API. The API is no longer reachable from the VM, so this is defense in depth for the host-side /network/ endpoint and for any future change that exposes the DNS API again. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Matus Skvarla <mskvarla@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. WalkthroughThe daemon now protects four built-in DNS zones. The host virtual-IP API passes its REST API token to ChangesDaemon DNS and API hardening
Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant HostVirtualIPServer
participant networkAPIMux
participant GatewayMux
participant HostVM
HostVirtualIPServer->>networkAPIMux: pass REST API token
networkAPIMux->>GatewayMux: set token and serve gateway mux
HostVM->>networkAPIMux: request forwarder endpoint
networkAPIMux->>GatewayMux: dispatch request
GatewayMux-->>HostVM: return endpoint response or 401
Suggested reviewers: Merge Risk:
|
|
@redbeam: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Fixes #5459
Requires crc-org/routes-controller#65
Changes:
The daemon served the full gvisor-tap-vsock API (vn.Mux()) without authentication on 192.168.127.254:80. Any process in the VM, including any container, could reach it through host.crc.testing and, besides managing port forwards:
Serve vn.GatewayMux() instead, which only exposes the forwarder /all, /expose and /unexpose endpoints. crc itself sets up port forwards from the host through /network/ on the daemon socket, which is unchanged.
The forwarder endpoints on 192.168.127.254:80 accepted requests from any process in the VM. Pass the REST API token to the virtual network with SetAPIToken() before calling GatewayMux(), so that /all, /expose and /unexpose require the same Authorization: Bearer header as the /hosts endpoints on the gateway. Requests without it, or with a
wrong token, get 401.
routes-controller in existing bundles doesn't send the token yet, so its NodePort forwarding stops working until it is updated to read CRC_REST_API_TOKEN and send it on expose and unexpose.
The virtual network DNS server lets /services/dns/add merge records into an existing zone or replace its default IP. None of the zones crc configures were marked as protected, so anyone who could reach the API could point api.crc.testing, api-int.crc.testing or every *.apps-crc.testing name at another address.
Mark apps-crc.testing., crc.testing., containers.internal. and docker.internal. as Protected, so gvisor-tap-vsock rejects any attempt to modify them through the API. The API is no longer reachable from the VM, so this is defense in depth for the host-side /network/ endpoint and for any future change that exposes the DNS API again.
Summary by CodeRabbit