routeros: BGP hardening (input filter, route cap, TCP MD5 key with Cilium) #125
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lab/iac#125
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to the cutover (#73). The output-filter half shipped with #145 (PR #152: reject-all chain
bgp-outon every connection, proven on the lab CHR pair and live in prod with advertisements 0). What remains here: input filter, route cap, TCP MD5, and the port-179 narrowing.Gaps, most important first
routeros/modules/router/bgp.tfsays it: RouterOS 7 accepts every received route when no input filter is set. If mini announced0.0.0.0/0,10.15.1.0/24or a /32 for OpenBao (from a Cilium misconfiguration or a spoofed peer), both routers would install it. Since #145 this matters twice as much: each peer now also runs a v6 session and can pushfdd5:...routes.input.limit-process-routes-ipv4/-ipv6).MGMT-ACCESS= vlan10-mgmt + vrrp10, vlan30-trusted + vrrp30, bridge + vrrp1 (the legacy LAN), andin-mgmtaccepts every input connection from it before any drop. So any device landing on the legacy LAN or VLAN 30 can open TCP 179 (RouterOS still refuses a session unless the source matches a configured peer). The VLAN 20 thinks are NOT broadly open: they pass only through the per-peer /32 acceptsin-bgp-c1-think-0{1,2,3}. No cameras are involved: the three addresses in the frigate template (10.15.1.239/.60/.132) answer nothing (no ARP, no leases, no ping, both routers, 2026-11-18) and VLAN 30 carries only the workstation. The original "cameras ride in trusted" premise was inherited from that stale template and is removed from this issue.Plan
Commit 1: route filter and cap (routeros/modules/router/bgp.tf)
modules/siteas a per-peer field (for exampleaccept = [{ prefix, len }]), covering both families:10.30.12<N>.0/24andfdd5:c8ef:2fa0:4<N>::/64.input.filter = <peer>-inandinput.limit-process-routes-ipv4/-ipv6(a few hundred) onrouteros_routing_bgp_connection, on the-v6connections too.dst-len == 32vsdst-len in 32..32) on the CHR sim pair (routeros/sim), and confirm in the gate that all routes are still learned.Commit 2: TCP MD5 key, router side and Cilium side together
secret/routeros-secrets(for examplebgp_md5_<peer>), read through the existing ESO path into the device roots, thentcp_md5_keyon the connection (both the v4 and the-v6connection of each peer share the key).kube-systemwith keypassword, andauthSecretRefon theCiliumBGPPeerConfig(c1 thinks today; mini'scilium-peerwhen mini joins).Commit 3 (with the LAN zone rework): narrow port 179 to the peers
netfield inmodules/sitetoday, so its session "rides in-mgmt" (comment infirewall.tf): the first step is giving it a per-peer accept like the thinks have.in-mgmt, is the one safe sliver of this work: it does not touch the REST/SSH/Winbox path, so the #74 lockout rule (management accept before any drop) is not at risk.Decide first
PodCIDR(10.44.0.0/24) as well as the LoadBalancer IPs, so the LAN can reach pods directly and skip Services. If nothing needs that, dropPodCIDRfrom theCiliumBGPAdvertisementand allow only the LB pool in the filter.Notes
generic-templates/frigateHelmRelease still points at the three dead RTSP sources with plaintext creds in git (the inventory flagged that cleanup too). If the cameras are gone for good, frigate should be deleted with them.Search keywords: TODO bgp filter md5 tcp-md5-key authSecretRef hardening route-limit.
Re-scoped after #145: the reject-all output chain shipped there (PR #152), so this issue is now input filter + route cap + MD5 + port 179. The v6 sessions from #145 are in scope for all of them, and each peer connection now exists twice (v4 and -v6).
Camera premise re-verified and removed (2026-11-18, both routers): no ARP entries, no DHCP leases, no ping replies for 10.15.1.239/.60/.132; VLAN 30 carries only the workstation; the legacy LAN carries mini-01, the routers and one dormant non-camera device. The claim traced back to the checked-in frigate helmrelease RTSP config, not to live state. Gap 4 corrected: the broad 179 reach is only the MGMT-ACCESS networks (VLAN 10 + VLAN 30 + legacy LAN); VLAN 20 peers already pass only via per-peer /32 accepts.