Documentation
¶
Overview ¶
Package sshfacade implements the daemon-side SSH front door for islands. The daemon (dejimad) is the single SSH endpoint for every island: it authenticates the connection against the target island's authorized_keys, then bridges the SSH session into the container via `docker exec` (see server.go). Islands run no sshd and expose no ports — the daemon brokers access exactly as it does for the websocket/PTY path, so this works identically on Linux and macOS and keeps containment intact. The SSH *username* selects the island; the public key authorizes it.
Two key stores authorize a connection (their union):
- per-island authorized_keys (~/.dejima/projects/<name>/ssh/authorized_keys) — grant a specific key access to one island (e.g. a collaborator).
- the account allow-set (~/.dejima/ssh_authorized_keys) — keys that may ssh into *every* island, current and future. Register once (your laptop, your desktop) and all islands accept it with no per-island step.
Index ¶
- func AddAccountKey(line string) (string, error)
- func AddAuthorizedKey(island, line string) (string, error)
- func Authorize(island string, offered ssh.PublicKey) (bool, error)
- func Fingerprint(signer ssh.Signer) string
- func HostSigner() (ssh.Signer, error)
- func RemoveAccountKey(fingerprint string) (int, error)
- func RemoveAllAccountKeys() (int, error)
- func RemoveAllAuthorizedKeys(island string) (int, error)
- func RemoveAuthorizedKey(island, fingerprint string) (int, error)
- type KeyInfo
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAccountKey ¶
AddAccountKey appends a key to the account-wide allow-set — keys that may ssh into every island, current and future. Returns the key's fingerprint.
func AddAuthorizedKey ¶
AddAuthorizedKey validates an "ssh-… AAAA… [comment]" line and appends it to the island's authorized_keys (deduped). Returns the parsed key's fingerprint.
func Authorize ¶
Authorize reports whether offered is allowed to ssh into island — true if the key is in the island's own authorized_keys OR in the account-wide allow-set. A missing file in either store simply contributes no keys. The island name is validated first (defense against a traversal in the SSH username).
func Fingerprint ¶
Fingerprint returns the SHA256 fingerprint of a signer's public key, for the CLI to display so clients can pin the daemon's host key.
func HostSigner ¶
HostSigner returns the daemon's SSH host key, generating and persisting a fresh ed25519 key (0600) on first use. One host key for the daemon — it is the single SSH front door, so clients pin one identity regardless of island.
func RemoveAccountKey ¶
RemoveAccountKey deletes the account key whose SHA256 fingerprint matches. Revoking here instantly removes fleet-wide access (no per-island cleanup).
func RemoveAllAccountKeys ¶
RemoveAllAccountKeys clears the account-wide allow-set.
func RemoveAllAuthorizedKeys ¶
RemoveAllAuthorizedKeys clears every authorized key for the island.
func RemoveAuthorizedKey ¶
RemoveAuthorizedKey deletes the island key whose SHA256 fingerprint matches. Returns how many were removed (0 if no match).
Types ¶
type KeyInfo ¶
type KeyInfo struct {
Fingerprint string // SHA256:…
Type string // e.g. ssh-ed25519
Comment string
}
KeyInfo is one authorized public key, for display.
func ListAccountKeys ¶
ListAccountKeys returns the account-wide keys in file order.
func ListAuthorizedKeys ¶
ListAuthorizedKeys returns the island's authorized keys in file order.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the daemon-side SSH front door. It authenticates each connection's public key against the target island (the SSH *username* names the island), then bridges the session channel into the container with `docker exec` — reusing the same brokered-access model as the websocket/PTY path. Islands run no sshd; the daemon is the single audited endpoint.
func (*Server) HostKeyFingerprint ¶
HostKeyFingerprint returns the SHA256 fingerprint of the daemon's host key, so the CLI can print it for clients to pin (known_hosts).
func (*Server) HostPublicKey ¶ added in v0.8.43
HostPublicKey returns the daemon's host key as an OpenSSH authorized-key line ("ssh-ed25519 AAAA…"), so a client can pin it in a known_hosts entry it manages itself — fetched over the already-authenticated API, so a rotated key self-heals instead of tripping "REMOTE HOST IDENTIFICATION HAS CHANGED".