Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !9008

Closed
Created 10 years ago by Administrator@rootOwner
  • Report abuse
Report abuse

Fix generating SSH key fingerprints with OpenSSH 6.8.

  • Overview 8
  • Commits 3
  • Changes 1

Created by: sstanovnik

OpenSSH 6.8 introduces a new feature that changes the default fingerprint format and algorithm used by ssh-keygen. This breaks adding new SSH keys, because GitLab expects the colon-delimited format.

The message the user sees on the Add an SSH Key screen is "Fingerprint cannot be generated", similar to #7413 (closed), but the underlying cause is different.

This change checks the OpenSSH version and explicitly specifies the previous format if needed.

Request to merge github/fork/sstanovnik/openssh_fix into master
  • Download as
  • Email patches

  • Plain diff

Checking approval status

Closed by (Jun 19, 2025 5:47pm UTC)

The changes were not merged into master

Mentions #7413 (closed)


  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: Razer6

    @jacobvosmaer Can you take a look?

    By Administrator on 2015-03-24T06:38:14 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: sstanovnik

    The new format has "MD5:" prepended which parsed successfully but incorrectly, preventing users from using the SSH key, so I fixed that too.

    By Administrator on 2015-03-24T09:57:42 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: jacobvosmaer

    Thanks for looking into this @sstanovnik

    By Administrator on 2015-03-24T10:54:24 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 38384bd9 10 years ago
    app/models/key.rb
    96 major, minor = out[0], out[1]
    97 if major.to_i > 6 or (major.to_i == 6 and minor.to_i >= 8)
    98 explicit_fingerprint_algorithm = true
    99 end
    100 end
    101
    102 if explicit_fingerprint_algorithm
    103 cmd_output, cmd_status = popen(%W(ssh-keygen -E md5 -lf #{file.path}), '/tmp')
    104 else
    105 cmd_output, cmd_status = popen(%W(ssh-keygen -lf #{file.path}), '/tmp')
    106 end
    90 107 end
    91 108
    92 109 if cmd_status.zero?
    93 cmd_output.gsub /(\h{2}:)+\h{2}/ do |match|
    94 self.fingerprint = match
    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: jacobvosmaer

      This regex code looks a little wonky to me. I wonder if we can just pick out the MD5 fingerprint with something like:

      # constant should be defined somewhere at the top of the class
      FINGERPRINT_REGEX = Regexp.new('\h{2}:' * 15 + '\h{2}') # 16 hex bytes separated by ':'
      self.fingerprint = cmd_output.scan(FINGERPRINT_REGEX).first

      By Administrator on 2015-03-24T11:07:31 (imported from GitLab project)

  • Administrator
    Administrator @root started a thread on commit 38384bd9 10 years ago
    app/models/key.rb
    96 major, minor = out[0], out[1]
    97 if major.to_i > 6 or (major.to_i == 6 and minor.to_i >= 8)
    98 explicit_fingerprint_algorithm = true
    99 end
    100 end
    101
    102 if explicit_fingerprint_algorithm
    103 cmd_output, cmd_status = popen(%W(ssh-keygen -E md5 -lf #{file.path}), '/tmp')
    104 else
    105 cmd_output, cmd_status = popen(%W(ssh-keygen -lf #{file.path}), '/tmp')
    106 end
    90 107 end
    91 108
    92 109 if cmd_status.zero?
    93 cmd_output.gsub /(\h{2}:)+\h{2}/ do |match|
    94 self.fingerprint = match
    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: jacobvosmaer

      On the other hand, anchoring against the MD5 prefix seems like a nice defensive idea.

      By Administrator on 2015-03-24T11:20:04 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: jacobvosmaer

    I like the basic idea but I am not 100% sure about the code style. What do you think @vsizov ?

    By Administrator on 2015-03-24T11:39:01 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: vsizov

    @jacobvosmaer It looks good for me.

    By Administrator on 2015-03-24T11:52:26 (imported from GitLab project)

  • Administrator
    Administrator @root · 10 years ago
    Owner

    Created by: Razer6

    Already first issue reported related to this https://gitlab.com/gitlab-org/gitlab-ce/issues/1289

    By Administrator on 2015-03-24T12:18:27 (imported from GitLab project)

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Milestone
No milestone
None
None
Time tracking
No estimate or time spent
0
Labels
None
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
1
1 participant
user avatar
Reference: gpt/large_projects/gitlabhq1!9008
Source branch: github/fork/sstanovnik/openssh_fix

    0 pending comments

Menu

Projects Groups Snippets
Help