security|January 07, 2018|2 min read

How to renew SSL certificate from Lets-encrypt when your website is using cloudflare

TL;DR

Temporarily pause Cloudflare or use DNS challenge mode to allow Let's Encrypt certbot to verify domain ownership and renew SSL certificates behind Cloudflare.

How to renew SSL certificate from Lets-encrypt when your website is using cloudflare

Introduction

This article is for website administrator or owner who has once taken certificate from letsencrypt.org, and its the time to renew your certificate. And, you are using cloudflare CDN for your website.

Lets-Encrypt Organization

Letsencrypt.org is an organization who provides free SSL certificate to anyone. I'm a great admirer of this service. And, its popularity increased when google chrome announced that it will give an advantage to SSL enabled websites.

I will write about how to get a new SSL certificate for your website from lets-encrypt. Its an amazing service, with an easy to use utility scripts.

Problem

Letsencrypt says you should run following command:

certbot renew

It may work for most of the people. But, it will not work for people who are using cloudflare.

Following error comes out:

 

Solution

There are two solutions that I could find till now:

1. Bypass cloudflare DNS proxy

You have to disable DNS proxy from cloudflare CDN. i.e. Bypassing cloudflare. If someone opens your website, he/she can see your actual IP, OR he/she will be served from your hosting, not from cloudflare.

Cloudflare website

 

You have to do this, just for the time period in which you are running command to renew your certificate.

Warning: When you disable this setting, your users might see SSL warning on browser, and that will not be good for you.

SSL warning

 

And, run command: 

certbot renew

You are done! Do not forgot switch ON DNS proxy setting from cloudflare

 

2. Via Command line

For this, you need ssh access of your web server. 

Open terminal, and type command:

certbot certonly -d example.com -d www.example.com (put your website in place of example.com)

It will ask for putting webroot path. Write down the path of your documentRoot.

 

You're done.

Share your experiences or issues if any, I will be able to help them out.

 

Update

You should test first your commands, before requesting Lets Encrypt. Read: Test your request to Lets Encrypt

Also read: Common error

Related Posts

Lets-Encrypt SSL Certificate Useful Commands

Lets-Encrypt SSL Certificate Useful Commands

You might need to put sudo before above command. The command will show details…

Lets Encrypt SSL Error: The client lacks sufficient authorization 403 Forbidden

Lets Encrypt SSL Error: The client lacks sufficient authorization 403 Forbidden

This is due to our web server are configured to deny accessing this directory…

How to Renew Lets Encrypt SSL Certificate

How to Renew Lets Encrypt SSL Certificate

Introduction to problem This post is applicable for those who has already an SSL…

Dockerfile for building Python 3.9.2 and Openssl for FIPS

Dockerfile for building Python 3.9.2 and Openssl for FIPS

Introduction In previous posts, we saw how to build FIPS enabled Openssl, and…

How to Patch and Build Python 3.9.x for FIPS enabled Openssl

How to Patch and Build Python 3.9.x for FIPS enabled Openssl

Introduction In this post, we will see Python 3.9.x patch for FIPS enabled…

How to build FIPS enabled Openssl in docker

How to build FIPS enabled Openssl in docker

Introduction In this post, we will see how we can build FIPS enabled openssl in…

Latest Posts

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Claude Code Skills — Build a Better Engineering Workflow with AI-Powered Code Reviews, Security Scans, and More

Most developers use Claude Code like a search engine — ask a question, get an…

Building an AI Voicebot for Visitor Check-In — A Practical Guide to Handling the Messy Parts

Building an AI Voicebot for Visitor Check-In — A Practical Guide to Handling the Messy Parts

Every office lobby has the same problem: a visitor walks in, nobody’s at the…

Server Security Best Practices — Complete Hardening Guide for Production Systems

Server Security Best Practices — Complete Hardening Guide for Production Systems

Every breach post-mortem tells the same story: an unpatched service, a…

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

Staff Engineer Study Plan for MAANG Interviews — The Complete 12-Week Roadmap

If you’re a Senior Engineer (L5) preparing for Staff (L6+) roles at MAANG…

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF Explained — The Complete Guide with Real Attack Examples and Defenses

XSS and CSRF have been in the OWASP Top 10 for over a decade. They’re among the…

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

OWASP Top 10 (2021) — Every Vulnerability Explained with Code

The OWASP Top 10 is the industry standard for web application security risks. If…