RedditPP Mascot

RedditPP

r/sysadmin • … • u/OrangeredStilton

If you're using Dehydrated to auto-renew LetsEncrypt certs, and it's stopped working recently, this might be why

*Edit* with a TL;DR: This is specifically an issue with the [Namecheap DNS helper](https://github.com/wdouglascampbell/dehydrated_namecheap_dns_api_hook) for Dehydrated, so if you're not using DNS challenges for ACME auth you're probably safe to ignore this thread.

------------

I started running into an issue a few weeks ago where my domains' SSL wasn't being automatically renewed any more, and my certs started to expire, even though `dehydrated` was running daily as it should.

It was running daily, but it was stuck: the process was still showing in `ps` the next day. Dehydrated and its helpers are all bash scripts, so I was able to throw `set -o xtrace` at the top to see what bash was running, and this was the offending block:

cliip=`$CURL -s https://v4.ifconfig.co/ip` while ! valid_ip $cliip; do sleep 2 cliip=`$CURL -s https://v4.ifconfig.co/ip` done

This is a block of code in the Dehydrated helper script for Namecheap, that detects the running machine's IP. Except if the call fails, it gets stuck forever sleeping every 2 seconds and trying again. And as it turns out, the `v4` and `v6` subdomains to ifconfig.co were deprecated _in 2018_ and finally removed in January sometime.

So the upshot is that `v4.ifconfig.co/ip` should be changed to `ifconfig.co` and your Dehydrated/Namecheap setup will come back to life.

Also, `set -o xtrace` is a lifesaver for debugging Bash scripts that are getting stuck.

— 0