class Acmesmith::Command
Public Instance Methods
add_san(common_name, *add_sans)
click to toggle source
# File lib/acmesmith/command.rb, line 144 def add_san(common_name, *add_sans) client.add_san(common_name, *add_sans) end
autorenew(*common_names)
click to toggle source
# File lib/acmesmith/command.rb, line 139 def autorenew(*common_names) client.autorenew(days: options[:days], common_names: common_names.empty? ? nil : common_names) end
current(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 59 def current(common_name) puts client.current(common_name) end
list(common_name = nil)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/acmesmith/command.rb, line 35 def order(common_name, *sans) cert = client.order(common_name, *sans) if options[:show_certificate] puts cert.certificate.to_text puts cert.certificate.to_pem end end
post_issue_hooks(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 44 def post_issue_hooks(common_name) client.post_issue_hooks(common_name) end
register(contact)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/acmesmith/command.rb, line 106 def save(common_name) client.save( common_name, version: options[:version], key_mode: options[:key_mode], certificate_mode: options[:certificate_mode], version_file: options[:version_file], key_file: options[:key_file], fullchain_file: options[:fullchain_file], chain_file: options[:chain_file], certificate_file: options[:certificate_file], atomic: options[:atomic], verbose: true, ) end
save_certificate(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 77 def save_certificate(common_name) client.save_certificate(common_name, version: options[:version], mode: options[:mode], output: options[:output], type: options[:type]) end
save_pkcs12(common_name)
click to toggle source
# 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: options[:version], mode: options[:mode], output: options[:output], passphrase: passphrase) end
save_private_key(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 92 def save_private_key(common_name) client.save_private_key(common_name, version: options[:version], mode: options[:mode], output: options[:output]) end
show_certificate(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 66 def show_certificate(common_name) certs = client.get_certificate(common_name, version: options[:version], type: options[:type]) puts certs end
show_private_key(common_name)
click to toggle source
# File lib/acmesmith/command.rb, line 83 def show_private_key(common_name) puts client.get_private_key(common_name, version: options[:version]) end
Private Instance Methods
client()
click to toggle source
# File lib/acmesmith/command.rb, line 173 def client config = Config.load_yaml(options[:config]) config.merge!("passphrase_from_env" => options[:passphrase_from_env]) unless options[:passphrase_from_env].nil? @client = Client.new(config: config) end