Skip to content

Conversation

@smklein
Copy link
Collaborator

@smklein smklein commented Jan 31, 2026

This call was added in March 2024 (05ed790) to ensure firewall rules are plumbed during initial rack setup. However, in May 2024 (f2602b5), await_ip_allowlist_plumbing() was added to Server::start() to ensure the allowlist is enforced before the external HTTP server starts.

This created redundancy: in the test/RSS path, rack_initialize() plumbs the rules, then Server::start() immediately re-plumbs them via await_ip_allowlist_plumbing().

Removing the call from rack_initialize() is safe because:

  1. await_ip_allowlist_plumbing() handles both fresh rack and restart:

    • Fresh rack: rules plumbed before external server starts
    • Restart: rules re-plumbed before external server starts
  2. The call in rack_initialize() has no unique purpose - the external server doesn't start until after await_ip_allowlist_plumbing() anyway

  3. Order is preserved:

    • Allowlist written to DB in rack_initialize() (unchanged)
    • Rules plumbed to sleds in await_ip_allowlist_plumbing() (unchanged)
    • External server starts AFTER plumbing completes (unchanged)

Also removes the now-unused Nexus::plumb_service_firewall_rules wrapper method from sled.rs, since all callers use nexus_networking:: directly.

Saves ~400ms in nexus test setup time.

This call was added in March 2024 (05ed790) to ensure firewall rules
are plumbed during initial rack setup. However, in May 2024 (f2602b5),
await_ip_allowlist_plumbing() was added to Server::start() to ensure
the allowlist is enforced before the external HTTP server starts.

This created redundancy: in the test/RSS path, rack_initialize() plumbs
the rules, then Server::start() immediately re-plumbs them via
await_ip_allowlist_plumbing().

Removing the call from rack_initialize() is safe because:

1. await_ip_allowlist_plumbing() handles both fresh rack and restart:
   - Fresh rack: rules plumbed before external server starts
   - Restart: rules re-plumbed before external server starts

2. The call in rack_initialize() has no unique purpose - the external
   server doesn't start until AFTER await_ip_allowlist_plumbing() anyway

3. Order is preserved:
   - Allowlist written to DB in rack_initialize() (unchanged)
   - Rules plumbed to sleds in await_ip_allowlist_plumbing() (unchanged)
   - External server starts AFTER plumbing completes (unchanged)

4. Background task (ServiceRulePropagator) provides additional safety,
   periodically re-plumbing rules every 5 minutes

Also removes the now-unused Nexus::plumb_service_firewall_rules wrapper
method from sled.rs, since all callers use nexus_networking:: directly.

Saves ~400ms in nexus test setup time.
@smklein smklein marked this pull request as ready for review February 2, 2026 16:33
Copy link
Collaborator

@bnaecker bnaecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@smklein smklein merged commit 10f6883 into main Feb 2, 2026
16 checks passed
@smklein smklein deleted the firewall-opt branch February 2, 2026 17:10
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.

3 participants