heroku_ssl 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/heroku_ssl/version.rb +1 -1
- data/lib/tasks/heroku_ssl_tasks.rake +53 -39
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d4e3a21b54b16213f57de94d699d80b45f2df98
|
4
|
+
data.tar.gz: 4f9b1457ccaa074660fcdc785bede574bea533ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8754c6ddb12f430443ebc9229eb2ad602edd8b76562334a90d5b0424e36357172dd063fffcd0abb4ef26d8430c0f628ea3d1dbfdb47f266169daa73016985c1
|
7
|
+
data.tar.gz: 23e4a7023a8cd8d42187dd18a58c9fbf2057ac6162aaaff234a388c9a4d0b07076a3ff89591f1f029ebb91a38826352e6284a5ffc6c63867cf9fdde2648500d3
|
data/lib/heroku_ssl/version.rb
CHANGED
@@ -1,6 +1,32 @@
|
|
1
|
+
|
1
2
|
namespace :heroku_ssl do
|
2
3
|
|
3
4
|
task :update_certs do
|
5
|
+
update_certs
|
6
|
+
end
|
7
|
+
|
8
|
+
task :generate_certs do
|
9
|
+
email = (ARGV[1] || '').strip
|
10
|
+
email = get_email if email.blank?
|
11
|
+
|
12
|
+
puts "Registering #{email}"
|
13
|
+
HerokuSsl::register email
|
14
|
+
|
15
|
+
domain = ARGV[2..-1]
|
16
|
+
domain = get_domains if domain.blank?
|
17
|
+
|
18
|
+
puts "Authorizing and generating certificates for #{domain}"
|
19
|
+
|
20
|
+
certs = HerokuSsl::request_certificate domain
|
21
|
+
|
22
|
+
if certs.present?
|
23
|
+
STDOUT.puts '~~ GENERATED CERTIFICATES START ~~'
|
24
|
+
STDOUT.puts JSON(certs)
|
25
|
+
STDOUT.puts '~~ GENERATED CERTIFICATES END ~~'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def update_certs
|
4
30
|
STDOUT.puts 'Once your app has been deployed to Heroku, hit enter.'
|
5
31
|
|
6
32
|
STDIN.gets
|
@@ -15,58 +41,46 @@ namespace :heroku_ssl do
|
|
15
41
|
output = heroku_run("run rake heroku_ssl:generate_certs #{email} #{domains} --app #{app}")
|
16
42
|
|
17
43
|
#read out the certs to temporary files
|
18
|
-
|
19
|
-
puts 'Successfully generated certificates! Attempting to update Heroku DNS'
|
20
|
-
|
21
|
-
output = output.split('~~ GENERATED CERTIFICATES START ~~').last
|
22
|
-
.split('~~ GENERATED CERTIFICATES END ~~').first
|
23
|
-
output = JSON(output)
|
24
|
-
|
25
|
-
File.open('fullchain.pem', 'wb') do |file|
|
26
|
-
file.write output['fullchain']
|
27
|
-
end
|
28
|
-
|
29
|
-
File.open('privkey.pem', 'wb') do |file|
|
30
|
-
file.write output['privkey']
|
31
|
-
end
|
32
|
-
|
33
|
-
# update heroku certs
|
34
|
-
heroku_run("certs:update fullchain.pem privkey.pem --app #{get_app} --confirm #{get_app}")
|
35
|
-
|
36
|
-
# clean up
|
37
|
-
File.delete('fullchain.pem', 'privkey.pem')
|
38
|
-
|
39
|
-
puts 'Successfully updated Heroku SSL certificates! Now you just need to make sure your DNS is configured to point as follows: '
|
40
|
-
puts heroku_run('domains').split("\n")[4..-1].join("\n")
|
41
|
-
else
|
44
|
+
unless output.include? '~~ GENERATED CERTIFICATES START ~~'
|
42
45
|
puts 'Full log: '
|
43
46
|
puts output
|
44
47
|
puts ''
|
45
48
|
|
46
49
|
puts 'Could not generate certificates. Please try again later or try running `heroku run rake heroku_ssl:generate_certs` directly'
|
50
|
+
return
|
47
51
|
end
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
email = (ARGV[1] || '').strip
|
53
|
-
email = get_email if email.blank?
|
53
|
+
output = output.split('~~ GENERATED CERTIFICATES START ~~').last
|
54
|
+
.split('~~ GENERATED CERTIFICATES END ~~').first
|
55
|
+
output = JSON(output).with_indifferent_access
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
+
unless output['fullchain'].present? && output['privkey'].present?
|
58
|
+
puts 'Output: '
|
59
|
+
puts output
|
60
|
+
puts ''
|
57
61
|
|
58
|
-
|
59
|
-
|
62
|
+
puts 'Failed to read certificates'
|
63
|
+
return
|
64
|
+
end
|
60
65
|
|
61
|
-
puts
|
66
|
+
puts 'Successfully generated certificates! Attempting to update Heroku DNS'
|
62
67
|
|
63
|
-
|
68
|
+
File.open('fullchain.pem', 'wb') do |file|
|
69
|
+
file.write output['fullchain']
|
70
|
+
end
|
64
71
|
|
65
|
-
|
66
|
-
|
67
|
-
STDOUT.puts JSON(certs)
|
68
|
-
STDOUT.puts '~~ GENERATED CERTIFICATES END ~~'
|
72
|
+
File.open('privkey.pem', 'wb') do |file|
|
73
|
+
file.write output['privkey']
|
69
74
|
end
|
75
|
+
|
76
|
+
# update heroku certs
|
77
|
+
heroku_run("certs:update fullchain.pem privkey.pem --app #{get_app} --confirm #{get_app}")
|
78
|
+
|
79
|
+
# clean up
|
80
|
+
File.delete('fullchain.pem', 'privkey.pem')
|
81
|
+
|
82
|
+
puts 'Successfully updated Heroku SSL certificates! Now you just need to make sure your DNS is configured to point as follows: '
|
83
|
+
puts heroku_run('domains').split("\n")[4..-1].join("\n")
|
70
84
|
end
|
71
85
|
|
72
86
|
def get_email
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_ssl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Marshland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|