diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-06-06 21:55:31 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-06 21:55:31 +0300 |
commit | c3338c920d6123174000ea11243cb7dc285cee03 (patch) | |
tree | 018ca45fb1ce2b02f9a513321c05fc7a4440abce /lib/gitlab/lets_encrypt | |
parent | 68a1ba6a296f340fcddf58e5fbd26d51d66bd90b (diff) |
Add pages domains acme orders
Extract acme double to helper
Create ACME challanges for pages domains
* Create order & challange through API
* save them to database
* request challenge validation
We're saving order and challenge as one entity,
that wouldn't be correct if we would order certificates for
several domains simultaneously, but we always order certificate
per domain
Add controller for processing acme challenges redirected from pages
Don't save acme challenge url - we don't use it
Validate acme challenge attributes
Encrypt private_key in acme orders
Diffstat (limited to 'lib/gitlab/lets_encrypt')
-rw-r--r-- | lib/gitlab/lets_encrypt/challenge.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/lets_encrypt/order.rb | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/lets_encrypt/challenge.rb b/lib/gitlab/lets_encrypt/challenge.rb index 6a7f5e965c5..136268c974b 100644 --- a/lib/gitlab/lets_encrypt/challenge.rb +++ b/lib/gitlab/lets_encrypt/challenge.rb @@ -7,7 +7,7 @@ module Gitlab @acme_challenge = acme_challenge end - delegate :url, :token, :file_content, :status, :request_validation, to: :acme_challenge + delegate :token, :file_content, :status, :request_validation, to: :acme_challenge private diff --git a/lib/gitlab/lets_encrypt/order.rb b/lib/gitlab/lets_encrypt/order.rb index 5109b5e9843..9c2365f98a8 100644 --- a/lib/gitlab/lets_encrypt/order.rb +++ b/lib/gitlab/lets_encrypt/order.rb @@ -13,7 +13,16 @@ module Gitlab ::Gitlab::LetsEncrypt::Challenge.new(challenge) end - delegate :url, :status, to: :acme_order + def request_certificate(domain:, private_key:) + csr = ::Acme::Client::CertificateRequest.new( + private_key: OpenSSL::PKey.read(private_key), + subject: { common_name: domain } + ) + + acme_order.finalize(csr: csr) + end + + delegate :url, :status, :expires, :certificate, to: :acme_order private |