Skip to content

SSH-runner transport wedge (ADR-0002) - #3

Merged
ChrisonSimtian merged 1 commit into
mainfrom
feat/synosharp-ssh-runner
May 31, 2026
Merged

SSH-runner transport wedge (ADR-0002)#3
ChrisonSimtian merged 1 commit into
mainfrom
feat/synosharp-ssh-runner

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

The mutation transport for SynoSharp — the read-only wedge that proves the full risky stack (SSH login → sudo-to-root → on-box syno*) before any write is modeled. Per ADR-0002 / #57.

What

  • ISshRunner / SshRunner (SSH.NET 2025.1.0): lazy connect; root commands run under sudo -S with the password fed over stdin — never in the command string, process list, or dry-run render. Runs through env PATH=/usr/syno/sbin:… since sudo's secure_path excludes the syno dirs.
  • SynologyCommand: structured Executable + argv, shell-quoted only at render time (no injection on the root shell); RequiresRoot defaults true.
  • SynologySshOptions: SSH connection — host derives from SYNOLOGY_BASE_URL, reuses the account password for login + sudo, optional key.
  • CLI ssh-check: id (transport) + synoshare --enum ALL (sudo + a real read).
  • Tests: quoting unit tests + a skippable live SSH test.

Verification

Against the live DS1813+ (DSM 7.1.1-42962, 2026-05-31): listed the 9 live shares, zero mutation.

id            → exit 0: uid=1030(homelab) … groups=…,101(administrators)
synoshare ALL → exit 0  (NetBackup, PlexMediaServer, Volume-1..4, web, …)

Next (follow-ups, not this PR)

First typed mutation — EnsureShareAsync with read-before-write (diff the discover snapshot) and dry-run by default. NFS exports last (highest-risk; prove on Virtual DSM, not the live box).

🤖 Generated with Claude Code

The mutation transport for SynoSharp — SSH-exec of on-box syno* over
SSH.NET. Read-only wedge: proves the full risky stack (SSH login →
sudo-to-root → on-box CLI) before any write is modeled.

- ISshRunner / SshRunner: lazy connect; root commands run under `sudo -S`
  with the password fed over stdin (never in the command string), through
  `env PATH=/usr/syno/sbin:…` since sudo's secure_path excludes the syno dirs.
- SynologyCommand: structured executable + argv, shell-quoted only at render
  (no injection on the root shell); RequiresRoot defaults true.
- SynologySshOptions: SSH connection (host derives from SYNOLOGY_BASE_URL),
  reuses the account password for login + sudo; optional key.
- CLI `ssh-check`: id (transport) + `synoshare --enum ALL` (sudo + real read).
- Tests: quoting unit tests + skippable live SSH test.

Verified against the live DS1813+ (DSM 7.1.1-42962, 2026-05-31): listed the
9 live shares, zero mutation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit 8cf8f9f into main May 31, 2026
1 check passed
@ChrisonSimtian
ChrisonSimtian deleted the feat/synosharp-ssh-runner branch May 31, 2026 09:56
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.

1 participant