Skip to content

Sparewall 0.5.0

Choose a tag to compare

@github-actions github-actions released this 03 Nov 18:33
· 56 commits to main since this release
v0.5.0
5561712

Sparewall 0.5.0 connects sites and sends traffic through other people's VPNs. It adds:

  • WireGuard tunnels to other sites;
  • WireGuard clients that send chosen networks out through a VPN provider or hub;
  • log forwarding to any syslog collector;
  • an optional local Prometheus that keeps each node's metric history.

Tunnels

  • Site-to-site tunnels (#148, #221). A vpn peer with an endpoint is treated as another site.

    • Connections: the node connects to the other site as well as accepting connections from it.
    • Routing: the peer's networks are routed through the tunnel.
    • keepalive: a new per-peer setting that keeps an idle tunnel up and holds it open through NAT.
    • Endpoints named by DNS: resolved again while the tunnel is quiet, so a site on a dynamic address is found again.
    • sparewall vpn peer-config NAME: prints the other site's side of the tunnel, for wg-quick.
    • In a pair: only the master sends to the other site, from the gateway address. After a failover, the new master restarts the tunnel itself. In the pair test, the tunnel was back within 8 seconds.
    • Requirement: a pair with site peers needs exactly one static WAN, with a gateway address.
    • See site-to-site tunnels.
    vpn:
      branch:
        listen_port: 51821
        endpoint: hq.example.org
        addresses: [10.98.0.1/30]
        zone: branch
        peers:
          office-b:
            public_key: "<the branch's public key>"
            endpoint: office-b.example.net:51821
            addresses: [10.98.0.2/32, 192.168.20.0/24]
            keepalive: 25
  • VPN clients (#149, #223). vpn_clients.<name> makes the node a WireGuard client of a service it doesn't run, such as a VPN provider, a cloud host or another organization's hub.

    • What goes through the tunnel: traffic from the networks listed in route.networks, except traffic to the node's own networks. Everything else keeps using the WAN.
    • Addressing: traffic leaving through the tunnel takes the tunnel's address.
    • Kill switch (on by default): while the tunnel is down, the routed networks can't reach the WAN.
    • DNS: DHCP hands the routed networks the client's dns servers.
    • In a pair: both nodes use the same key, and only the master's tunnel is up. In the pair test, connections through it carried on across a failover.
    • Health: the new tunnels check is degraded when a site or a service hasn't completed a handshake in three minutes.
    • See VPN clients.
    vpn_clients:
      egress:
        private_key: secret:provider-key
        addresses: [10.64.12.34/32]
        zone: egress
        peer:
          public_key: "<the service's public key>"
          endpoint: nl1.provider.example:51820
        dns: [10.64.0.1]
        route:
          networks: [guests]

Logs and metrics

  • Forwarding to a syslog collector (#147, #219). With logging.remote.provider: syslog, the node runs rsyslog, which sends the journal as RFC 5424 syslog to rsyslog, syslog-ng, Graylog or a SIEM.
    • Protocols: UDP (the default), TCP, TCP over TLS (RFC 5425) or RELP.
    • TLS: logging.remote.ca takes a private CA. logging.remote.certificate names a secret holding a client certificate; RELP over TLS needs one.
    • While the collector is down: messages wait on disk, up to 256 MB, and are sent when it is back.
    • Rule hits: the message carries the rule and the packet.
    • Health: the new log-forwarding check is degraded while the certificate's secret is missing.
    • See forwarding logs.
  • A local Prometheus (#145, #220). With metrics.mode: local, each node keeps its own metric history: what /metrics shows, every 15 seconds.
    • How long it keeps it: metrics.retention (default 15d) and the new metrics.retention_size (default 1GB).
    • How it runs: in its own container, as nobody, listening on loopback only, with memory capped at 512 MB.
    • Querying: org.sparewall.Metrics.Query and QueryRange take PromQL from any token or session with the monitor role or above. Through /call/, a call answers 503 while Prometheus is down.
    • Not backed up: the history isn't part of the backup bundle.
    • The image: ghcr.io/sparewall/prometheus is a fourth provider image, bound to the OS image. It adds about 190 MB to each deployment.
    • Charts in the web UI are planned for 0.6.0 (#222).
    • See history: a local Prometheus.

Pairs

  • A configuration change with the sync link cut (#224, #225). Each node now remembers which schema revision its peer last said it reads, even when the peer is out of reach or the node restarts. That allows --allow-diverge changes that use new settings while the sync link is down; before, only revision-1 changes were accepted.
  • Recovery times are now in the operations guide, as measured by the pair test.

Testing

  • New VM tests:
    • Syslog forwarding over UDP, TCP, TLS and RELP with a client certificate, including a collector outage.
    • A local Prometheus, including queries through the API.
    • Site-to-site tunnels: on a single node; and in a pair, across master loss and a rolling upgrade.
    • A VPN client with its kill switch, on a two-NIC pair, across a failover.
    • A sync-link cut with a revision 4 configuration.
  • Upgrade tests start from 0.4.0, on a single node and on a pair.

Upgrading

Run sparewall upgrade on either node, or start it from the web UI. Nodes on 0.4.0 can upgrade straight to 0.5.0.

  • Schema revision 4. These new settings and values are schema revision 4, and 0.4.x can't read a document that uses any of them:
    • logging.remote.ca and logging.remote.certificate;
    • metrics.retention and metrics.retention_size;
    • vpn.<name>.peers.<peer>.keepalive;
    • vpn_clients;
    • the values logging.remote.provider: syslog and metrics.mode: local.
  • Rolling back to 0.4.x: first roll the configuration back, with sparewall rollback, to a generation that doesn't use any revision 4 setting. Then roll back the node. See schema revisions.
  • Pairs: until both nodes run 0.5.0, any change that uses a revision 4 setting is refused. Upgrade both nodes first.
  • Download size: the Prometheus image is pulled with the upgrade even if metrics.mode isn't local.

What's Changed

  • feat(logging): forward to a syslog collector with rsyslog by @silug in #219
  • feat(metrics): a local Prometheus (metrics.mode: local) by @silug in #220
  • feat(vpn): site-to-site tunnels with static WireGuard peers by @silug in #221
  • feat(vpn): WireGuard clients for chosen networks' egress by @silug in #223
  • fix(pair): keep what the peer reads across a sync cut by @silug in #225

Full Changelog: v0.4.0...v0.5.0

Installing and upgrading

The image is ghcr.io/sparewall/sparewall:0.5.0 (sha256:5f0e341ea284d5b4b84f86f6a6a0fd91a82aac5fbe1c10e9a12d12accf801973). Nodes on the stable channel are offered it once it is published.
Upgrade a node or a pair with sparewall upgrade (operations).

For a new install (getting started):

  • sparewall-0.5.0-x86_64.iso installs unattended to the first fixed
    disk of the machine it boots, only if that disk is blank; it
    stops at a disk with anything on it.
  • sparewall-0.5.0-x86_64.raw.zst is a disk image to write to a disk,
    and .qcow2 the same for virtual machines.
  • sparewall-0.5.0-x86_64-linux.tar.gz is the sparewall CLI, to
    manage nodes over SSH from a workstation; -aarch64-linux is
    the same for arm64 Linux, and -aarch64-darwin and
    -x86_64-darwin for a Mac (Apple silicon, Intel).
    Homebrew installs it on either: brew install sparewall/tap/sparewall.

Files named .partNN are pieces of one file (GitHub limits a file to
2 GiB): cat them together, in order.

Verifying the downloads

SHA256SUMS is signed with the project key (cosign.pub in the
repository) and lists every file, including each split file joined:

cosign verify-blob --key cosign.pub --bundle SHA256SUMS.sigstore.json SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS

The macOS CLI is signed ad hoc, not notarized: after unpacking a
downloaded tarball, clear its quarantine attribute with
xattr -d com.apple.quarantine sparewall (Homebrew does this itself).

The SPDX SBOMs list what is in the image and in each CLI build.