CloudFlare credentials missing

Hi! I’m trying to run my website with caddy on a DigitalOcean droplet behind Cloudflare.
When caddy is started, it prints

[INFO] Certificate for [mcmainiac.de ] expires in 543h55m15.741140551s; attempting renewal
[ERROR] CloudFlare credentials missing

This is happened after upgrading to caddy 0.10.6.

My env command shows that CLOUDFLARE_EMAIL as well as CLOUDFLARE_API_KEY are set.

I already read this topic: https://caddy.community/t/looking-for-an-working-example-for-automatic-https-in-the-documentation/1072

In my Caddyfile I used:

tls {
  dns cloudflare
}

Cloudflare’s SSL setting is set to “Full (strict)”.

Running on Ubuntu 16.04

What could possibly be wrong?

Hi @MCMainiac,

Is this happening when you launch caddy from the same shell you run env from?

Or are you using some other method to run Caddy?

1 Like

I start caddy automatically when Ubuntu starts using systemd.

I also followed this tutorial (with small modifications such as having a “vhosts” folder with multiple Caddyfiles; this did not cause any problems so far): https://www.digitalocean.com/community/tutorials/how-to-host-a-website-with-caddy-on-ubuntu-16-04

Would it resolve the issue if I edit the caddy.service file and add the environment variables there?

Okay so I just added

Environment=CLOUDFlARE_API_KEY=xxxx
Environment=CLOUDFLARE_EMAIL=xxxx

below the already existing Environment=CADDYPATH=xxx and did a sudo systemctl daemon-reload followed by sudo systemctl restart caddy.

sudo journalctl -xe -u caddy showed that caddy successfully obtained a new certificate! All sites are running and caddy renews my certificates.

Thanks for you help, @Whitestrake!

2 Likes

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