redmine-git-hosting / redmine_git_hosting

A Redmine plugin which makes configuring your own Git hosting easy ;)
http://redmine-git-hosting.io
MIT License
274 stars 117 forks source link

Cannot assign deployment key with 4.0.2 #769

Closed EvilBMP closed 3 years ago

EvilBMP commented 4 years ago

With the latest version of the plugin I am (again) not able to add deployment keys to a repository. I get the following log output, if I try to do:

I, [2020-07-08T15:27:59.788925 #1297]  INFO -- : Started POST "/repositories/357/deployment_credentials" for 111.222.333.444 at 2020-07-08 15:27:59 +0200
I, [2020-07-08T15:27:59.791168 #1297]  INFO -- : Processing by RepositoryDeploymentCredentialsController#create as HTML
I, [2020-07-08T15:27:59.791275 #1297]  INFO -- :   Parameters: {"utf8"=>"✓", "authenticity_token"=>"y6b9vnFepVzXts814PPFdFb9RIEMicqMnclWNHj9Htzr15579uWYMi7iq8U5Ivw9iqm7ITAeRR5nyxpQvSLYBQ==", "repository_deployment_credential"=>{"gitolite_public_key_id"=>"23", "perm"=>"R"}, "repository_id"=>"357"}
I, [2020-07-08T15:27:59.810880 #1297]  INFO -- :   Current user: admin (id=112)
I, [2020-07-08T15:28:00.213563 #1297]  INFO -- : Completed 406 Not Acceptable in 422ms (ActiveRecord: 121.6ms)
F, [2020-07-08T15:28:00.214458 #1297] FATAL -- :
F, [2020-07-08T15:28:00.214540 #1297] FATAL -- : ActionController::UnknownFormat (RepositoryDeploymentCredentialsController#create is missing a template for this request format and variant.

request.formats: ["text/html"]
request.variant: []):
F, [2020-07-08T15:28:00.214567 #1297] FATAL -- :
F, [2020-07-08T15:28:00.214588 #1297] FATAL -- : lib/redmine/sudo_mode.rb:65:in `sudo_mode'

Our environment:

Environment:
  Redmine version                4.1.1.stable.19684
  Ruby version                   2.4.9-p362 (2019-10-02) [x86_64-linux-gnu]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.9.7
  Git                            2.17.1
  Filesystem                     
  Xitolite                       2.17.1
Redmine plugins:
  additionals                    2.0.23
  clipboard_image_paste          1.13
  redmine_base_deface            1.3.2
  redmine_bootstrap_kit          0.2.5
  redmine_checklists             3.1.16
  redmine_contacts               4.3.0
  redmine_contacts_helpdesk      4.1.8
  redmine_drafts                 4.0.0
  redmine_git_hosting            4.0.1
  redmine_highlightjs            1.0.4
  redmine_image_clipboard_paste  3.3.0
  redmine_impersonate            2.0.0
  redmine_lightbox2              0.5.1
  redmine_maintenance_mode       2.2.0
  redmine_mentions               0.0.1
  redmine_people                 1.5.1
  redmine_preview_pdf            1.0.4
  redmine_sidebar_toc_dt         0.0.3
  redmine_sidekiq                2.1.0
  redmine_silencer               0.4.3
  redmine_static_link            0.1.1
  redmine_user_specific_theme    1.2.0
  redmine_wiki_lists             0.0.8
  sidebar_hide                   0.0.7
EvilBMP commented 4 years ago

~Update: Only happens, when the user who is trying to add a deployment credential is an admin in Redmine - any ideas?~

EvilBMP commented 4 years ago

Ok, it has nothing to do with the admin user. But it seems, the problem occurs because of different deployment key formats...

Note: We manage all deployment keys within one generic user account (which also has admin rights).

We lately moved our redmine to a newer VPS and updated redmine from 3.x to 4.1 as well. Now every new deployment key in the list is displayed in the format:

project-a-deploy | SHA256:sx9tRwHqGO7Ew3sZn29TLU2lk624Ry4uZTEz0n7pRhg

instead of the old/ existing ones:

project-b-deploy | 7d:62:d6:a8:fa:7c:22:c8:c4:39:ce:0d:01:1c:0f:23

If I now want to assign an old/ existing deploy key with md5 fingerprint to a new project/ repository I get the error mentioned above. If I choose a new key with sha256 fingerprint, everything is working correctly.

Do I have to migrate all deployment keys to sha256 fingerprinted versions?

alexandermeindl commented 3 years ago

This problem should be fixed with 5.0.0.

EvilBMP commented 3 years ago

@alexandermeindl Thanks for the note. I just wanted to give feedback as well. We fixed the issue by converting all the old md5 fingerprints to sha256 by ourselves. But it would have been nice if there were some kind of migration available. If this is the case in 5.0.0 I am happy for every other user struggling with this (maybe rare) situation.