Skip to content

Upgrade relay to strfry 1.1.3 - #53

Merged
KoalaSat merged 1 commit into
RoboSats:mainfrom
gabbygator184:relay/strfry-1.1.3-hardening
Nov 28, 2026
Merged

KoalaSat merged 1 commit into
RoboSats:mainfrom
gabbygator184:relay/strfry-1.1.3-hardening

Conversation

@gabbygator184

Copy link
Copy Markdown
Contributor

Summary

Upgrade the coordinator relay container (strfry) from 1.0.4 (Oct 2023) to
1.1.3, restructure the image as a multi-stage build on Ubuntu 24.04
(noble), and add container hardening to the relay service.

Motivation

strfry 1.0.4 is affected by issues fixed upstream since then, which matter
for an internet-facing relay:

  • Memory DoS in uWebSockets (1.1.2): an attacker could keep appending
    websocket fragments under the max payload size, exhausting memory.
  • Crash bugs in uWebSockets (1.1.1) and in negentropy subscriptions with
    duplicate sub IDs (1.1.2).
  • Reconnect bug in sync/stream commands after connection failure,
    which affects the federation/external sync cron jobs directly.
  • NIP-01 subId length cap, CLOSED replies for invalid REQs, NIP-42/NIP-45
    support and other fixes.

Changes

  • compose/relay/Dockerfile
    • Multi-stage build (toolchain no longer ships in the final image, ~80%
      smaller, smaller attack surface).
    • Base image ubuntu:jammy → ubuntu:noble (LTS support until 2029).
    • Runtime stage runs apt upgrade and installs only runtime libraries,
      with the noble package names (libflatbuffers2, libsecp256k1-1).
    • Entrypoint, crontab, sync scripts and root execution unchanged.
  • compose/docker-compose.yml (relay service)
    • cap_drop: ALL + cap_add: SETUID, SETGID (cron needs these to run
      the sync jobs), no-new-privileges, mem_limit: 1g, cpus: "2.0",
      pids_limit: 200 — mirroring the hardening already applied to
      blossom.

Compatibility

  • Relay-to-relay negentropy sync (NIP-77) is unchanged: the negentropy
    submodule is pinned to the same commit in 1.0.4 and 1.1.3, and the
    sync/delete CLI flags used by the cron scripts are identical, so
    coordinators that keep running strfry 1.0.4 are unaffected.
  • The host-mounted strfry.conf remains fully valid (all keys still
    supported; new options are opt-in).
  • The LMDB database schema is unchanged (v3; the new replaceDeletion
    index is backward/forward compatible) — no re-import, rollback possible.
  • RoboSats backend (nostr-sdk EVENT publishing) and frontend (nostr-tools
    clients) use standard NIP-01 flows and are unaffected.

Deployment

Nothing to do on the host: the relay keeps running as root, so the
root-owned LMDB files continue to work. Rebuild with your usual flow
(e.g. tn build relay, then mn up -d --build relay). After deploy,
check the first sync cycle in /var/log/cron.log.

Bump strfry from 1.0.4 to 1.1.3 (memory DoS and crash fixes, sync
reconnect bugfix) and rebuild the relay image as a multi-stage build
on ubuntu:noble, shipping only the binary and runtime libs. Harden
the relay service in docker-compose with cap_drop/no-new-privileges
and resource limits. No protocol changes: NIP-77 negentropy sync,
host-provided strfry.conf and the LMDB database remain compatible.
@gabbygator184
gabbygator184 requested a review from a team as a code owner November 22, 2026 13:52
@KoalaSat
KoalaSat merged commit 18067d2 into RoboSats:main Nov 28, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants