Creating and installing a wildcard certificate

Most websites can now be encrypted very easily with one click via “Let’s Encrypt”. This post is about how to create a certificate signing request yourself, exchange certificates and install them with your web host.

openssl req -nodes -new -newkey rsa:2048 -sha256 -out csr.pem -keyout key.pem

The command leads to a small questionnaire in which you have to answer various questions about the certificate request.

Generating a 2048 bit 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) []:DE
State or Province Name (full name) []:Niedersachsen
Locality Name (eg, city) []:Braunschweig
Organization Name (eg, company) []:Tobi Sell
Organizational Unit Name (eg, section) []:IT
Common Name (eg, fully qualified host name) []:*.tobias-sell.com
Email Address []:security@tobias-sell.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:

The challenge password is only used to transfer the CSR securely to the issuer.

You can then upload this CSR to your provider to request a certificate. In my case a “wildcard certificate”, but it works exactly the same way for normal certificates. In that case you should leave out the * in front of the domain name (in the CSR).

After that, you usually have to confirm the domain to the certificate issuer. This usually happens by sending an email with a verification link to the domain owner or by adding a TXT record to your domain. This is usually described very well by the individual providers.

Once the domain is confirmed, you receive several things from the certification authority

  • The website certificate
  • An intermediate certificate
  • The certificate of the issuing authority

You now have to enter the contents of these files with your web host. Here is the form from All-Inkl as an example.

You don’t actually need to enter the CSR anymore. What’s important is the key we created with the command line command, the actual certificate (cert) and the intermediate certificates. Usually there is only one text field or one upload for them. But all certificates of the certificate chain are needed. The solution is relatively simple: copy the issuer’s certificate and the intermediate certificate into one file or into the one text field, and then both are accepted.

After that, the website should be available with the new certificate. In my case even a whole lot of websites, since a wildcard certificate also covers all subdomains.