feat(routing): Lab Host Router closes the Gateway-to-Lab cross-VM gap
Adds platform/lab-router/ — a narrow service that runs on the Lab Host, authenticates the Gateway via mTLS, and resolves an opaque routing token to a local container purely from Docker label state (no Postgres access, no callback to the Provisioner). Replaces the Gateway's env.internal_ip assumption (only valid when Gateway and Lab share a Docker daemon) with a data-driven direct/router decision per lab_host (lab_hosts.routing_mode/router_endpoint, migration 004), resolved in one place (platform/gateway/src/lab-endpoint.js's labTarget()) that every proxy/fetch call site in server.js now goes through. Extends the existing Docker TLS CA (infra/scripts/docker-tls/generate-docker-tls.sh) with a second mTLS leaf pair (router-server/gateway-client) for this new data-plane connection, deployed by the docker-tls Ansible role into a separate directory from the control-plane pair. Firewall (rn-lab-host-01.rules) replaces the old speculative wide port-range allowance with one narrow rule: platform_ip -> the Router's port only. dev-local stays routing_mode: direct — zero behavior change for local dev, confirmed by the full existing regression suite passing unmodified.
This commit is contained in:
@@ -13,7 +13,7 @@ lab_host_ip: __LAB_HOST_VM_IP__
|
||||
management_cidr: __YOUR_ADMIN_ACCESS_CIDR__ # e.g. a VPN/WireGuard subnet, never 0.0.0.0/0
|
||||
proxmox_mgmt_cidr: __PROXMOX_HOST_MGMT_CIDR__
|
||||
lab_subnet_range: "10.42.0.0/16" # matches NO_PROXY_CIDRS already used by the app
|
||||
lab_gateway_port_range: "30000:32767" # see docs/PRODUCTION_NETWORK_SECURITY.md — Gateway-to-Lab reachability follow-up
|
||||
lab_router_port: "8443" # Gateway -> Lab Host Router (data plane) — see docs/PHASE4_1_PREPRODUCTION_HARDENING.md §1-3
|
||||
|
||||
# ── Storage (Phase 4 §4 — a decision framework, not a final layout; see docs/PHASE4_PRODUCTION_INFRASTRUCTURE.md §4)
|
||||
rootnode_data_root: /srv/rootnode-data # expected to be a ZFS dataset mountpoint on the real host
|
||||
|
||||
@@ -4,3 +4,19 @@
|
||||
name: docker
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
# Phase 4.1 — these restart the whole per-host compose wrapper unit (no per-container systemd
|
||||
# units exist in this project's convention, see the `platform`/`lab-host` roles), which is
|
||||
# heavier than a surgical single-container restart but consistent with how every other
|
||||
# config-changed-so-restart-the-stack case is already handled here.
|
||||
- name: restart lab-router
|
||||
ansible.builtin.systemd:
|
||||
name: rootnode-lab-host.service
|
||||
state: restarted
|
||||
when: inventory_hostname in groups['lab_host']
|
||||
|
||||
- name: restart gateway
|
||||
ansible.builtin.systemd:
|
||||
name: rootnode-platform.service
|
||||
state: restarted
|
||||
when: inventory_hostname in groups['platform']
|
||||
|
||||
@@ -87,3 +87,50 @@
|
||||
mode: "0644"
|
||||
when: inventory_hostname in groups['lab_host']
|
||||
notify: restart docker with tls
|
||||
|
||||
# ── Phase 4.1: the DATA-plane mTLS pair (Gateway <-> Lab Host Router). Same CA as the
|
||||
# CONTROL-plane pair above, separate directory (/etc/rootnode/lab-router-tls) so the two
|
||||
# concerns stay bind-mount-separable — the `lab-router`/`gateway` containers only ever need
|
||||
# their own pair mounted in, never the Docker TLS one. See
|
||||
# docs/PHASE4_1_PREPRODUCTION_HARDENING.md §1-3.
|
||||
- name: Create /etc/rootnode/lab-router-tls
|
||||
ansible.builtin.file:
|
||||
path: /etc/rootnode/lab-router-tls
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
|
||||
- name: Deploy CA cert for the data-plane pair (public, both hosts)
|
||||
ansible.builtin.copy:
|
||||
src: "{{ docker_tls_local_bundle_dir }}/ca.pem"
|
||||
dest: /etc/rootnode/lab-router-tls/ca.pem
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0444"
|
||||
|
||||
- name: Deploy Lab Host Router server cert/key (rn-lab-host-01 only)
|
||||
ansible.builtin.copy:
|
||||
src: "{{ docker_tls_local_bundle_dir }}/{{ item.src }}"
|
||||
dest: "/etc/rootnode/lab-router-tls/{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "{{ item.mode }}"
|
||||
loop:
|
||||
- { src: router-server-cert.pem, dest: router-server-cert.pem, mode: "0444" }
|
||||
- { src: router-server-key.pem, dest: router-server-key.pem, mode: "0400" }
|
||||
when: inventory_hostname in groups['lab_host']
|
||||
notify: restart lab-router
|
||||
|
||||
- name: Deploy Gateway client cert/key (rn-platform-01 only)
|
||||
ansible.builtin.copy:
|
||||
src: "{{ docker_tls_local_bundle_dir }}/{{ item.src }}"
|
||||
dest: "/etc/rootnode/lab-router-tls/{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "{{ item.mode }}"
|
||||
loop:
|
||||
- { src: gateway-client-cert.pem, dest: gateway-client-cert.pem, mode: "0444" }
|
||||
- { src: gateway-client-key.pem, dest: gateway-client-key.pem, mode: "0400" }
|
||||
when: inventory_hostname in groups['platform']
|
||||
notify: restart gateway
|
||||
|
||||
@@ -3,3 +3,11 @@ PLATFORM_API_URL=http://api:4300
|
||||
PROVISIONER_URL=http://provisioner:4100
|
||||
PROVISIONER_SHARED_SECRET={{ vault_provisioner_shared_secret }}
|
||||
GATEWAY_PORT=4200
|
||||
# Phase 4.1 — mTLS client identity for the Lab Host Router (data plane). Only used when a
|
||||
# lab_host's routing_mode is 'router' (see platform/gateway/src/lab-endpoint.js); harmless if
|
||||
# every configured lab_host is still 'direct'. Paths are inside the container — mounted from
|
||||
# /etc/rootnode/lab-router-tls on the host by the `docker-tls` role, same pattern as the
|
||||
# Provisioner's Docker TLS client cert.
|
||||
LAB_ROUTER_TLS_CA=/tls/ca.pem
|
||||
LAB_ROUTER_TLS_CERT=/tls/gateway-client-cert.pem
|
||||
LAB_ROUTER_TLS_KEY=/tls/gateway-client-key.pem
|
||||
|
||||
Reference in New Issue
Block a user