Skip to content

No world-open SSH on the DCV, web and MPI groups (#1596) - #1614

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/1596-sg-ssh
Nov 13, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/1596-sg-ssh

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1596

What

  • New groups open no SSH. spawn-dcv (DCV apps and desktops), spawn-web (web apps) and spawn-mpi-* (MPI job arrays) no longer get a tcp/22 0.0.0.0/0 rule. The DCV and web groups keep only 8443 and 443. The MPI group keeps only its all-traffic self rule, which also covers mpirun's node-to-node SSH.
  • Reused groups are cleaned up. When spawn finds one of these groups created by an older release, retireWorldSSH revokes exactly the tcp/22 rule from 0.0.0.0/0 / ::/0. A narrower SSH rule (e.g. a user's /32) stays. If the revoke fails, spawn prints a warning and still launches.
  • Fixed-name groups must be spawn's. spawn-dcv and spawn-web are adopted only if they are tagged spawn:managed=true. spawn has tagged both at creation since they were added. The cluster groups (spawn-mpi-<array>, spawn-efa-<name>) are joined by a caller-chosen name on purpose, so they are not held to this.
  • No new flag. spawn connect already picks SSM when no attached group admits tcp/22 (linuxConnectTransport, Plain Linux spawn launch into a default VPC waits 2 min for SSH and fails: only the VPC default SG is attached, and it has no port-22 rule #1296), so it keeps working with no change: interactive sessions, one-shot commands, and DCV's --session-manager. For direct SSH, attach your own group with --security-group-ids. A shared per-VPC group is the wrong place for a per-caller CIDR, because each caller's rule would accumulate there.

Tests

There is no IAM, user-data or spored change.

Live checks needed before merge (owner)

Run in 435415984226, with --ttl 15m on every launch.

  1. In a VPC that already has an old spawn-dcv group (with 22 0.0.0.0/0), run spawn app launch <a DCV app> --ttl 15m.
    • Expect the "Removed the world-open SSH (22) rule" line.
    • aws ec2 describe-security-groups --group-ids <sg> --region us-east-1: 8443 tcp/udp only.
    • spawn connect <name> opens the DCV session, and spawn connect <name> --session-manager gives a shell.
  2. Same for spawn-web with a web app (e.g. code-server). Expect 443 only, the app loads, and spawn connect lands in an SSM shell.
  3. Run an MPI job array (--count 2 --mpi --ttl 15m).
    • The group has only the self rule.
    • mpirun across both nodes works.
    • spawn connect <array>-0 works over SSM.
  4. In a VPC with no spawn-dcv, create an untagged spawn-dcv group by hand. spawn app launch must refuse it, naming the group. Delete the hand-made group afterwards.
  5. Leak-check: no instances left, and no stray groups beyond the ones the reaper normally ages out.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.47826% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/securitygroup.go 93.47% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Live check (spore-host-dev, 2026-11-13). The build integrated #1612, #1613, #1614 and #1616 on main.

Not run live: Windows (#1617), the egress proxy (#1618), the release manifest (#1619), retiring a reused DCV/MPI group, and interactive spawn connect.

scttfrdmn and others added 2 commits November 13, 2026 14:50
spawn-dcv, spawn-web and spawn-mpi-* opened tcp/22 to 0.0.0.0/0. spawn
connect never needed it: it uses SSM when no group admits SSH, and MPI's
node-to-node SSH is covered by the self rule. New groups open no SSH;
a reused group loses exactly the world-open rule an older spawn wrote
(narrower SSH rules stay; failure is a warning).

spawn app launch refuses an existing spawn-dcv/spawn-web group not
tagged spawn:managed=true, since those fixed names could be pre-created
by anyone able to create a group in the account.

Substrate keeps no SG tags (substrate#1440) and revokes every range of
a multi-range permission (substrate#1453, filed); tests work around
both, named.
@scttfrdmn
scttfrdmn marked this pull request as ready for review November 13, 2026 22:51
@scttfrdmn
scttfrdmn merged commit 6e7ac9d into main Nov 13, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1596-sg-ssh branch November 13, 2026 23:14
@scttfrdmn scttfrdmn mentioned this pull request Nov 14, 2026
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.

security: Managed DCV, web and MPI security groups open SSH 22 to 0.0.0.0/0 by default, with no CIDR flag

1 participant