Class: Jekyll::Gitlab::Letsencrypt::Acme

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/gitlab/letsencrypt/acme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#registrationObject

Returns the value of attribute registration.



11
12
13
# File 'lib/jekyll/gitlab/letsencrypt/acme.rb', line 11

def registration
  @registration
end

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/jekyll/gitlab/letsencrypt/acme.rb', line 20

def authorized?
  authorization.status == 'valid'
end

#challengeObject



24
25
26
# File 'lib/jekyll/gitlab/letsencrypt/acme.rb', line 24

def challenge
  @challenge ||= authorization.http01
end

#clientObject



28
29
30
31
32
33
# File 'lib/jekyll/gitlab/letsencrypt/acme.rb', line 28

def client
  @client ||= begin
    private_key = OpenSSL::PKey::RSA.new(4096)
    ::Acme::Client.new private_key: private_key, endpoint: endpoint, connection_options: { request: { open_timeout: 5, timeout: 5 } }
  end
end

#register!Object



13
14
15
16
17
18
# File 'lib/jekyll/gitlab/letsencrypt/acme.rb', line 13

def register!
  Jekyll.logger.info "Registering #{email} to #{endpoint}..."
  @registration = client.register contact: "mailto:#{email}"
  @registration.agree_terms
  self
end