letsencrypt_plugin 0.0.5 → 0.0.6

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: 584c41b766b2ed58efa0a578bf0e4ae5d7f444b1
4
- data.tar.gz: a72b7addfbad5cfb0beabc220602a15402402532
3
+ metadata.gz: 970e5b0545fab8204c13aca8399e6807f1602ba6
4
+ data.tar.gz: 2d5439882e197c9a5d13c0b75becbcd6f0f636db
5
5
  SHA512:
6
- metadata.gz: ad38dde675c1b160059ba6a770c52405c8a4752d03dcd1643c699e11322d0a0a097f4f87d42a4d2ad0b9d6182ee04d18fb86a9ff2124df5300acd739c13b17c2
7
- data.tar.gz: b59c01b788b1d4ac3c7e3328bd69f6194f9c05054debcec7f79e13b81073d9bc47ef43d67a87b34b1d09ff1138449cdc7fb8b610f5e2df25c85d270cf88214c4
6
+ metadata.gz: c9290e25b80543791e4a271d0447e5b2b523f846b8cbc684b25be5eba7a8fd9417c0804175474d247773bcfe2142d5716a292597e79db056732e963e0171dcc6
7
+ data.tar.gz: 9b0d082740c97fb5bbe2114cb05870fa864b0372e0579a124b9e9a0d1f1baa160dfe21c2b35b1a3a404ac136f5e12b3b9df2db39fd42b9d10ac52a244f887824
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 lgromanowski
1
+ Copyright 2015 Lukasz Gromanowski <lgromanowski@gmail.com>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,3 +1,3 @@
1
1
  module LetsencryptPlugin
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -57,8 +57,8 @@ task :letsencrypt_plugin => :setup_logger do
57
57
  ch.update(:response => challenge.file_content)
58
58
  end
59
59
  sleep(2)
60
- end
61
-
60
+ end
61
+
62
62
  def wait_for_status(challenge)
63
63
  Rails.logger.info("Waiting for challenge status...")
64
64
  counter = 0
@@ -70,17 +70,37 @@ task :letsencrypt_plugin => :setup_logger do
70
70
 
71
71
  def create_csr
72
72
  Rails.logger.info("Creating CSR...")
73
- Acme::CertificateRequest.new(names: [ CONFIG[:domain] ])
73
+ Acme::Client::CertificateRequest.new(names: [ CONFIG[:domain] ])
74
74
  end
75
75
 
76
76
  # Save the certificate and key
77
77
  def save_certificate(certificate)
78
78
  if !certificate.nil?
79
- Rails.logger.info("Saving certificates and key...")
80
- File.write(File.join(CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-cert.pem"), certificate.to_pem)
81
- File.write(File.join(CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-key.pem"), certificate.request.private_key.to_pem)
82
- File.write(File.join(CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-chain.pem"), certificate.chain_to_pem)
83
- File.write(File.join(CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-fullchain.pem"), certificate.fullchain_to_pem)
79
+ if !ENV['DYNO'].nil?
80
+ Rails.logger.info('You are running this script on Heroku, please copy-paste certificates to your local machine')
81
+ Rails.logger.info('and then follow https://devcenter.heroku.com/articles/ssl-endpoint guide:')
82
+
83
+ Rails.logger.info("====== #{CONFIG[:domain]}-cert.pem ======")
84
+ puts certificate.to_pem
85
+
86
+ Rails.logger.info("====== #{CONFIG[:domain]}-key.pem ======")
87
+ puts certificate.request.private_key.to_pem
88
+
89
+ Rails.logger.info("====== #{CONFIG[:domain]}-chain.pem ======")
90
+ puts certificate.chain_to_pem
91
+
92
+ Rails.logger.info("====== #{CONFIG[:domain]}-fullchain.pem ======")
93
+ puts certificate.fullchain_to_pem
94
+
95
+ elsif File.directory?(File.join(Rails.root, CONFIG[:output_cert_dir]))
96
+ Rails.logger.info("Saving certificates and key...")
97
+ File.write(File.join(Rails.root, CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-cert.pem"), certificate.to_pem)
98
+ File.write(File.join(Rails.root, CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-key.pem"), certificate.request.private_key.to_pem)
99
+ File.write(File.join(Rails.root, CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-chain.pem"), certificate.chain_to_pem)
100
+ File.write(File.join(Rails.root, CONFIG[:output_cert_dir], "#{CONFIG[:domain]}-fullchain.pem"), certificate.fullchain_to_pem)
101
+ else
102
+ Rails.logger.error("Output directory: '#{File.join(Rails.root, CONFIG[:output_cert_dir])}' does not exist!")
103
+ end
84
104
  end
85
105
  end
86
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letsencrypt_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukasz Gromanowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2016-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 2.4.8
173
+ rubygems_version: 2.5.1
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Let's encrypt plugin for Ruby on Rails applications