Site AI Auditαπό την Internet Solutions

SSL Private Keys: How to Store, Protect and Replace Them

1 Οκτωβρίου 20268 λεπτά ανάγνωσηςΑσφάλεια και SSL
SSL Private Keys: How to Store, Protect and Replace Them

Short answer: The private key is the secret half of your SSL/TLS certificate. Anyone who has it can impersonate your website to visitors whose traffic they can intercept. Generate the key on the server that uses it, store it in a file readable only by the system administrator account, never send it by e-mail or commit it to code repositories, and create a new key at each renewal. If a key may have been exposed, revoke the certificate, issue a new one with a new key, and find out how the leak happened.

What the private key does

An SSL/TLS certificate contains a public key and information about the domain, signed by a certificate authority. The certificate is public: every visitor’s browser receives a copy. The matching private key stays on your server. During the TLS handshake, the server proves it holds the private key, and that proof is what convinces the browser it is talking to the real website.

This is why the key matters more than the certificate. A copy of your certificate is useless to an attacker. A copy of your private key, combined with a way to intercept traffic, such as control of a public Wi-Fi network, a compromised router or a hijacked DNS record, lets them present your valid certificate and read or change everything visitors send.

With modern TLS configurations that use forward secrecy, which TLS 1.3 always does, a stolen key does not decrypt traffic recorded in the past. Older configurations that used RSA key exchange did not have this protection, which is one more reason to disable outdated protocols and ciphers, as covered in getting an A grade in an SSL server test.

Where private keys usually leak

Keys rarely leak through clever cryptographic attacks. They leak through ordinary operational mistakes:

Generating keys the safe way

The safest key is one that is created where it will be used and never moves:

  1. Generate the key and certificate signing request (CSR) on the server itself, with your hosting panel, an ACME client or OpenSSL.
  2. Send only the CSR to the certificate authority. The CSR contains the public key; the private key never needs to leave the server.
  3. Use a current key type and size: RSA with at least 2048 bits, or an elliptic curve key such as ECDSA P-256, which is smaller and faster with comparable security.
  4. Let automation handle it where possible. ACME clients such as Certbot and most hosting panels generate keys locally and install the certificate without anyone handling the key file. The setup is described in automating SSL renewal with Certbot.

Storing keys securely

On a typical Linux server:

Higher-value systems sometimes keep keys in hardware security modules or cloud key management services, where the key cannot be exported at all. For most small business websites, correct file permissions, automation and short certificate lifetimes provide good protection.

Keys on CDNs, load balancers and hosting panels

Many sites terminate HTTPS somewhere other than their own server:

Where TLS endsWho holds the keyWhat to check
Your own serverYouFile permissions, backups, who has root access
Hosting control panelYour host, on your behalfPanel account security and who has panel access
CDN with its own certificateThe CDNNo key handling needed; secure your CDN account
CDN with an uploaded custom certificateThe CDN and youUpload over the dashboard only; remove old uploads
Load balancer or proxyYour infrastructure teamAccess to the configuration and secrets store

In every case, the key is only as safe as the account that controls it. Protect those accounts with strong, unique passwords and multi-factor authentication, and remove access for people who no longer need it.

Rotation: replace keys regularly

Reusing the same private key for years increases the damage if it ever leaks, because every certificate issued with it is affected. Good practice is to generate a new key whenever a certificate is renewed. Most ACME clients do this by default, and with certificate lifetimes getting shorter, as described in SSL certificates moving to 47 days, rotation becomes a natural part of automated renewal.

Also rotate keys immediately when:

A quick self-check for your own keys

You can review your situation in half an hour by answering a few questions honestly:

Most small businesses find at least one key that was e-mailed years ago or copied to an old server. Replacing it is quick and costs nothing with free, automated certificates.

What to do if a key is exposed

  1. Generate a new key and CSR on the server, and obtain a new certificate.
  2. Install the new certificate everywhere the old one was used: servers, CDN, load balancers, mail servers.
  3. Revoke the old certificate with the certificate authority, giving key compromise as the reason. How revocation works is explained in SSL certificate revocation.
  4. Remove every copy of the old key, including from backups, repositories, e-mail and chat where possible.
  5. Find the cause. If the server was compromised, follow a full incident response, because the attacker may have taken more than the key.
  6. Watch for unexpected certificates for your domain in Certificate Transparency logs, which show every publicly trusted certificate issued; see Certificate Transparency monitoring.

How Site AI Audit helps

