Creating Self-Signed Certificates for Testing

Overview

Many of the Tuono features require a certificate chain to deploy. While you may already have certificates, or you may be willing to create a formal signed certificate via the Azure Portal or AWS Console, sometimes you just need a quick and dirty solution.

Goals

With Tuono, you can upload a self-signed certificate as part of the deployment process. This tutorial discusses how to create a self-signed certificate to use for this purpose.

Creating a Self-Signed Certificate

  • Generate the private key and certificate body using the following one-liner:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
  • You will then be prompted to provide some details:

Generating a RSA private key
....++++
...............++++
writing new private key to 'key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <country_code>
State or Province Name (full name) [Some-State]: <region>
Locality Name (eg, city) []: <city_town>
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <organization>
Organizational Unit Name (eg, section) []: <team>
Common Name (e.g. server FQDN or YOUR name) []: <common_name>
Email Address []: <email_address>
  • This will generate two files:

    • key.pem (private key)

    • cert.pem (certificate body)

Bringing it Together

Taking the webservice_scaleset as an example, this is how you would use the values that we just generated:

---
variables:
  balancer_cert_body:
    description: >-
      The balancer certificate in PEM format.
    type: string
  balancer_cert_private_key:
    description: >-
      The balancer certificate's private key in PEM format.
    type: secret

...

security:
  certificate:
    webservice-cert:
      body: (( balancer_cert_body ))
      private_key: (( balancer_cert_private_key ))
  • balancer_cert_body is provided as a variable

  • balancer_cert_private_key is provided as a secret

Last updated

Was this helpful?