letsencrypt_standalone 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a34ce84d9d02c67824c9e89d2697ec3ea0f84500
4
- data.tar.gz: da79874d967783d1a660e1907600142aeddf379c
3
+ metadata.gz: a1dc96b4eddbd583b7141881bf3aec8b2fbd2c5c
4
+ data.tar.gz: 79e7a69e16ed018ea89d5bbd1f7f7d982397a201
5
5
  SHA512:
6
- metadata.gz: b24861c717cce83fa553e5328418bcbbcd4f850ec912018e226dd2a3b15d501975c6c6f57218dde112e0d9409e457d1cebc02ad339abcc79d5bdb3053b6501dc
7
- data.tar.gz: abad761a0596aa684d4166cca97d1adeffeb7e22c9c0ca9b07ad4f57ac41c9e84a439f286e053194122a0981f40a0362b762292050da9807bbcaf23aaddfd7b7
6
+ metadata.gz: 0148cb5a4d77bebd9223279ff9c72d7bf93521a9140b7603abfb19f646807a2b691b9a0a6ba4e87a83e401329e168c81decdd29cda62d76944b56c313789e6a0
7
+ data.tar.gz: 3fc433da6910407d43a4c74d87dcedce87b0cb76fbef33440a5cde563aeccd93d850beb02c66b9fe45cc55b808de1334e9d5c18c0ff2f30c43c76d16ffc73428
data/exe/le_standalone CHANGED
@@ -71,7 +71,7 @@ begin
71
71
  config.domains.each do |params|
72
72
  domain = LetsencryptStandalone::Domain.new(params: params)
73
73
  config.push_private_key_name(domain: domain)
74
-
74
+ binding.pry if domain[:host] == "www.planetpass.io"
75
75
  if domain.certificates
76
76
  certificate = LetsencryptStandalone::Certificate.new(client: client.acme_client, domain: domain)
77
77
  next if !certificate.needs_refresh?
@@ -87,7 +87,7 @@ begin
87
87
  status = domain.verify_status
88
88
  if status == 'valid'
89
89
  logger.info "Verified #{domain.host} challenge. Obtaining certificate."
90
- certificate ||= LetsencryptStandalone::Certificate.new(client: client.acme_client, domain: domain)
90
+ certificate = LetsencryptStandalone::Certificate.new(client: client.acme_client, domain: domain)
91
91
  .obtain_new
92
92
 
93
93
  certificate.save
@@ -15,10 +15,11 @@ module LetsencryptStandalone
15
15
  attr_reader :files
16
16
 
17
17
  def initialize(domain:, client:)
18
- @files = domain.certificates || @@default_names
19
- @domain = domain.host
20
- @client = client
21
- @private_key = domain.private_key
18
+ @certificate = domain.certificates[:certificate]
19
+ @files = domain.files || @@default_names
20
+ @domain = domain.host
21
+ @client = client
22
+ @private_key = domain.private_key
22
23
  end
23
24
 
24
25
  def obtain_new
@@ -28,8 +29,7 @@ module LetsencryptStandalone
28
29
  end
29
30
 
30
31
  def needs_refresh?
31
- cert = @files[:certificate]
32
- if cert.not_after > Time.now + 2*24*3600
32
+ if @certificate.not_after > Time.now + 2*24*3600
33
33
  logger.info("It doesnt need to refresh cert for domain: #{@domain}")
34
34
  false
35
35
  else
@@ -4,7 +4,7 @@ require 'fileutils'
4
4
 
5
5
  module LetsencryptStandalone
6
6
  class Domain < Base
7
- attr_accessor :host, :private_key, :certificates
7
+ attr_accessor :host, :private_key, :certificates, :files
8
8
  attr_reader :private_key_name, :private_key_path
9
9
 
10
10
  @@default_private_key_name = 'private_key.pem'
@@ -13,9 +13,9 @@ module LetsencryptStandalone
13
13
  @host = params.fetch(:host)
14
14
  @private_key_name = params.fetch(:private_key, @@default_private_key_name)
15
15
  @private_key_path = File.join(output_dir,@host, @private_key_name)
16
-
16
+ @files = params[:certificates]
17
17
  if params.has_key? :certificates
18
- load_certs(params)
18
+ load_certs
19
19
  end
20
20
  load_private_key
21
21
  end
@@ -68,9 +68,9 @@ module LetsencryptStandalone
68
68
  File.new(@private_key_path, 'w').write(@private_key.to_pem)
69
69
  end
70
70
 
71
- def load_certs(params)
71
+ def load_certs
72
72
  @certificates = {}
73
- params[:certificates].each do |type, file|
73
+ files.each do |type, file|
74
74
  cert = OpenSSL::X509::Certificate.new(File.read(File.join(host_dir, file)))
75
75
  @certificates[type] = cert
76
76
  logger.info "Trying to use existing cert #{type} for #{@host}"
@@ -1,3 +1,3 @@
1
1
  module LetsencryptStandalone
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letsencrypt_standalone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grigory Aksentyev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler