How to get ssl certificate private key?

Is there a way to get the generated certificate private key from inside an app?

My use case is to use the certificate for STARTLS in an SMTP server

Hi Tommaso, we don’t make the TLS private keys available to access. You could use something like lets encrypt to provision certificates for the SMTP server. Cli tools like lego or certbot can help automate the creation and renewal processes.

I see two ways of getting the certificate and the key inside an app.

  1. use fly certs create hostname
  2. use fly ssh console and then use certbot

Which one do you recommend?

There is some documentation on using custom domains on fly. But it does not cover how to use ssl certificate and keys.

Can you please help with above?