owenthereal / upterm

Instant Terminal Sharing
https://upterm.dev
Apache License 2.0
808 stars 53 forks source link

Upterm host doesn't work if there's no `id_rsa` keys in `~/.ssh` folder #264

Open frezbo opened 1 month ago

frezbo commented 1 month ago

Upterm host does not work:

❯ tree ~/.ssh/
/home/frezbo/.ssh/
├── assh_known_hosts
├── assh.yml
├── config
├── git
├── git.pub
├── known_hosts
└── known_hosts.old

Upterm hosts fails with the following:


❯ upterm host --github-user frezbo
Error: ssh://uptermd.upterm.dev:22: Permission denied (publickey).
Usage:
  upterm host [flags]

Examples:
  # Host a terminal session running $SHELL, attaching client's IO to the host's:
  upterm host

  # Accept client connections automatically without prompts:
  upterm host --accept

  # Host a terminal session allowing only specified public key(s) to connect:
  upterm host --authorized-keys PATH_TO_AUTHORIZED_KEY_FILE

  # Host a session executing a custom command:
  upterm host -- docker run --rm -ti ubuntu bash

  # Host a 'tmux new -t pair-programming' session, forcing clients to join with 'tmux attach -t pair-programming':
  upterm host --force-command 'tmux attach -t pair-programming' -- tmux new -t pair-programming

  # Use a different Uptermd server, hosting a session via WebSocket:
  upterm host --server wss://YOUR_UPTERMD_SERVER -- YOUR_COMMAND

Flags:
      --accept                   Automatically accept client connections without prompts.
      --authorized-keys string   Specify a authorize_keys file listing authorized public keys for connection.
      --codeberg-user strings    Authorize specified Codeberg users by allowing their public keys to connect.
  -f, --force-command string     Enforce a specified command for clients to join, and link the command's input/output to the client's terminal.
      --github-user strings      Authorize specified GitHub users by allowing their public keys to connect. Configure GitHub CLI environment variables as needed; see https://cli.github.com/manual/gh_help_environment for details.
      --gitlab-user strings      Authorize specified GitLab users by allowing their public keys to connect.
  -h, --help                     help for host
      --known-hosts string       Specify a file containing known keys for remote hosts (required). (default "/home/frezbo/.ssh/known_hosts")
  -i, --private-key strings      Specify private key files for public key authentication with the upterm server (required).
  -r, --read-only                Host a read-only session, preventing client interaction.
      --server string            Specify the upterm server address (required). Supported protocols: ssh, ws, wss. (default "ssh://uptermd.upterm.dev:22")
      --srht-user strings        Authorize specified SourceHut users by allowing their public keys to connect.

FATA[0001] ssh://uptermd.upterm.dev:22: Permission denied (publickey).

If i do this:

ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa

Upterm hosts starts working

Upterm should work with no default keys

frezbo commented 1 month ago

Note: specifying --private-key does not also seem to work

❯ upterm host --github-user frezbo --private-key=~/.ssh/git
Error: ssh://uptermd.upterm.dev:22: Permission denied (publickey).
Usage:
  upterm host [flags]

Examples:
  # Host a terminal session running $SHELL, attaching client's IO to the host's:
  upterm host

  # Accept client connections automatically without prompts:
  upterm host --accept

  # Host a terminal session allowing only specified public key(s) to connect:
  upterm host --authorized-keys PATH_TO_AUTHORIZED_KEY_FILE

  # Host a session executing a custom command:
  upterm host -- docker run --rm -ti ubuntu bash

  # Host a 'tmux new -t pair-programming' session, forcing clients to join with 'tmux attach -t pair-programming':
  upterm host --force-command 'tmux attach -t pair-programming' -- tmux new -t pair-programming

  # Use a different Uptermd server, hosting a session via WebSocket:
  upterm host --server wss://YOUR_UPTERMD_SERVER -- YOUR_COMMAND

Flags:
      --accept                   Automatically accept client connections without prompts.
      --authorized-keys string   Specify a authorize_keys file listing authorized public keys for connection.
      --codeberg-user strings    Authorize specified Codeberg users by allowing their public keys to connect.
  -f, --force-command string     Enforce a specified command for clients to join, and link the command's input/output to the client's terminal.
      --github-user strings      Authorize specified GitHub users by allowing their public keys to connect. Configure GitHub CLI environment variables as needed; see https://cli.github.com/manual/gh_help_environment for details.
      --gitlab-user strings      Authorize specified GitLab users by allowing their public keys to connect.
  -h, --help                     help for host
      --known-hosts string       Specify a file containing known keys for remote hosts (required). (default "/home/frezbo/.ssh/known_hosts")
  -i, --private-key strings      Specify private key files for public key authentication with the upterm server (required).
  -r, --read-only                Host a read-only session, preventing client interaction.
      --server string            Specify the upterm server address (required). Supported protocols: ssh, ws, wss. (default "ssh://uptermd.upterm.dev:22")
      --srht-user strings        Authorize specified SourceHut users by allowing their public keys to connect.

FATA[0001] ssh://uptermd.upterm.dev:22: Permission denied (publickey).