certmaker 0.0.5 → 0.0.6
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.
- data/bin/certmaker +50 -35
- metadata +28 -20
data/bin/certmaker
CHANGED
|
@@ -28,7 +28,7 @@ begin
|
|
|
28
28
|
latest_documentation_info
|
|
29
29
|
exit 0
|
|
30
30
|
when "--version"
|
|
31
|
-
puts "certmaker v0.0.
|
|
31
|
+
puts "certmaker v0.0.6"
|
|
32
32
|
exit 0
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -40,7 +40,7 @@ end
|
|
|
40
40
|
@exe_filepath = File.expand_path(__FILE__)
|
|
41
41
|
@command = ARGV[0]
|
|
42
42
|
|
|
43
|
-
@commands = ['create', 'unpack_namecheap', '
|
|
43
|
+
@commands = ['create', 'unpack_namecheap', 'append_chain', 'check_chain', 'upload_to_heroku', 'heroku_wizard'] # 'assemble_chain'
|
|
44
44
|
|
|
45
45
|
unless @commands.include? @command
|
|
46
46
|
puts "
|
|
@@ -117,10 +117,9 @@ def create_wip_dirs
|
|
|
117
117
|
@dir1 ="#{@cert_dir}/1_my_key_and_csr"
|
|
118
118
|
@dir2 = "#{@cert_dir}/2_ssl_provider_artifacts"
|
|
119
119
|
@dir2_zips = "#{@dir2}/zips"
|
|
120
|
-
@dir3 = "#{@cert_dir}/
|
|
121
|
-
@dir4 = "#{@cert_dir}/4_key_and_cert_nopass_chained"
|
|
120
|
+
@dir3 = "#{@cert_dir}/3_key_and_cert_chained"
|
|
122
121
|
|
|
123
|
-
[@dir1, @dir2_zips, @dir3
|
|
122
|
+
[@dir1, @dir2_zips, @dir3].each do |dir|
|
|
124
123
|
FileUtils.mkdir_p dir
|
|
125
124
|
end
|
|
126
125
|
|
|
@@ -130,10 +129,6 @@ def private_key_filepath
|
|
|
130
129
|
"#{@dir1}/#{@common_name}.key"
|
|
131
130
|
end
|
|
132
131
|
|
|
133
|
-
def private_key_nopass_filepath
|
|
134
|
-
"#{@dir3}/#{@common_name}.nopass.key"
|
|
135
|
-
end
|
|
136
|
-
|
|
137
132
|
def csr_filepath
|
|
138
133
|
"#{@dir1}/#{@common_name}.csr"
|
|
139
134
|
end
|
|
@@ -146,12 +141,8 @@ def crt_filepath
|
|
|
146
141
|
end
|
|
147
142
|
end
|
|
148
143
|
|
|
149
|
-
def
|
|
150
|
-
"#{@dir3}/#{underscored_name}.
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def cert_nopass_chained_filepath
|
|
154
|
-
"#{@dir4}/#{underscored_name}_chained.nopass.pem"
|
|
144
|
+
def cert_chained_filepath
|
|
145
|
+
"#{@dir3}/#{underscored_name}_chained.pem"
|
|
155
146
|
end
|
|
156
147
|
|
|
157
148
|
def generate_private_key
|
|
@@ -245,7 +236,6 @@ If your certs don't come in a zip file or your prefer to extract them manually b
|
|
|
245
236
|
Once unpacked, you now have obtained your certs. Next up you can do any of the following as needed
|
|
246
237
|
|
|
247
238
|
#{PROGRAM_NAME} heroku_wizard #{@common_name}
|
|
248
|
-
#{PROGRAM_NAME} remove_passphrases #{@common_name}
|
|
249
239
|
#{PROGRAM_NAME} append_chain #{@common_name}
|
|
250
240
|
#{PROGRAM_NAME} check_chain #{@common_name}
|
|
251
241
|
#{PROGRAM_NAME} upload_to_heroku #{@common_name}
|
|
@@ -265,17 +255,6 @@ def unpack_namecheap
|
|
|
265
255
|
end
|
|
266
256
|
|
|
267
257
|
|
|
268
|
-
def remove_passphrases
|
|
269
|
-
instruct "Removing passphrase (if any)"
|
|
270
|
-
|
|
271
|
-
# Suppress error output, private key may not exist
|
|
272
|
-
puts `openssl rsa -in #{crt_filepath} -out #{cert_nopass_filepath} 2> /dev/null`
|
|
273
|
-
|
|
274
|
-
puts `openssl x509 -in #{crt_filepath} >> #{cert_nopass_filepath}`
|
|
275
|
-
|
|
276
|
-
puts `openssl rsa -in #{private_key_filepath} -out #{private_key_nopass_filepath}`
|
|
277
|
-
end
|
|
278
|
-
|
|
279
258
|
def chain_files_in_order
|
|
280
259
|
@config['ordered_chain_filenames'].map{ |filename|
|
|
281
260
|
"#{@dir2}/#{filename}"
|
|
@@ -285,7 +264,7 @@ end
|
|
|
285
264
|
def append_chain
|
|
286
265
|
instruct "Appending intermediate chain to cert"
|
|
287
266
|
|
|
288
|
-
`cat #{
|
|
267
|
+
`cat #{crt_filepath} #{chain_files_in_order} > #{cert_chained_filepath}`
|
|
289
268
|
end
|
|
290
269
|
|
|
291
270
|
def check_chain
|
|
@@ -296,9 +275,11 @@ def check_chain
|
|
|
296
275
|
exit 1
|
|
297
276
|
end
|
|
298
277
|
|
|
299
|
-
instruct "Checking chain. The issuer of the first should be the subject of the second. And so on. Is that how the following output looks
|
|
278
|
+
instruct "Checking chain. The issuer of the first should be the subject of the second. And so on. Is that how the following output looks...
|
|
300
279
|
|
|
301
|
-
|
|
280
|
+
"
|
|
281
|
+
|
|
282
|
+
puts `perl -n0777e 'map { print "---\n"; open(CMD, "| openssl x509 -noout -subject -issuer"); print CMD; close(CMD) } /^-----BEGIN.*?^-----END.*?\n/gsm' #{cert_chained_filepath}`
|
|
302
283
|
end
|
|
303
284
|
|
|
304
285
|
def upload_to_heroku
|
|
@@ -306,7 +287,35 @@ def upload_to_heroku
|
|
|
306
287
|
puts "What is your heroku app name?"
|
|
307
288
|
app_name = STDIN.gets.chomp
|
|
308
289
|
|
|
309
|
-
cmd = "heroku
|
|
290
|
+
cmd = "heroku addons:add ssl:endpoint --app #{app_name}"
|
|
291
|
+
|
|
292
|
+
puts "
|
|
293
|
+
You should read the heroku ssl guide before continuing at...
|
|
294
|
+
|
|
295
|
+
https://devcenter.heroku.com/articles/ssl-endpoint
|
|
296
|
+
|
|
297
|
+
Now, we will add the SSL addon to your app (#{app_name}) on heroku in case you have not already done so.
|
|
298
|
+
|
|
299
|
+
This will run the command
|
|
300
|
+
|
|
301
|
+
#{cmd}
|
|
302
|
+
|
|
303
|
+
"
|
|
304
|
+
|
|
305
|
+
continue_prompt
|
|
306
|
+
puts "Trying to add the SSL addon to #{app_name}...
|
|
307
|
+
"
|
|
308
|
+
|
|
309
|
+
puts `#{cmd}`
|
|
310
|
+
puts "
|
|
311
|
+
Please note, if the last step failed because you have already have the heroku SSL addon installed, then that is okay. You can continue.
|
|
312
|
+
|
|
313
|
+
"
|
|
314
|
+
|
|
315
|
+
continue_prompt
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
cmd = "heroku certs:add #{cert_chained_filepath} #{private_key_filepath} --app #{app_name}"
|
|
310
319
|
|
|
311
320
|
puts "
|
|
312
321
|
Please ensure that you have a Custom Domain for #{@common_name} setup on your Heroku app before continuing.
|
|
@@ -322,7 +331,7 @@ If anything goes wrong at this stage you can simply run the following command to
|
|
|
322
331
|
"
|
|
323
332
|
|
|
324
333
|
continue_prompt
|
|
325
|
-
puts '
|
|
334
|
+
puts 'Trying to upload cert to heroku...'
|
|
326
335
|
|
|
327
336
|
puts `#{cmd}`
|
|
328
337
|
end
|
|
@@ -339,11 +348,17 @@ when 'create'
|
|
|
339
348
|
create
|
|
340
349
|
when 'unpack_namecheap'
|
|
341
350
|
unpack_namecheap
|
|
342
|
-
when 'remove_passphrases'
|
|
343
|
-
remove_passphrases
|
|
344
351
|
when 'heroku_wizard'
|
|
345
|
-
remove_passphrases
|
|
346
352
|
append_chain
|
|
353
|
+
check_chain
|
|
354
|
+
puts "
|
|
355
|
+
-----------------------------------------------------------------
|
|
356
|
+
Does the above output look correct? It's important to check this!
|
|
357
|
+
You will thank me in the long run :)
|
|
358
|
+
-----------------------------------------------------------------
|
|
359
|
+
|
|
360
|
+
"
|
|
361
|
+
continue_prompt
|
|
347
362
|
upload_to_heroku
|
|
348
363
|
when 'append_chain'
|
|
349
364
|
append_chain
|
metadata
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: certmaker
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.5
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
5
4
|
prerelease:
|
|
5
|
+
version: 0.0.6
|
|
6
6
|
platform: ruby
|
|
7
|
-
authors:
|
|
7
|
+
authors:
|
|
8
8
|
- Declan McGrath
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
date: 2012-07-11 00:00:00 Z
|
|
13
14
|
dependencies: []
|
|
15
|
+
|
|
14
16
|
description: Easy way to make SSL Certs suitable for cloud platforms
|
|
15
|
-
email: declan@
|
|
16
|
-
executables:
|
|
17
|
+
email: declan@weuseopensource.com
|
|
18
|
+
executables:
|
|
17
19
|
- certmaker
|
|
18
20
|
extensions: []
|
|
21
|
+
|
|
19
22
|
extra_rdoc_files: []
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
files:
|
|
21
25
|
- bin/certmaker
|
|
22
26
|
- samples/config.yml
|
|
23
27
|
- LICENSE
|
|
@@ -25,26 +29,30 @@ files:
|
|
|
25
29
|
- history.txt
|
|
26
30
|
homepage: http://rubygems.org/gems/certmaker
|
|
27
31
|
licenses: []
|
|
32
|
+
|
|
28
33
|
post_install_message:
|
|
29
34
|
rdoc_options: []
|
|
30
|
-
|
|
35
|
+
|
|
36
|
+
require_paths:
|
|
31
37
|
- lib
|
|
32
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
39
|
none: false
|
|
34
|
-
requirements:
|
|
35
|
-
- -
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version:
|
|
38
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0"
|
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
45
|
none: false
|
|
40
|
-
requirements:
|
|
41
|
-
- -
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version:
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: "0"
|
|
44
50
|
requirements: []
|
|
51
|
+
|
|
45
52
|
rubyforge_project:
|
|
46
|
-
rubygems_version: 1.
|
|
53
|
+
rubygems_version: 1.7.2
|
|
47
54
|
signing_key:
|
|
48
55
|
specification_version: 3
|
|
49
56
|
summary: Make SSL Certs suitable for cloud platforms
|
|
50
57
|
test_files: []
|
|
58
|
+
|