Skip to content

FreeSBC v0.8.5

Latest

Choose a tag to compare

@github-actions github-actions released this 14 Nov 03:38
· 6 commits to main since this release
895539a

FreeSBC v0.8.5 stops a DNS-named carrier from pointing the edge at itself, the switch or a private network, makes check --deploy report UDP socket buffer caps that are too small, and documents a safe restart, upgrade and rollback on a single node. Before this release every address in a carrier's DNS answer (except the unspecified one) became an admitted carrier source and the first one the send target, so a split-horizon zone, a wildcard record or a typo could make an internal address a credential-free carrier source. Configuration is compatible: a v0.8.4 file loads as is, with no new, renamed or removed keys and no changed default, but a DNS-named carrier whose answer holds a private or loopback address stops working (see Breaking changes).

curl -fsSL https://github.com/rasonyang/freesbc/releases/latest/download/install.sh | sh

Breaking changes

None for the configuration file. One behaviour change to check before you upgrade:

  • A DNS-named carrier whose answer holds a private, CGNAT, loopback or link-local address now has that address refused (#344, closes #294). The clamp (carrierAddrPolicy, internal/edge/carrierclamp.go) applies to every A/AAAA and SRV target address of an edge.carriers entry written as a DNS name. A refused address is neither a destination nor an admitted source, wherever it sits in the answer. A carrier written as a literal IP is never clamped.
    • Always refused: the unspecified address and 0.0.0.0/8, loopback, link-local, multicast, the IPv4 broadcast, FreeSBC's own addresses (public.ip, public.bind, private.ip) and every edge.switch IP. These stay refused even when public.ip is private.
    • Refused unless public.ip is itself private or CGNAT: RFC 1918, IPv6 ULA and CGNAT. This is the condition the public media plane already uses for its destination policy.
    • Loopback passes only when public.ip or public.bind is itself loopback, which is what the edge test harness relies on.
    • How to check whether it hits you. For each edge.carriers entry that is a DNS name, resolve it (SRV first, then A/AAAA, as FreeSBC does) from the FreeSBC host and look for a private, CGNAT, loopback or link-local answer. After the upgrade, look in the journal for one WARN per refused address:
      carrier DNS answer refused: address not allowed for a DNS-name carrier with carrier, host, addr and reason. It is logged once, then at Debug while the address stays in the answer. If nothing is left after the clamp, the lookup counts as failed: the last good set is kept, the carrier_dns:<name> health item fires, and the error names each refused address and its class.
    • What to do. Write a carrier on a private network as a literal IP in edge.carriers. A private TLS carrier then needs an IP SAN in its certificate, optionally with ca_file. There is no allow_private key. A carrier whose name is public and whose answer is public needs no change.

Fixes

  • A carrier's DNS answer could make an internal address a carrier source (#344, closes #294). carrierDirectory.hostAddrs filtered only the unspecified address. FreeSBC now clamps every address of the answer before the set is used (see Breaking changes for the classes), so a name that resolves to the host itself, to an edge.switch address or into the private LAN no longer makes that address a trusted carrier source, a vouched rate-floor socket or a send target. Own and switch addresses are refused too, which covers the single-IP layout, where startup validation cannot check a DNS-named carrier against edge.switch.
    • Not covered. /api/carriers does not list the addresses refused from a partly good answer; they appear in the log only. The carrier_dns health headline still reads "DNS lookup failing" and the detail carries the refusal. Whoever controls the answer can still point the name at their own public address, which is the accepted risk in docs/design.md §14.2.

Features

  • check --deploy notes a UDP buffer cap below what FreeSBC requests (#349, closes #348). Every UDP SIP socket requests an 8 MiB receive and a 1 MiB send buffer. On a stock Linux host net.core.rmem_max and net.core.wmem_max are 212992, so both are capped and the only signal was a start-up WARN. On Linux, check --deploy now reads both values and adds one note line for each cap below the request:

    net.core.rmem_max 212992 < 8388608 requested by every UDP SIP socket: datagrams may drop silently under bursts; add /etc/sysctl.d/90-freesbc.conf (docs/edge.md#udp-socket-buffers)
    net.core.wmem_max 212992 < 1048576 requested by every UDP SIP socket: sends may stall under bursts; add /etc/sysctl.d/90-freesbc.conf (docs/edge.md#udp-socket-buffers)
    

    It is a note, not an error, so the exit code stays 0. An unreadable or unparsable value gives no line, and other operating systems skip the check. The thresholds come from the constants the sockets request (edge.UDPSIPBuffers()), so the two cannot drift.

    • install.sh prints the drop-in. In the systemd next steps (service-config and service) it prints the /etc/sysctl.d/90-freesbc.conf contents and sysctl -p before systemctl enable --now freesbc, one line per cap that is below the request or unreadable. A larger cap is never lowered, nothing is printed when both are large enough, and the script writes nothing itself.
    • A running socket keeps its size, so the drop-in takes effect only after a (re)start.
    • Not covered. Plain check is unchanged. install.sh does not write the drop-in. The manual check on a stock Ubuntu host (the note disappears after sysctl -p and the next start logs no buffer below request WARN) has not been run.
    • Docs. UDP socket buffers in docs/edge.md and a subsection in docs/install.md.
  • A documented restart, upgrade and rollback on a single node (#345, closes #337). docs/install.md has a new section, Restart and upgrade on one node, and docs/two-node.md links to it. It states what a single node loses:

    • Drain refuses new carrier calls (and the related OPTIONS) with 503 until the restart ends, a short outage by design. active_calls also counts client calls, which drain does not refuse.
    • A stop drops calls still up and sends no BYE.
    • A restart loses everything held in memory: bindings, carrier registrations (until the switch re-registers, a carrier INVITE with an fsbc= token falls back to the hash pool), bans, subscriptions and the drain state.

    It then gives six steps: keep the old binary; install; run the new binary's check --deploy --local-addresses as the service user before any outage; run a POSIX sh script that drains, polls active_calls with a deadline, restarts and prints the running version and drain state; make a test call; roll back if needed. At the deadline the script does not restart and leaves drain on.

    • Not covered. The real root systemd path and the install under FREESBC_VERIFY=require with cosign were not run. The script was run in a Linux container with a systemctl shim, and the rollback with install.sh into a scratch prefix.

Internal

  • Three more test flakes fixed; no production code changed in any of them.
    • TestRejectedRegistrationCountsFailure read the metrics before logRegister counted the 403, which runs after the relay. It now waits for RegistrationFailure. TestCaseE_NoLeaksAfterCalls and TestEndReasonDTLSFailure had the same shape and now wait for both gauges to reach zero and for WebRTCDTLSFailures; those two were found by reading the code and were not reproduced (#343, closes #339).
    • TestLatchRefusalCountedWebRTCPrivate and TestLatchRefusalCountedPlain read the captured log before latchReporter.slow had written the WARN, which comes after recordRejected. They now wait with eventually (#347, closes #346).
    • TestALGOutboundCarrierCall and TestALGClientLegResponses failed the nightly soak with switch saw [200], want 180 then 200. The fake switch's own sipgo client dropped a 180 that reached its transaction after the 200 (emiago/sipgo#306), and the edge relayed both. startFakeSwitch now records every response status per Call-ID in wire order from a transport OnMessage handler, and callCodes reads that (#350). Before the change go test -race ./internal/edge -run 'TestALGOutboundCarrierCall|TestALGClientLegResponses' -count=200 -cpu 1,2 failed; after it, it passes.
  • config.PrivateOrCGNAT (internal/config/validate.go) is now exported and shared by the shared-socket validation, publicDestPolicy and carrierAddrPolicy. No behaviour change.
  • TestUDPBufferNote (internal/app/udpbuffer_test.go) covers the note with an injected reader; TestInstallScriptBufferNumbers checks that install.sh's RMEM_WANT and WMEM_WANT equal edge.UDPSIPBuffers(). Eight new tests in internal/edge/carrierclamp_test.go cover each refused class on the A/AAAA and SRV paths, own and switch addresses, a good address behind a private one, keeping the last good set, the private public.ip lift, the loopback rule, the WARN, and literal carriers.
  • freesbc.example.yaml now comments the DNS-name carrier entry with the clamp and the literal-IP advice.

Known limitations and follow-ups

  • The soak criterion for #339 is not yet observed. Its second criterion, no failure in the next 7 nightly Soak runs, can only be checked after release. The soak workflow itself has not been run on the #350 change either.
  • TestALGClientLegResponses flaked once on the #344 branch (switch saw [200], want 180 then 200) at about the rate it fails on main (1 in 15). That is the flake #350 addresses.
  • #288 and #298: failed INVITE, MESSAGE and SUBSCRIBE credentials from an admitted source are not counted, and INVITE rejections give no enumeration signal.
  • #307: an un-REGISTER (and a wildcard un-REGISTER) still removes a binding on the 2xx alone, without the proof a new binding needs.