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
152 153 154 |
# File 'lib/acmesmith/command.rb', line 152 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
147 148 149 |
# File 'lib/acmesmith/command.rb', line 147 def autorenew(*common_names) client.autorenew(days: [:days], common_names: common_names.empty? ? nil : common_names) end |
#current(common_name) ⇒ Object
67 68 69 |
# File 'lib/acmesmith/command.rb', line 67 def current(common_name) puts client.current(common_name) end |
#list(common_name = nil) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/acmesmith/command.rb', line 58 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
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/acmesmith/command.rb', line 38 def order(common_name, *sans) cert = client.order( common_name, *sans, key_type: [:key_type], rsa_key_size: [:rsa_key_size], elliptic_curve: [:elliptic_curve], ) if [:show_certificate] puts cert.certificate.to_text puts cert.certificate.to_pem end end |
#post_issue_hooks(common_name) ⇒ Object
52 53 54 |
# File 'lib/acmesmith/command.rb', line 52 def post_issue_hooks(common_name) client.post_issue_hooks(common_name) end |
#register(contact) ⇒ Object
157 158 159 160 161 162 163 164 165 |
# File 'lib/acmesmith/command.rb', line 157 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
169 170 171 172 173 174 175 176 177 |
# File 'lib/acmesmith/command.rb', line 169 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
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/acmesmith/command.rb', line 114 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
85 86 87 |
# File 'lib/acmesmith/command.rb', line 85 def save_certificate(common_name) client.save_certificate(common_name, version: [:version], mode: [:mode], output: [:output], type: [:type]) end |
#save_pkcs12(common_name) ⇒ Object
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/acmesmith/command.rb', line 134 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
100 101 102 |
# File 'lib/acmesmith/command.rb', line 100 def save_private_key(common_name) client.save_private_key(common_name, version: [:version], mode: [:mode], output: [:output]) end |
#show_certificate(common_name) ⇒ Object
74 75 76 77 |
# File 'lib/acmesmith/command.rb', line 74 def show_certificate(common_name) certs = client.get_certificate(common_name, version: [:version], type: [:type]) puts certs end |
#show_private_key(common_name) ⇒ Object
91 92 93 |
# File 'lib/acmesmith/command.rb', line 91 def show_private_key(common_name) puts client.get_private_key(common_name, version: [:version]) end |