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

Cannot add ssh keys to gitblit running in docker container #1415

Open
Ivan-Shestakov opened this issue May 2, 2022 · 4 comments
Open

Cannot add ssh keys to gitblit running in docker container #1415

Ivan-Shestakov opened this issue May 2, 2022 · 4 comments

Comments

@Ivan-Shestakov
Copy link

Trying to add ssh keys to a user in running gitblit/gitblit:rpc version from docker.io.
Nothing happens when I click add button in users profile, ssh keys tab. Viewing network in dev-tools shows the ajax call succeeded (status code 200), but the key isn't added.
While troubleshooting, I tried to push the key via command line, but keep getting errors about problems reading ssh keys from stdin

cat id_rsa.pub | ssh -l admin -p 29418 localhost keys add
Password authentication
Password:
The data read from SDTIN can not be parsed as an SSH public key!

podman logs gitblit shows:
2022-05-01 14:38:59 [INFO ] 1 repository models loaded for admin in 1 msecs
2022-05-01 14:38:59 [INFO ] loading ssh keystore for admin
2022-05-02 07:24:34 [INFO ] 1 repository models loaded for admin in 1 msecs
2022-05-02 07:24:34 [INFO ] loading ssh keystore for admin
2022-05-02 07:27:29 [INFO ] creating ssh session from /10.184.0.1:43458
2022-05-02 07:27:31 [INFO ] onExecute: RootDispatcher exits with: 1
2022-05-02 07:27:31 [INFO ] closed ssh session from /10.184.0.1:43458

Docker image version

REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/gitblit/gitblit rpc 90cf9827d633 3 weeks ago 256 MB
Host linux version: RHEL 8.5 (hence usage of podman instead of docker)

Steps to reproduce:

  1. As a root user, run podman pull gitblit/gitblit:rpc
  2. run podman run -d --name gitblit -v gitblit-data:/var/opt/gitblit -p 8443:8443 -p 8080:8080 -p 9418:9418 -p 29418:29418 gitblit/gitblit
  3. open web ui on port 8443 and login with default admin/admin user
  4. navigate to "my profile" and switch to ssh keys tab. Attempt to paste an ssh public key value and click "add" button
    Expected - the key is added, and can be used to push content to repositories
    Actual - nothing happens
@flaix
Copy link
Member

flaix commented Jul 28, 2022

I tried with Docker under MacOS and cannot reproduce. Will try again with Podman under Linux, as I assume you are using Linux.

@flaix
Copy link
Member

flaix commented Jul 29, 2022

I cannot reproduce this. I followed the steps listed above. Works without a fault, the key is added and can be used to connect to the Gitblit server with SSH.

So in general it is working. The question is what are the special conditions are to make this fail.

I tried this with the docker image as mentioned above. Browser was a Firefox 103, SSH key was 3072bit RSA key.

ssh-keygen -l -f id_rsa_gbtest
3072 SHA256:OkVZBmvZN3gI0Mg8JUQVJL9rFTIi737fTeS96ysc0RA florian@mints (RSA)

The error mentioned above seems to indicate that the file pasted was not a recognisable public key, although the name suggests that it is an RSA key.

@flaix
Copy link
Member

flaix commented Oct 24, 2022

Maybe the Gitblit process has no write access to the directory data/ssh where it would store the keys?

@flaix
Copy link
Member

flaix commented Nov 1, 2022

The WebUI now got feedback (in commit 2f122c9) when the key could not be parsed. Maybe this helps to identify the problem. This will be available in the next nighty build of the Gitblit docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants