Commit 630c9a1f authored by Nick Thomas's avatar Nick Thomas

Merge branch '40636-instance-configuration-shows-incorrect-ssh-fingerprints' into 'master'

Instance Configuration page now displays correct SSH fingerprints

Closes #40636

See merge request gitlab-org/gitlab-ce!22081
parents 1fd648fa d49397f7
...@@ -64,10 +64,10 @@ class InstanceConfiguration ...@@ -64,10 +64,10 @@ class InstanceConfiguration
end end
def ssh_algorithm_md5(ssh_file_content) def ssh_algorithm_md5(ssh_file_content)
OpenSSL::Digest::MD5.hexdigest(ssh_file_content).scan(/../).join(':') Gitlab::SSHPublicKey.new(ssh_file_content).fingerprint
end end
def ssh_algorithm_sha256(ssh_file_content) def ssh_algorithm_sha256(ssh_file_content)
OpenSSL::Digest::SHA256.hexdigest(ssh_file_content) Gitlab::SSHPublicKey.new(ssh_file_content).fingerprint('SHA256')
end end
end end
---
title: Instance Configuration page now displays correct SSH fingerprints
merge_request: 22081
author:
type: fixed
random content ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuRkAgwaap/pXThwCpjX8Wd5tR36Tqx3sW2sVVHs3UKB7kd+xNknw7e4qpuEATv56xHrhKm2+ye/JidTuQ/1EwFhjaz7I5wTslfVawQpeH1ZqAGmvdO/xTw+l7fgEFVlGVx9y0HV3m52y2C9yw82qmg+BohbTVgPtjjutpFc+CwLQxLTnTrRhZf5udQgz+YlwLv+Y0kDx6+DWWOl8N9+TWuGyFKBln79CyBgFcK5NFmF48kYn8W+r7rmawfw9XbuF1aa+6JF+6cNR1mCEonyrRLdXP+vWcxpLKYfejB0NmA1y+W9M/K53AcIHA5zlRQ49tFh0P22eh/Gl8JQ6yyuin foo@bar.mynet
require 'spec_helper' require 'spec_helper'
RSpec.describe InstanceConfiguration do describe InstanceConfiguration do
context 'without cache' do context 'without cache' do
describe '#settings' do describe '#settings' do
describe '#ssh_algorithms_hashes' do describe '#ssh_algorithms_hashes' do
let(:md5) { '54:e0:f8:70:d6:4f:4c:b1:b3:02:44:77:cf:cd:0d:fc' } let(:md5) { '5a:65:6c:4d:d4:4c:6d:e6:59:25:b8:cf:ba:34:e7:64' }
let(:sha256) { '9327f0d15a48c4d9f6a3aee65a1825baf9a3412001c98169c5fd022ac27762fc' } let(:sha256) { 'SHA256:2KJDT7xf2i68mBgJ3TVsjISntg4droLbXYLfQj0VvSY' }
it 'does not return anything if file does not exist' do it 'does not return anything if file does not exist' do
stub_pub_file(exist: false) stub_pub_file(exist: false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment