2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-02-16 22:55:24 -05:00
|
|
|
factory :key do
|
|
|
|
title
|
2022-06-30 14:09:30 -04:00
|
|
|
key do
|
|
|
|
# Larger keys take longer to generate, and since this factory gets called frequently,
|
|
|
|
# let's only create the smallest one we need.
|
|
|
|
SSHData::PrivateKey::RSA.generate(
|
|
|
|
::Gitlab::SSHPublicKey.supported_sizes(:rsa).min, unsafe_allow_small_key: true
|
|
|
|
).public_key.openssh(comment: 'dummy@gitlab.com')
|
|
|
|
end
|
2022-05-11 14:07:55 -04:00
|
|
|
trait :expired do
|
|
|
|
to_create { |key| key.save!(validate: false) }
|
|
|
|
expires_at { 2.days.ago }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :expired_today do
|
|
|
|
to_create { |key| key.save!(validate: false) }
|
|
|
|
expires_at { Date.today.beginning_of_day + 3.hours }
|
|
|
|
end
|
|
|
|
|
2022-07-09 08:08:17 -04:00
|
|
|
trait :without_md5_fingerprint do
|
|
|
|
after(:create) do |key|
|
|
|
|
key.update_column(:fingerprint, nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-15 09:50:19 -05:00
|
|
|
factory :key_without_comment do
|
2022-06-30 14:09:30 -04:00
|
|
|
key { SSHData::PrivateKey::RSA.generate(3072, unsafe_allow_small_key: true).public_key.openssh }
|
2018-02-15 09:50:19 -05:00
|
|
|
end
|
|
|
|
|
2017-05-31 09:43:19 -04:00
|
|
|
factory :deploy_key, class: 'DeployKey'
|
2016-02-16 22:55:24 -05:00
|
|
|
|
2020-06-15 08:08:44 -04:00
|
|
|
factory :group_deploy_key, class: 'GroupDeployKey' do
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
2016-02-16 22:55:24 -05:00
|
|
|
factory :personal_key do
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
2022-04-05 11:08:37 -04:00
|
|
|
factory :personal_key_4096 do
|
|
|
|
user
|
|
|
|
|
|
|
|
key { SSHData::PrivateKey::RSA.generate(4096, unsafe_allow_small_key: true).public_key.openssh(comment: 'dummy@gitlab.com') }
|
|
|
|
end
|
|
|
|
|
2016-02-16 22:55:24 -05:00
|
|
|
factory :another_key do
|
2017-05-31 09:43:19 -04:00
|
|
|
factory :another_deploy_key, class: 'DeployKey'
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
2017-04-05 02:22:28 -04:00
|
|
|
|
2017-08-21 06:30:03 -04:00
|
|
|
factory :rsa_key_2048 do
|
|
|
|
key do
|
2018-01-02 09:40:07 -05:00
|
|
|
<<~KEY.delete("\n")
|
2018-02-16 11:32:08 -05:00
|
|
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC98dbu7gxcbmAvwMqz/6AALhSr1jiX
|
|
|
|
G0UC8FQMvoDt+ciB+uSJhg7KlxinKjYJnPGfhX+q2K+mmCGAmI/D6q7rFxE+bn09O+75
|
|
|
|
qgkTHi+suDVE6KG7L3n0alGd/qSevfomR77Snh6fQPdG6sEAZz3kehcpfVnq5/IuLFq9
|
|
|
|
FBrgmu52Jd4XZLQZKkDq6zYOJ69FUkGf93LZIV/OOaS+f+qkOGPCUkdKl7oEcgpVNY9S
|
|
|
|
RjBCduXnvi2CyQnnJVkBguGL5VlXwFXH+17Whs7oFWmdiG+4jzBRLIMz4EuIW09b8Su5
|
|
|
|
PW6+bBuXOifHA8KG5TMmjs5LYdCMPFnhTyDyO3a1 dummy@gitlab.com
|
2018-01-02 09:40:07 -05:00
|
|
|
KEY
|
2017-08-21 06:30:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :rsa_deploy_key_2048, class: 'DeployKey'
|
|
|
|
end
|
|
|
|
|
2018-02-16 11:32:08 -05:00
|
|
|
factory :rsa_key_4096 do
|
|
|
|
key do
|
|
|
|
<<~KEY.delete("\n")
|
|
|
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACA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9udL7m80dYpUiEAxoYZdbSSNCDaKP4ViABnGIeZreIujabI8IdtE
|
|
|
|
IjFQTaF2d5HTYjp28/qf576CFP5L7AGydypipYqZUmsYnay5YVjdm89He3TMD71SwspJl
|
|
|
|
POC4RnM0HS87OE+U0+mVaIe8YYbcjTekpVU9mkqsE/GQ34Egw79VMNNgWq5avOzpT8msC
|
|
|
|
lTJxgfJ1agGgigTvGxUM0FB07+sIdJxxNymAGpLKZ1op8xaJI3o8D86jWgI22za1zxUB5
|
|
|
|
il9U7+KOzaWo9mp3bmhvZWGDwzTXEZhUJYMRby7o6UxSHlA6fKE63JSDD2yhXk4CjsQRN
|
|
|
|
C7Ph9cYSB+Wa3i9Am4rRlJgrF79okmEOMpj1idliHkpIsy/k2CN9Lf2EIHOD4NMuLrSUH
|
|
|
|
4qJsPUq19ZbGIMdImD3vMS5b dummy@gitlab.com
|
|
|
|
KEY
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-21 06:30:03 -04:00
|
|
|
factory :dsa_key_2048 do
|
|
|
|
key do
|
2018-01-02 09:40:07 -05:00
|
|
|
<<~KEY.delete("\n")
|
2018-02-16 11:32:08 -05:00
|
|
|
ssh-dss AAAAB3NzaC1kc3MAAAEBALEB3sM2kPy6LKLiyL+UlDx2vzuKrzSD2nsW2Kb7
|
|
|
|
0ivIqDNJu5CbqIQSkjdMzJiocs33ESFqXid6ezOtVdDwXHJQRxKGalW1kBbFAPjtMxlD
|
|
|
|
bf559+7qN2zfCfcQsgTmNAZ7O+wltqJmyLv5i4QqNwPDvyeBvJ4C+770DzlcQtpkflKJ
|
|
|
|
X+O7i8Ylq34h6UTCTnjry+dFVm1xz97LPf7XuzXGZcAG/eGUNQgxQ2bferKnrpYOXx6c
|
|
|
|
ocSRj9W54nrRFMWuDeOspWp4MoYK0FRMfDQYPksUayGUnm1KQTGuDbB0ahRNCOm8b3tf
|
|
|
|
P9Z+vjANAkqenzDuXCpz2PU/Oj6/N/UAAAAhAPOLyut12Mjcp3eUXLe1xSoI5IRXSLso
|
|
|
|
W9no93dcFNprAAABAQCLhpqKY+PNcwbhhPruL+f+uROghHzDwRNX+e231F4wHHeDDomf
|
|
|
|
WyLVFj31XrHdDXZnS9tTTj5D2XWLovSSxYb3H7earTctmktL0lQ3HapujzvOkn+VM0pG
|
|
|
|
s6B3j54+AM3mg50KZdYWxxv+v/lb6oEcsCjfKNyRIx/5pqX6XI3dxl9MMIxrfVWpkNX+
|
|
|
|
FI68v1LVV61DC9PkNyEHU0v9YBOfrTiS21TIlVIZcSFhuDjg52MekfZAnoKaP7YFJNF3
|
|
|
|
fdCrXaU3hYQrwB9XdskBUppwxKGhf7O6SWEZhAEfPA9kgxaWHoJvsDz8aca576UNe7BP
|
|
|
|
mjzo/SLUX+P4uvcaffd+AAABAEqzpmwjzTxB+DV8C+0LnmKf3L/UlQWyGdmhd65rnbkH
|
|
|
|
GgRMAAkoh4GBOEHL5bznNRmO7X/H6g2fR7SEabxfbvb903KI4nbfFF+3QtnwyIbTBAcH
|
|
|
|
0893D3bi5rsaJcz+c6lBob2En2nThRciefXUk2oPzCQuDyFIyHLJikqRQVcalHCdQ00c
|
|
|
|
/H/JkiJedHNqaeU4TeMk8SM53Brjplj/iiJq+ujc5MlEgACdCwWp0BviFACEoYyFaa3R
|
|
|
|
kc7Xdm9vFpclm9fzgUfPloASA0SkO945in3mIqMfODTb4yRvbjk8If9483fEPgQkczpd
|
|
|
|
ptBz1VAKg8AmRcz1GmBIxs+Stn0= dummy@gitlab.com
|
2018-01-02 09:40:07 -05:00
|
|
|
KEY
|
2017-08-21 06:30:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :ecdsa_key_256 do
|
|
|
|
key do
|
2018-01-02 09:40:07 -05:00
|
|
|
<<~KEY.delete("\n")
|
|
|
|
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYA
|
|
|
|
AABBBJZmkzTgY0fiCQ+DVReyH/fFwTFz0XoR3RUO0u+199H19KFw7mNPxRSMOVS7tEtO
|
|
|
|
Nj3Q7FcZXfqthHvgAzDiHsc= dummy@gitlab.com
|
|
|
|
KEY
|
2017-08-21 06:30:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :ed25519_key_256 do
|
|
|
|
key do
|
2018-01-02 09:40:07 -05:00
|
|
|
<<~KEY.delete("\n")
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETnVTgzqC1gatgSlC4zH6aYt2CAQzgJ
|
|
|
|
OhDRvf59ohL6 dummy@gitlab.com
|
|
|
|
KEY
|
2017-08-21 06:30:03 -04:00
|
|
|
end
|
|
|
|
end
|
2022-02-04 01:15:28 -05:00
|
|
|
|
|
|
|
factory :ecdsa_sk_key_256 do
|
|
|
|
key do
|
|
|
|
<<~KEY.delete("\n")
|
|
|
|
sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyN
|
|
|
|
TZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBDZ+f5tSRhlB7EN39f93SscTN5PUv
|
|
|
|
bD3UQsNrlE1ZdbwPMMRul2zlPiUvwAvnJitW0jlD/vwZOW2YN+q+iZ5c0MAAAAEc3NoOg== dummy@gitlab.com
|
|
|
|
KEY
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :ed25519_sk_key_256 do
|
|
|
|
key do
|
|
|
|
<<~KEY.delete("\n")
|
|
|
|
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tA
|
|
|
|
AAAIEX/dQ0v4127bEo8eeG1EV0ApO2lWbSnN6RWusn/NjqIAAAABHNzaDo= dummy@gitlab.com
|
|
|
|
KEY
|
|
|
|
end
|
|
|
|
end
|
2016-02-16 22:55:24 -05:00
|
|
|
end
|
|
|
|
end
|