Merge pull request #2996 from raphendyr/ssh_fingerprint_fix
Ssh fingerprint fix
This commit is contained in:
commit
ea28519f57
5 changed files with 17 additions and 4 deletions
|
@ -45,7 +45,7 @@ class Key < ActiveRecord::Base
|
||||||
file.close
|
file.close
|
||||||
file.unlink # deletes the temp file
|
file.unlink # deletes the temp file
|
||||||
end
|
end
|
||||||
errors.add(:key, "can't be fingerprinted") if fingerprint_output.match("failed")
|
errors.add(:key, "can't be fingerprinted") if $?.exitstatus != 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_identifier
|
def set_identifier
|
||||||
|
|
|
@ -43,6 +43,6 @@ class ProfileSshKeys < Spinach::FeatureSteps
|
||||||
end
|
end
|
||||||
|
|
||||||
And 'I have ssh key "ssh-rsa Work"' do
|
And 'I have ssh key "ssh-rsa Work"' do
|
||||||
create(:key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work")
|
create(:key, :user => @user, :title => "ssh-rsa Work", :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+L3TbFegm3k8QjejSwemk4HhlRh+DuN679Pc5ckqE/MPhVtE/+kZQDYCTB284GiT2aIoGzmZ8ee9TkaoejAsBwlA+Wz2Q3vhz65X6sMgalRwpdJx8kSEUYV8ZPV3MZvPo8KdNg993o4jL6G36GDW4BPIyO6FPZhfsawdf6liVD0Xo5kibIK7B9VoE178cdLQtLpS2YolRwf5yy6XR6hbbBGQR+6xrGOdP16eGZDb1CE2bMvvJijjloFqPscGktWOqW+nfh5txwFfBzlfARDTBsS8WZtg3Yoj1kn33kPsWRlgHfNutFRAIynDuDdQzQq8tTtVwm+Yi75RfcPHW8y3P Work")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -148,6 +148,12 @@ FactoryGirl.define do
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
factory :invalid_key do
|
||||||
|
key do
|
||||||
|
"ssh-rsa this_is_invalid_key=="
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :milestone do
|
factory :milestone do
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
INVALID_FACTORIES = [:key_with_a_space_in_the_middle]
|
INVALID_FACTORIES = [
|
||||||
|
:key_with_a_space_in_the_middle,
|
||||||
|
:invalid_key,
|
||||||
|
]
|
||||||
|
|
||||||
FactoryGirl.factories.map(&:name).each do |factory_name|
|
FactoryGirl.factories.map(&:name).each do |factory_name|
|
||||||
next if INVALID_FACTORIES.include?(factory_name)
|
next if INVALID_FACTORIES.include?(factory_name)
|
||||||
|
|
|
@ -73,8 +73,12 @@ describe Key do
|
||||||
build(:key, user: user).should be_valid
|
build(:key, user: user).should be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it "rejects the unfingerprintable key" do
|
it "rejects the unfingerprintable key (contains space in middle)" do
|
||||||
build(:key_with_a_space_in_the_middle).should_not be_valid
|
build(:key_with_a_space_in_the_middle).should_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "rejects the unfingerprintable key (not a key)" do
|
||||||
|
build(:invalid_key).should_not be_valid
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue