Caddy and Cloudflare Authentication


(JC) #1

I am trying to renew my SSL certificate from Cloudflare, but when I run caddy -log stderr I get the following warning: “Cloudflare credentials missing”. I have my email and API key but I have not been able to find instructions on where I need to add these items in order for my certificate to renew.

In my caddyfile, I have:
tls {
dns cloudflare
}


(Matthew Fay) #2

Hi @officialJCReyes, welcome to the Caddy community!

The instructions you’re looking for are here:

[…] You will also need to set environment variables with your account credentials:

Provider Name Environmental Variables to Set
cloudflare CLOUDFLARE_EMAIL CLOUDFLARE_API_KEY

https://caddyserver.com/docs/automatic-https#dns-challenge


(JC) #3

Hi Matt, thanks for the prompt reply. I should have been more clear, where do I set the environment variables?


(Matthew Fay) #4

That’s highly dependent on the environment you’re deploying Caddy in.

Assuming you’re on one of the common flavours of Linux, the simplest way would be to type CLOUDFLARE_EMAIL=myemail@example.com and CLOUDFLARE_API_KEY=123xyz in the shell before running Caddy.

If you plan to use an init system to run Caddy for you, you’ll need to make sure it handles setting the variables - again, depends highly on the system you use.


(JC) #5

I’m running caddy on Windows 10


(Matthew Fay) #6

Check the “Assignment” section of the above linked Wikipedia entry, it has a section for Windows.

I think there’s also a GUI somewhere in the control panel to set environmental variables, but I don’t recall where. You might want to Google it.


(system) #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.