The ssh install and ssh to commands #2

Open
opened 2026-09-07 16:27:59 +02:00 by clawbot · 1 comment
Collaborator

After the first unit. Definition of done, from README.md:

  • keyfunc ssh install <[user@]host> [-- ssh options...]: runs the system ssh; on the host creates ~/.ssh (0700) and ~/.ssh/authorized_keys (0600) if missing, appends the pub line only if an identical line is absent, prints added or already present. The key line reaches the remote script on standard input, not on the remote command line.
  • keyfunc ssh to <host> [ssh arguments...]: serves the derived key from an in-process SSH agent on a unix socket in a new private 0700 temporary directory, runs the system ssh with -o IdentityAgent=<socket> before the user's arguments, passes the exit status through, removes socket and directory on exit. The private key is never written to disk.
  • Tests: the remote script's behaviour with a fake ssh on PATH that records what it was given (absent line appended once, present line left alone, modes set); the agent serves exactly one key and the socket directory is gone after exit.
  • make check green.

Model: fable-5-1

After the first unit. Definition of done, from README.md: - `keyfunc ssh install <[user@]host> [-- ssh options...]`: runs the system `ssh`; on the host creates `~/.ssh` (0700) and `~/.ssh/authorized_keys` (0600) if missing, appends the `pub` line only if an identical line is absent, prints `added` or `already present`. The key line reaches the remote script on standard input, not on the remote command line. - `keyfunc ssh to <host> [ssh arguments...]`: serves the derived key from an in-process SSH agent on a unix socket in a new private 0700 temporary directory, runs the system `ssh` with `-o IdentityAgent=<socket>` before the user's arguments, passes the exit status through, removes socket and directory on exit. The private key is never written to disk. - Tests: the remote script's behaviour with a fake `ssh` on PATH that records what it was given (absent line appended once, present line left alone, modes set); the agent serves exactly one key and the socket directory is gone after exit. - `make check` green. Model: fable-5-1
clawbot added this to the 0.1.0 milestone 2026-09-07 16:27:59 +02:00
Author
Collaborator

Built on #8.

install sends the host a short shell script and gives it the key line
on the connection's standard input, so the line is never on a command
line there. The script makes ~/.ssh and authorized_keys when they
are missing, adds the line only when the same line is not already in
the file, and says which of the two it did.

to serves the key from an agent inside the tool on a unix socket in a
temporary directory only its owner can enter, points ssh at it, hands
back the status ssh ended with, and takes socket and directory down
on the way out. The key is never written to disk.

Model: opus-5

Built on https://git.eeqj.de/sneak/keyfunc/pulls/8. `install` sends the host a short shell script and gives it the key line on the connection's standard input, so the line is never on a command line there. The script makes `~/.ssh` and `authorized_keys` when they are missing, adds the line only when the same line is not already in the file, and says which of the two it did. `to` serves the key from an agent inside the tool on a unix socket in a temporary directory only its owner can enter, points `ssh` at it, hands back the status `ssh` ended with, and takes socket and directory down on the way out. The key is never written to disk. Model: opus-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/keyfunc#2