Mindfulness

TLS Fresh Starter Routine: Quick Steps for a Secure Setup

Updated · By the Relaxmid editors

Reading time
4 min
Sections
8
Topic
Mindfulness

To start a fresh TLS routine, generate a new private key, create a certificate signing request (CSR), obtain a signed certificate, and configure your server to use them. The process works for any modern web server that supports TLS 1.2 or newer.

Generate a New Private Key

The first step is to create a private key that will stay on your server. Choose an algorithm and key size that match your security policy.

Factor Typical Choice Why It Matters
Algorithm RSA or ECC RSA is widely supported; ECC offers similar security with smaller keys.
Key Size RSA 2048 bits or ECC P‑256 Provides strong security without excessive CPU load.
TLS Version TLS 1.2 or TLS 1.3 Older versions have known weaknesses.

Use openssl to create the key. The command below produces an RSA 2048‑bit key in PEM format.

  1. Open a terminal on the machine that will host the service.
  2. Run openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out server.key.
  3. Secure the file: chmod 600 server.key.

What if I prefer ECC?

Replace the command with openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out server.key. The rest of the routine stays the same.

Create a Certificate Signing Request (CSR)

The CSR contains your public key and identifying information. It is sent to a certificate authority (CA) for signing.

  1. Run openssl req -new -key server.key -out server.csr.
  2. When prompted, enter a descriptive Common Name (e.g., example.com).
  3. Provide optional fields such as Organization and Country if your CA requires them.

Keep the CSR file safe until you receive the signed certificate. Some CAs also accept the CSR via a web portal.

Can I use a self‑signed certificate for testing?

Yes. Run openssl req -x509 -key server.key -in server.csr -days 365 -out server.crt. Browsers will show a warning because the certificate is not trusted by a public CA.

Obtain a Signed Certificate

Submit the CSR to your chosen CA. The CA validates domain ownership and returns a certificate file, often in PEM format.

  • For a free CA like Let’s Encrypt, use an automated client such as certbot.
  • For a commercial CA, upload the CSR through their portal and download the issued .crt file.

Most CAs also provide an intermediate (chain) certificate. Save it as intermediate.crt and keep the order: server certificate first, then intermediate.

Do I need a separate private key for each domain?

It is best practice to generate a unique key per domain. This limits exposure if one key is compromised.

Configure Your Server to Use the New Materials

Place the three files—private key, server certificate, and intermediate chain—in a directory readable only by the service (e.g., /etc/ssl/).

Configuration differs by software. Below are common examples.

Apache (httpd)

  1. Edit the virtual host file (often /etc/httpd/conf.d/ssl.conf).
  2. Set SSLCertificateFile /etc/ssl/server.crt.
  3. Set SSLCertificateKeyFile /etc/ssl/server.key.
  4. Set SSLCertificateChainFile /etc/ssl/intermediate.crt.
  5. Reload Apache: systemctl reload httpd.

Nginx

  1. Edit the server block (e.g., /etc/nginx/sites-available/default).
  2. Add ssl_certificate /etc/ssl/server.crt;.
  3. Add ssl_certificate_key /etc/ssl/server.key;.
  4. If an intermediate is separate, concatenate it to the server certificate: cat server.crt intermediate.crt > fullchain.crt and reference fullchain.crt.
  5. Test the config: nginx -t, then reload: systemctl reload nginx.

Other Services

Most modern services expose a “TLS/SSL” section in their settings UI. Look for fields labeled “certificate”, “private key”, and “CA chain”. The same PEM files work across platforms.

Test and Verify the Installation

After reloading, confirm that the server presents the correct certificate and that the connection uses TLS 1.2 or newer.

  1. Run openssl s_client -connect example.com:443 -servername example.com.
  2. Check the “Protocol” line for TLSv1.2 or TLSv1.3.
  3. Verify that the certificate chain ends with the trusted root you expect.

Online tools such as SSL Labs’ test can also highlight misconfigurations, like missing intermediate certificates.

What if the test shows an older protocol?

Ensure your server’s configuration disables SSL v2/v3 and TLS 1.0/1.1. In Apache, add SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1. In Nginx, set ssl_protocols TLSv1.2 TLSv1.3;.

Routine Maintenance and Renewal

Certificates expire. Most CAs issue 90‑day or 1‑year lifetimes. Set a calendar reminder before the expiry date.

  • For automated CAs (Let’s Encrypt), schedule certbot renew via cron or systemd timer.
  • For manual renewal, repeat the CSR generation step with a new key or reuse the existing key if policy allows.
  • After renewal, replace the old .crt and .key files, then reload the service.

Regularly review your key algorithm. If industry guidance moves to larger RSA keys or newer ECC curves, generate fresh keys accordingly.

How to verify a renewed certificate?

Repeat the openssl s_client command and compare the “Not After” date with the expected expiry.

Security Checklist for a Fresh TLS Routine

Following this checklist helps keep the connection safe.

  • Use RSA 2048 bits or ECC P‑256 for the private key.
  • Enforce TLS 1.2 or TLS 1.3 only.
  • Disable weak cipher suites (e.g., those using RC4 or 3DES).
  • Store the private key with permissions 600 and owned by the service user.
  • Rotate keys at least once per year or when a compromise is suspected.
  • Monitor certificate expiry and set automated renewal where possible.

By generating fresh material, configuring the server correctly, and testing the result, you create a reliable TLS routine that protects data in transit.

Related

General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more

Spotted an error? Tell us and we will correct it (corrections policy).