Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
frezbo opened this issue May 28, 2024 · 3 comments
Open

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

frezbo opened this issue May 28, 2024 · 3 comments

Comments

@frezbo
Copy link

frezbo commented May 28, 2024

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
Copy link
Author

frezbo commented May 28, 2024

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). 

@hasufell
Copy link

hasufell commented Oct 2, 2024

Yes, this program is utterly broken. Even if I tell it which key to use, it's unable to pick the correct key or understand that it's already unlocked.

@hervyqa
Copy link

hervyqa commented Jan 2, 2025

Thanks @hasufell @frezbo

➜  ~ tree .ssh/
.ssh/
├── config
├── id_ed25519
├── id_ed25519.pub
├── known_hosts
├── privkey.pem
└── privkey.pem.pub

1 directory, 9 files

i use id_ed25519 instead of id_rsa, upterm client fails to connect.

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

No branches or pull requests

3 participants