Private keys live on your servers, so they cannot be checked from outside. What Site AI Audit checks is the public result: whether your SSL certificate is valid, when it expires, whether HTTP redirects to HTTPS and which security headers are set. After replacing a key and certificate, a re-check confirms that the new certificate is live and correctly installed. Paid plans add alerts before a certificate expires; see the pricing page.

Related reading

The bottom line

The private key is what makes your certificate trustworthy. Generate it on the server, never send or commit it, restrict file permissions, encrypt backups, and create a new key at every renewal. If a key might have leaked, replace and revoke the certificate straight away and find out how it happened.

FAQ

What happens if someone steals my SSL private key?

They can impersonate your website to visitors whose traffic they can intercept, reading or changing what is sent. Revoke the certificate and issue a new one with a new key immediately.

Where should an SSL private key be stored?

On the server that uses it, outside the website’s public folders, in a file readable only by the administrator account. Backups containing the key should be encrypted.

Can I send my private key to my web developer?

Avoid it. Give the developer access to generate the key on the server instead, or let your host or ACME client handle certificates automatically so the key never needs to move.

Should I create a new private key when renewing a certificate?

Yes. A new key at each renewal limits the damage if an old key was ever exposed. Most automated renewal tools do this by default.

Is it safe to use the same key on several servers?

It is common with multi-server setups but increases risk, because a compromise of any one server exposes the key for all. Limit the number of copies and rotate the key regularly.

#HTTPS#SSL certificate#TLS#Website security
Ελέγξτε τον δικό σας ιστότοπο — δωρεάν.Τι να διορθώσετε στον ιστότοπό σας — και από πού να ξεκινήσετε.
Ξεκινήστε δωρεάν

Περισσότερα από το blog

Όλα τα άρθρα →
Internet Solutions

Περισσότερα από την ομάδα μας

Από την Internet Solutions. Δοκιμάστε και τα άλλα προϊόντα μας — το καθένα σας εξοικονομεί χρόνο με διαφορετικό τρόπο.

internet-solutions.net ↗
01Αυτόματες αναρτήσεις στα social
PostRSS

Οι νέες αναρτήσεις από τη ροή RSS σας πηγαίνουν αυτόματα σε Facebook, X, LinkedIn, Telegram και σε 60+ ακόμη δίκτυα.

Δωρεάν πλάνο · από το 2014Επίσκεψη →
02Ζωντανή συνομιλία AI για ιστοσελίδες
Talkmio

Η ιστοσελίδα σας απαντά στους επισκέπτες 24/7 από το δικό σας περιεχόμενο, στη γλώσσα τους.

Δωρεάν πλάνο · χωρίς κάρταΕπίσκεψη →
03AI βοηθός
Ask Mio

Συνομιλία, κώδικας, σχεδιασμός, γραφή και έρευνα. Το Mio επιλέγει το καλύτερο μοντέλο για κάθε εργασία.

Δωρεάν πλάνοΕπίσκεψη →
04AI αυτόματος πιλότος για blog και social
AI Blog Autopilot

Η AI γράφει άρθρα SEO 2.000–3.000 λέξεων και κοινοποιεί το καθένα σε 58+ κοινωνικά δίκτυα.

Τα 3 πρώτα άρθρα δωρεάνΕπίσκεψη →
05Σε βάθος SEO crawl
Site SEO AI Audit

Πλήρες SEO crawl σε 7 τομείς, μαζί με την ορατότητα στην αναζήτηση AI, με διορθώσεις ταξινομημένες κατά αντίκτυπο.

Ο πρώτος έλεγχος δωρεάνΕπίσκεψη →
06Ροές RSS και προϊόντων
RSS Feed Creator

Δημιουργήστε RSS από οποιαδήποτε ιστοσελίδα, καθώς και ροές προϊόντων για Google και Meta που ενημερώνονται μόνες τους.

Δωρεάν πλάνοΕπίσκεψη →
07Ανάπτυξη ιστοσελίδων και SEO
Internet Solutions

Ιστοσελίδες, e-shops και εξειδικευμένα συστήματα — τα σχεδιάζει, τα αναπτύσσει και τα υποστηρίζει η ομάδα μας.

Από το 2011Επίσκεψη →
Site AI Audit
Επισκόπηση απορρήτου

Αυτός ο ιστότοπος χρησιμοποιεί cookies ώστε να σας προσφέρουμε την καλύτερη δυνατή εμπειρία. Οι πληροφορίες των cookies αποθηκεύονται στον browser σας και εξυπηρετούν λειτουργίες όπως την αναγνώρισή σας όταν επιστρέφετε και τη βοήθεια προς την ομάδα μας να καταλάβει ποιες ενότητες του ιστοτόπου βρίσκετε πιο ενδιαφέρουσες και χρήσιμες.