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

ui/keygen not generating keys for host #93

Closed
twpayne opened this issue Mar 8, 2022 · 7 comments · Fixed by #101
Closed

ui/keygen not generating keys for host #93

twpayne opened this issue Mar 8, 2022 · 7 comments · Fixed by #101
Assignees
Labels
bug Something isn't working

Comments

@twpayne
Copy link
Contributor

twpayne commented Mar 8, 2022

Apologies if I've missed something obvious here. I was looking to test charm KV and ran the following commands:

$ charm keygen

  ✔  Generated keys

$ charm id

  We were’t able to authenticate via SSH, which means
  there’s likely a problem with your key.

  You can generate SSH keys by running  charm keygen . You
  can also set the environment variable  CHARM_SSH_KEY_PATH
  to point to a specific private key, or use  -i specifify a
  location.

I expected charm id to report an identity associated with the keys I just created.

I tried this in a basic Docker container and got the same result:

$ docker run -it ubuntu:latest /bin/bash
...

# apt update && apt install -y wget
...

# wget https://github.com/charmbracelet/charm/releases/download/v0.10.3/charm_0.10.3_linux_amd64.deb
...

# dpkg -i charm_0.10.3_linux_amd64.deb
Selecting previously unselected package charm.
(Reading database ... 4470 files and directories currently installed.)
Preparing to unpack charm_0.10.3_linux_amd64.deb ...
Unpacking charm (0.10.3) ...
Setting up charm (0.10.3) ...

# charm keygen

  ✔  Generated keys

# charm id

  We were’t able to authenticate via SSH, which means
  there’s likely a problem with your key.

  You can generate SSH keys by running  charm keygen . You
  can also set the environment variable  CHARM_SSH_KEY_PATH
  to point to a specific private key, or use  -i specifify a
  location.

I also tried running a local charm server, but got the same result (output from the same Docker container):

# charm serve &
[1] 2609
2022/03/08 21:34:47 Opening SQLite db: data/db/charm_sqlite.db
2022/03/08 21:34:47 http://localhost:35354
2022/03/08 21:34:47 Starting SSH server on :35353
2022/03/08 21:34:47 Starting HTTP server on: :35354
2022/03/08 21:34:47 Starting HTTP health server on: :35356

# export CHARM_HOST=localhost

# charm id

  We were’t able to authenticate via SSH, which means
  there’s likely a problem with your key.

  You can generate SSH keys by running  charm keygen . You
  can also set the environment variable  CHARM_SSH_KEY_PATH
  to point to a specific private key, or use  -i specifify a
  location.

Is there something that I'm missing?

@bashbunni
Copy link
Member

Just to confirm, the charm serve process isn't being suspended in the background right? Are you able to see anything when you have the server running, then run charm? There should be output after charm serve giving you updates on any activity on the server.

Let me know and I'll be happy to dig in to this further!

@twpayne
Copy link
Contributor Author

twpayne commented Mar 17, 2022

Thank you for the reply! I think the charm serve process is running. I tested this using the docker commands above (up to and including charm serve &) and I got the following output from using wget to connect to it:

# wget -O - http://localhost:35354
--2022-03-17 00:41:55--  http://localhost:35354/
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:35354... connected.
HTTP request sent, awaiting response... 2022/03/17 00:41:55 <- GET / 127.0.0.1
2022/03/17 00:41:55 -> 400 Bad Request 29B 14.413µs
400 Bad Request
2022-03-17 00:41:55 ERROR 400: Bad Request.

The 400 Bad Request response indicates that the charm server (or something else speaking HTTP on port 35354) is running, and I would expect such a 4xx response from the server given that the request body is empty.

edit: grammar

@twpayne
Copy link
Contributor Author

twpayne commented Mar 17, 2022

When I run charm I get the following output:

root@1a1cfd650090:/# charm

   Charm

  │ Username: (none set)
  │ Joined: 17 Mar 2022

  > Link a machine
    Manage linked keys
    Set Username
    Backup
    Exit

  j/k, ↑/↓: choose • enter: select

Exploring this TUI seems to indicate that things are working well, for example choosing Managed linked keys prints a key with the very recent timestamp (likely the key that I created in this temporary docker container). This would seem to narrow down the problem to be "charm is working correctly, but charm id isn't printing the output expected by the user".

@bashbunni
Copy link
Member

Hmm, this is interesting... I was able to reproduce the "Bad Request" response from the server with the wget command in my docker container (followed the steps you outlined above) despite having no issue with charm id. I've also reached out to some of my teammates for ideas. Will keep you updated!

@bashbunni bashbunni assigned bashbunni and toby and unassigned bashbunni Mar 18, 2022
aymanbagabas added a commit that referenced this issue Mar 18, 2022
ui/keygen ignores the passed host

Fixes: #93
@bashbunni bashbunni added the bug Something isn't working label Mar 24, 2022
@stephaneeybert
Copy link

Sorry to be off topic here, but I was enticed to come on this thread from its title, as I'm too, unsure how to get started with charm.

In fact, it's a bit worse, I wonder what I could use charm for. I tried to understand the possible usages from its website but was left wondering.

Maybe there is some documentation or a simple wiki page ? Or better, a video showing us what good things we can do with it ?

@bashbunni
Copy link
Member

Hey @stephaneeybert thank you so much for reaching out! We're working on building out the documentation and providing more context around our projects both in written and video formats. It's really helpful to hear your pain points, so thank you for sharing. I'll update you on this thread when we have added some documentation that makes it a bit more clear on what you can do with Charm and how you can get started with using it

@bashbunni bashbunni changed the title Unclear how to get started ui/keygen not generating keys for host Mar 28, 2022
aymanbagabas added a commit that referenced this issue Mar 28, 2022
ui/keygen ignores the passed host

Fixes: #93
@stephaneeybert
Copy link

@bashbunni What !? The one bashbunny I watched last week with TJ showing how to turn nvim into an IDE ? What a surprise !! Thank you for your kind and quick come back !
Stephane Eybert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants