Class/Module Index [+]

Quicksearch

Heroku::Command::Certs

manage ssl endpoints for an app

Constants

SSL_DOCTOR

Public Instance Methods

add() click to toggle source

certs:add CRT KEY

Add an ssl endpoint to an app.

--bypass                 # bypass the trust chain completion step
# File lib/heroku/command/certs.rb, line 73
def add
  crt, key = read_crt_and_key
  endpoint = action("Adding SSL Endpoint to #{app}") { heroku.ssl_endpoint_add(app, crt, key) }
  display_warnings(endpoint)
  display "#{app} now served by #{endpoint['cname']}"
  display "Certificate details:"
  display_certificate_info(endpoint)
rescue UsageError
  fail("Usage: heroku certs:add CRT KEY\nMust specify CRT and KEY to add cert.")
end
chain() click to toggle source

certs:chain CRT [CRT …]

Print the ordered and complete chain for the given certificate.

Optional intermediate certificates may be given too, and will be used during chain resolution.

# File lib/heroku/command/certs.rb, line 47
def chain
  puts read_crt_through_ssl_doctor
rescue UsageError
  fail("Usage: heroku certs:chain CRT [CRT ...]\nMust specify at least one certificate file.")
end
index() click to toggle source

certs

List ssl endpoints for an app.

# File lib/heroku/command/certs.rb, line 15
def index
  endpoints = heroku.ssl_endpoint_list(app)

  if endpoints.empty?
    display "#{app} has no SSL Endpoints."
    display "Use `heroku certs:add CRT KEY` to add one."
  else
    endpoints.map! do |endpoint|
      ssl_cert_attributes = {}
      if cert = endpoint['ssl_cert']
        ssl_cert_attributes.merge!(
          'domains'    => cert['cert_domains'].join(', '),
          'expires_at' => format_date(cert['expires_at']),
          'ca_signed?' => cert['ca_signed?'].to_s.capitalize)
      end
      { 'cname' => endpoint['cname'] }.merge(ssl_cert_attributes)
    end
    display_table(
      endpoints,
      %( cname domains expires_at ca_signed? ),
      [ "Endpoint", "Common Name(s)", "Expires", "Trusted" ]
    )
  end
end
info() click to toggle source

certs:info

Show certificate information for an ssl endpoint.

-e, --endpoint ENDPOINT  # name of the endpoint to check info on
# File lib/heroku/command/certs.rb, line 110
def info
  cname = options[:endpoint] || current_endpoint
  endpoint = action("Fetching SSL Endpoint #{cname} info for #{app}") do
    heroku.ssl_endpoint_info(app, cname)
  end

  display "Certificate details:"
  display_certificate_info(endpoint)
end
key() click to toggle source

certs:key CRT KEY [KEY …]

Print the correct key for the given certificate.

You must pass one single certificate, and one or more keys. The first key that signs the certificate will be printed back.

# File lib/heroku/command/certs.rb, line 60
def key
  crt, key = read_crt_and_key_through_ssl_doctor("Testing for signing key")
  puts key
rescue UsageError
  fail("Usage: heroku certs:key CRT KEY [KEY ...]\nMust specify one certificate file and at least one key file.")
end
remove() click to toggle source

certs:remove

Remove an SSL Endpoint from an app.

-e, --endpoint ENDPOINT  # name of the endpoint to remove
# File lib/heroku/command/certs.rb, line 126
def remove
  cname = options[:endpoint] || current_endpoint
  message = "WARNING: Potentially Destructive Action\nThis command will remove the endpoint #{cname} from #{app}."
  return unless confirm_command(app, message)
  action("Removing SSL Endpoint #{cname} from #{app}") do
    heroku.ssl_endpoint_remove(app, cname)
  end
  display "NOTE: Billing is still active. Remove SSL Endpoint add-on to stop billing."
end
rollback() click to toggle source

certs:rollback

Rollback an SSL Endpoint for an app.

-e, --endpoint ENDPOINT  # name of the endpoint to rollback
# File lib/heroku/command/certs.rb, line 142
def rollback
  cname = options[:endpoint] || current_endpoint

  message = "WARNING: Potentially Destructive Action\nThis command will rollback the certificate of endpoint #{cname} on #{app}."
  return unless confirm_command(app, message)

  endpoint = action("Rolling back SSL Endpoint #{cname} for #{app}") do
    heroku.ssl_endpoint_rollback(app, cname)
  end

  display "New active certificate details:"
  display_certificate_info(endpoint)
end
update() click to toggle source

certs:update CRT KEY

Update an SSL Endpoint on an app.

--bypass                 # bypass the trust chain completion step
-e, --endpoint ENDPOINT  # name of the endpoint to update
# File lib/heroku/command/certs.rb, line 91
def update
  crt, key = read_crt_and_key
  cname    = options[:endpoint] || current_endpoint
  message = "WARNING: Potentially Destructive Action\nThis command will change the certificate of endpoint #{cname} on #{app}."
  return unless confirm_command(app, message)
  endpoint = action("Updating SSL Endpoint #{cname} for #{app}") { heroku.ssl_endpoint_update(app, cname, crt, key) }
  display_warnings(endpoint)
  display "Updated certificate details:"
  display_certificate_info(endpoint)
rescue UsageError
  fail("Usage: heroku certs:update CRT KEY\nMust specify CRT and KEY to update cert.")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.