Class: Acmesmith::Command
- Inherits:
-
Thor
- Object
- Thor
- Acmesmith::Command
- Defined in:
- lib/acmesmith/command.rb
Instance Method Summary collapse
- #add_san(common_name, *add_sans) ⇒ Object
- #authorize(*domains) ⇒ Object
- #autorenew(*common_names) ⇒ Object
- #current(common_name) ⇒ Object
- #list(common_name = nil) ⇒ Object
- #new_account(contact) ⇒ Object
- #order(common_name, *sans) ⇒ Object
- #post_issue_hooks(common_name) ⇒ Object
- #register(contact) ⇒ Object
- #request(common_name, *sans) ⇒ Object
- #save(common_name) ⇒ Object
- #save_certificate(common_name) ⇒ Object
- #save_pkcs12(common_name) ⇒ Object
- #save_private_key(common_name) ⇒ Object
- #show_certificate(common_name) ⇒ Object
- #show_private_key(common_name) ⇒ Object
Instance Method Details
#add_san(common_name, *add_sans) ⇒ Object
144 145 146 |
# File 'lib/acmesmith/command.rb', line 144 def add_san(common_name, *add_sans) client.add_san(common_name, *add_sans) end |
#authorize(*domains) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/acmesmith/command.rb', line 20 def (*domains) warn "! WARNING: 'acmesmith authorize' is not available" warn "!" warn "! TL;DR: Go ahead; Just run 'acmesmith order'." warn "!" warn "! Pre-authorization have not implemented yet in acme-client.gem (v2) library." warn "! But, required domain authorizations will be performed automatically when ordering a certificate." warn "!" warn "! Pro Tips: Let's encrypt doesn't provide pre-authorization as of May 18, 2018." warn "!" # client.authorize(*domains) end |
#autorenew(*common_names) ⇒ Object
139 140 141 |
# File 'lib/acmesmith/command.rb', line 139 def autorenew(*common_names) client.autorenew(days: [:days], common_names: common_names.empty? ? nil : common_names) end |
#current(common_name) ⇒ Object
59 60 61 |
# File 'lib/acmesmith/command.rb', line 59 def current(common_name) puts client.current(common_name) end |
#list(common_name = nil) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/acmesmith/command.rb', line 50 def list(common_name = nil) if common_name puts client.certificate_versions(common_name) else puts client.certificates_list end end |
#new_account(contact) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/acmesmith/command.rb', line 12 def new_account(contact) puts "=> Creating an account ..." key = client.new_account(contact) puts "=> Public Key:" puts "\n#{key.private_key.public_key.to_pem}" end |
#order(common_name, *sans) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/acmesmith/command.rb', line 35 def order(common_name, *sans) cert = client.order(common_name, *sans) if [:show_certificate] puts cert.certificate.to_text puts cert.certificate.to_pem end end |
#post_issue_hooks(common_name) ⇒ Object
44 45 46 |
# File 'lib/acmesmith/command.rb', line 44 def post_issue_hooks(common_name) client.post_issue_hooks(common_name) end |
#register(contact) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/acmesmith/command.rb', line 149 def register(contact) warn "!" warn "! DEPRECATION WARNING: Use 'acmesmith new-account' command" warn "! There is no user-facing breaking changes. It takes the same arguments with 'acmesmith register'." warn "!" warn "! This is due to change in semantics of ACME v2. ACME v2 defines 'new-account' instead of 'register' in v1." warn "!" new_account(contact) end |
#request(common_name, *sans) ⇒ Object
161 162 163 164 165 166 167 168 169 |
# File 'lib/acmesmith/command.rb', line 161 def request(common_name, *sans) warn "!" warn "! DEPRECATION WARNING: Use 'acmesmith order' command" warn "! There is no user-facing breaking changes. It takes the same arguments with 'acmesmith request'." warn "!" warn "! This is due to change in semantics of ACME v2. ACME v2 defines 'order' instead of 'request' in v1." warn "!" order(common_name, *sans) end |
#save(common_name) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/acmesmith/command.rb', line 106 def save(common_name) client.save( common_name, version: [:version], key_mode: [:key_mode], certificate_mode: [:certificate_mode], version_file: [:version_file], key_file: [:key_file], fullchain_file: [:fullchain_file], chain_file: [:chain_file], certificate_file: [:certificate_file], atomic: [:atomic], verbose: true, ) end |
#save_certificate(common_name) ⇒ Object
77 78 79 |
# File 'lib/acmesmith/command.rb', line 77 def save_certificate(common_name) client.save_certificate(common_name, version: [:version], mode: [:mode], output: [:output], type: [:type]) end |
#save_pkcs12(common_name) ⇒ Object
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/acmesmith/command.rb', line 126 def save_pkcs12(common_name) print 'Passphrase: ' passphrase = $stdin.noecho { $stdin.gets }.chomp print "\nPassphrase (confirm): " passphrase2 = $stdin.noecho { $stdin.gets }.chomp puts raise ArgumentError, "Passphrase doesn't match" if passphrase != passphrase2 client.save_pkcs12(common_name, version: [:version], mode: [:mode], output: [:output], passphrase: passphrase) end |
#save_private_key(common_name) ⇒ Object
92 93 94 |
# File 'lib/acmesmith/command.rb', line 92 def save_private_key(common_name) client.save_private_key(common_name, version: [:version], mode: [:mode], output: [:output]) end |
#show_certificate(common_name) ⇒ Object
66 67 68 69 |
# File 'lib/acmesmith/command.rb', line 66 def show_certificate(common_name) certs = client.get_certificate(common_name, version: [:version], type: [:type]) puts certs end |
#show_private_key(common_name) ⇒ Object
83 84 85 |
# File 'lib/acmesmith/command.rb', line 83 def show_private_key(common_name) puts client.get_private_key(common_name, version: [:version]) end |