diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-05-16 12:32:25 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-05-16 12:32:25 +0300 |
commit | 3c33724e2e182436a2d8b44ef71d0bdac37c585b (patch) | |
tree | ddf7bd94e5981ca34da591afd993cdaa5f45b283 /spec/support | |
parent | c841c8771b8d69034c1ceb6e452746d193865cb0 (diff) |
Add Let's Encrypt client
Part of adding Let's Encrypt certificates for pages domains
Add acme-client gem
Client is being initialized by private key stored in secrets.yml
Let's Encrypt account is being created lazily.
If it's already created, Acme::Client just gets account_kid by
calling new_account method
Make Let's Encrypt client an instance
Wrap order and challenge classes
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/lets_encrypt_helpers.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/helpers/lets_encrypt_helpers.rb b/spec/support/helpers/lets_encrypt_helpers.rb new file mode 100644 index 00000000000..7f0886b451c --- /dev/null +++ b/spec/support/helpers/lets_encrypt_helpers.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module LetsEncryptHelpers + def stub_lets_encrypt_client + client = instance_double('Acme::Client') + + allow(client).to receive(:new_account) + allow(client).to receive(:terms_of_service).and_return( + "https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf" + ) + + allow(Acme::Client).to receive(:new).with( + private_key: kind_of(OpenSSL::PKey::RSA), + directory: ::Gitlab::LetsEncrypt::Client::STAGING_DIRECTORY_URL + ).and_return(client) + + client + end +end |