BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
455a4fe9
Commit
455a4fe9
authored
Mar 24, 2015
by
Sašo Stanovnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed generating SSH key fingerprints in OpenSSH 6.8.
parent
c0337491
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
key.rb
app/models/key.rb
+17
-0
No files found.
app/models/key.rb
View file @
455a4fe9
...
...
@@ -86,8 +86,25 @@ class Key < ActiveRecord::Base
Tempfile
.
open
(
'gitlab_key_file'
)
do
|
file
|
file
.
puts
key
file
.
rewind
# OpenSSH 6.8 introduces a new default output format for fingerprints.
# Check the version and decide which command to use.
version_output
,
version_status
=
popen
(
%W(ssh -V)
)
explicit_fingerprint_algorithm
=
false
if
version_status
.
zero?
out
,
_
=
version_output
.
scan
/.*?(\d)\.(\d).*?,/
major
,
minor
=
out
[
0
],
out
[
1
]
if
major
.
to_i
>
6
or
(
major
.
to_i
==
6
and
minor
.
to_i
>=
8
)
explicit_fingerprint_algorithm
=
true
end
end
if
explicit_fingerprint_algorithm
cmd_output
,
cmd_status
=
popen
(
%W(ssh-keygen -E md5 -lf
#{
file
.
path
}
)
,
'/tmp'
)
else
cmd_output
,
cmd_status
=
popen
(
%W(ssh-keygen -lf
#{
file
.
path
}
)
,
'/tmp'
)
end
end
if
cmd_status
.
zero?
cmd_output
.
gsub
/(\h{2}:)+\h{2}/
do
|
match
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment