TL;DR
Yes, you can store Certificate Signing Requests (CSRs) on your server to simplify and automate certificate renewal. This avoids needing to recreate the CSR each time, saving time and reducing errors. Here’s how.
How to Store & Use CSRs for Easier Renewals
- Understand the Process: When a certificate nears expiry, you need to renew it. Renewal typically involves generating a new CSR, submitting it to your Certificate Authority (CA), and then installing the renewed certificate. The CSR contains information about your server/domain.
- Generating a CSR can be tricky if you’re not familiar with command-line tools.
- Keeping track of which CSR was used for each certificate is important.
- Choose a Storage Location: Decide where to store your CSRs securely on the server.
- Dedicated Directory: Create a directory specifically for CSRs (e.g.,
/etc/ssl/csr). This keeps them organised. - Permissions: Restrict access to this directory so only authorised users can read and write files. Use appropriate file permissions (e.g., 700 or 755).
- Dedicated Directory: Create a directory specifically for CSRs (e.g.,
- Generate the CSR (if you don’t already have one): If you haven’t generated a CSR yet, do so now.
openssl req -new -key yourdomain.key -out yourdomain.csrReplace
yourdomain.keywith the path to your private key. - Store the CSR: Copy the generated CSR file to your chosen storage location.
cp yourdomain.csr /etc/ssl/csr/yourdomain_current.csrUsing a consistent naming convention (e.g.,
yourdomain_current.csr) helps track the latest CSR. - Renewal Time: When it’s time to renew, retrieve your stored CSR.
cat /etc/ssl/csr/yourdomain_current.csrCopy the contents of this file when submitting your renewal request to the CA.
- Automate with Scripts (Optional): For fully automated renewals, you can write scripts that:
- Check certificate expiry dates.
- Retrieve the CSR from storage.
- Submit the renewal request to your CA using an API or command-line tool.
- Install the renewed certificate automatically.
- Keep Backups: Regularly back up your CSR directory along with other important server files.
- Security Considerations:
- Private Key Protection: Never share your private key. Keep it secure and restrict access. The CSR does not contain the private key, but it’s linked to it.
- CSR Integrity: Ensure the CSR file hasn’t been tampered with during storage or retrieval.

