Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duckdns can't obtain cert after upgrade to 1.12.5 #1869

Open
kricha opened this issue Feb 17, 2021 · 115 comments
Open

duckdns can't obtain cert after upgrade to 1.12.5 #1869

kricha opened this issue Feb 17, 2021 · 115 comments

Comments

@kricha
Copy link

kricha commented Feb 17, 2021

The problem

After upgrading addon to 1.12.5 version, it can't obtain certificate

Environment

  • Add-on with the issue: DuckDNS
  • Add-on release with the issue:
  • Last working add-on release (if known):
  • Operating environment (OS/Supervised): Home Assistant 2021.2.3

Problem-relevant configuration

lets_encrypt:
  accept_terms: true
  certfile: fullchain.pem
  keyfile: privkey.pem
token: duckdns_token
domains:
  - myownmane.duckdns.org
aliases:
  - domain: owndomain.com
    alias: myownmane.duckdns.org
seconds: 300

Traceback/Error logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
# INFO: Using main config file /data/workdir/config
+ Account already registered!
[15:27:13] INFO: OK
185.124.168.108
NOCHANGE
[15:27:15] INFO: Renew certificate for domains: myownmane.duckdns.org and aliases: 
owndomain.com
# INFO: Using main config file /data/workdir/config
Processing owndomain.com with alternative names: myownmane.duckdns.org
 + Signing domains...
 + Generating private key...
 + Generating signing request...
 + Requesting new certificate order from CA...
 + Received 2 authorizations URLs from the CA
 + Handling authorization for owndomain.com
 + Handling authorization for myownmane.duckdns.org
 + 2 pending challenge(s)
 + Deploying challenge tokens...
OKOK + Responding to challenge for owndomain.com authorization...
 + Cleaning challenge tokens...
OKOK + Challenge validation has failed :(
ERROR: Challenge is invalid! (returned: invalid) (result: {
  "type": "dns-01",
  "status": "invalid",
  "error": {
    "type": "urn:ietf:params:acme:error:unauthorized",
    "detail": "Incorrect TXT record \"_JSFK0dRBHcg1klisURl0aHdq1aCiZ_4imd8ZHupHhI\" found at _acme-challenge.owndomain.com",
    "status": 403
  },
  "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/someints/somealphas",
  "token": "qNK-toen"
})

Additional information

CleanShot 2021-02-17 at 15 48 53@2x

All works great before upgrade

@matlimatli
Copy link

I have exactly the same issue. Upgraded to 1.12.5, modified the config as required by #1785, and now get the same negative result as above (Challenge is invalid). I am not sure which was the last working version. I also tried reinstalling the plugin.

If I remove the aliases, the certificate request works fine for the duckdns domain.

@OndraM
Copy link

OndraM commented Feb 22, 2021

Same behavior here. I reconfigured DuckDNS settings following #1785 according to updated documentation, so that domains contain only duckdns host and aliases adds my own 3rd level domain.

I also made sure CNAME DNS record is as stated by the documentation.

As a result, I'm getting Incorrect TXT record as well with addon unable to reissue certificate for my domain with the same message as in the issue above.

If I remember correctly, it was working before, when my domain was in both domains and aliases field (ie. before #1785).

@rruizGit
Copy link

rruizGit commented Feb 22, 2021

Same exact issue with my setup. Didn't know about the change with #1785 so my cert expired. I updated as discussed above and got exactly the same failure.

Edit: Something fixed it. Only significant change I made is that I forwarded my 'A' record to the duckdns domain name. But I also reverted to an older version of DuckDNS (through a Snapshot) and got that working. Then I upgraded to latest and it was still able to create a cert.

@andyeskridge
Copy link

I am also hitting this issue. @rruizGit what do you mean forwarding your 'A' record? Did you just create a new A record with the current IP address of your home assistant?

@andyeskridge
Copy link

Alright, well I worked around this by turning off the certs in duckdns and installing the let's encrypt addon and using that to generate the certificates for me.

@rruizGit
Copy link

rruizGit commented Mar 3, 2021

Sorry, crazy things going on in my life. All I did was go to my Domain/DNS host and have it point my 'A' record to the IP address of my DuckDNS IP. But truthfully, not sure if that fixed the issue or not. It could very well be that I got it to work with the previous version and then upgraded. For all I know when that cert expires the latest code could fail again.
Good to know that I could always move to just using "Let's Encrypt" directly.

@Orgjvr
Copy link

Orgjvr commented Mar 4, 2021

I am also hitting this issue. What is happening is that the addon is requesting challenges for both the alias(es) as well as the domain(s). The second challenge is overwriting the first challenge before the challenge validation is taking place, thus resulting in a failed validation.

As a temporary workaround

  1. Remove all the aliases from the config and let it just validate the Duckdns domains. This completes successfully.
  2. Put back the aliases into the config and let it re-validate all the domains. As the Duckdns domains are already validated, it will only deploy challenges to the Alias domains. This time it will complete successfully (if your alias domains point to different duckdns domains! In case more than one Alias point to the same Duckdns domain, you need to split step 2 into multiple steps and let it only validate one of the duplicate aliases at a time).

Edit:
One downside of the current configuration design is that all the duckdns domains will be part of the certificate where previously I only had the domains in the Domain section as well as the Aliases on the certificate.

@sigo
Copy link

sigo commented Apr 16, 2021

Same here. Since update cert cannot be renew.

@sigo
Copy link

sigo commented Apr 23, 2021

Spent too much time on this.

Duck DNS addon cannot properly work with renewing cert for domain with aliases at this moment. I'm going to Duck DNS (for DDNS service) with Let's encrypt addon combo.

It is required to set auto starting Let's encrypt every day/week or so.

@rruizGit
Copy link

@sigo, do you mind sharing how you setup Let's Encrypt with aliases to get this working? I'm going through this yet again.

@sigo
Copy link

sigo commented May 25, 2021

@rruizGit sure, but the configs isn't rocket science. I'll provide quick guide. Config details depends on DNS provider (Supported DNS providers).

Let's Encrypt documentation. It is a bit lengthy due to many supported DNS providers. Worth reading.

  1. Have Duck DNS and Let's Encrypt plugin installed.
  2. Have only one DNS rule - CNAME <your-domain> -> <domain>.duckdns.org. Can be proxied on Cloudflare. You can safely delete any other created for DuckDNS.
  3. DuckDNS config
lets_encrypt:
  accept_terms: false
  certfile: fullchain.pem
  keyfile: privkey.pem
token: <SECRET>
domains:
  - <SECRET>.duckdns.org
aliases: []
seconds: 300
  1. Let's Encrypt config mostly depends on DNS provider. I use Cloudflare with DNS challange (it doesn't require any open ports, but require Cloudflare API token with Zone.DNS permission).
email: <SECRET>
domains:
  - <SECRET>
certfile: fullchain.pem
keyfile: privkey.pem
challenge: dns
dns:
  provider: dns-cloudflare
  cloudflare_api_token: <SECRET>

Let's Encrypt will create temporary DNS entry for challenging while recreating certificate in this configuration.

As a bonus point, you should create some scheduled job for recreating certificate. Renew process is run only on Let's Encrypt plugin start. Example solution.

@rruizGit
Copy link

@sigo, thank you, sir!

@Veldkornet
Copy link

I am also hitting this issue. What is happening is that the addon is requesting challenges for both the alias(es) as well as the domain(s). The second challenge is overwriting the first challenge before the challenge validation is taking place, thus resulting in a failed validation.

As a temporary workaround

  1. Remove all the aliases from the config and let it just validate the Duckdns domains. This completes successfully.
  2. Put back the aliases into the config and let it re-validate all the domains. As the Duckdns domains are already validated, it will only deploy challenges to the Alias domains. This time it will complete successfully (if your alias domains point to different duckdns domains! In case more than one Alias point to the same Duckdns domain, you need to split step 2 into multiple steps and let it only validate one of the duplicate aliases at a time).

Edit:
One downside of the current configuration design is that all the duckdns domains will be part of the certificate where previously I only had the domains in the Domain section as well as the Aliases on the certificate.

Thanks, this workaround works for me too. Hopefully I won’t need to do this every time though…

@marcomsousa
Copy link

marcomsousa commented Aug 19, 2021

I found the root cause:
The upgrade of the dependency dehydrated.

Since dehydrated 0.6.0, dehydrated change the domain validation strategy.
Until that version, they was validation in sequential, and change to validate in parallel.

Now they, deploy all TXT for all the domains, and validate all the domains. This fails because when dehydrated starts to validate we only have the last TXT record in duckdns.org

dehydrated doesn't allow to change to the old strategy:
https://github.com/dehydrated-io/dehydrated/blob/master/docs/troubleshooting.md#dns-invalid-challenge-since-dehydrated-060--why-are-dns-challenges-deployed-first-and-verified-later

@GeoMaciolek
Copy link
Contributor

Can we pin the requirement on dehydrated to 0.5.0? I imagine there are security implications there.

@rruizGit
Copy link

Can we pin the requirement on dehydrated to 0.5.0? I imagine there are security implications there.

Or, if DuckDNS will never work correctly in this situation, @sigo's solution might be the way to go?

@marcomsousa
Copy link

marcomsousa commented Aug 19, 2021

The problem is not DuckDNS, is that dehydrated now is incompatible with DuckDNS for multidomains alias.
The best approach is to change from dehydrated to acme.sh:

getssl:

@sigo
Copy link

sigo commented Aug 19, 2021

Can we pin the requirement on dehydrated to 0.5.0? I imagine there are security implications there.

Or, if DuckDNS will never work correctly in this situation, @sigo's solution might be the way to go?

My semi-manual way works, but it is workaround. It may work better (via DuckDNS). I think @marcomsousa's research is very valuable here - and it doesn't seems like "I think i know the issue".

@marcomsousa
Copy link

marcomsousa commented Aug 19, 2021

image

I changed the hook.sh to print some debug information, so I'm 100% sure.

  1. Deploy TXT for ALIAS .dev
  2. Deploy TXT for DOMAIN a.duckdns.org
  3. Checking TXT for DOMAIN a.duckdns.org, failed becase is ALIAS .dev TXT on that system.

It's easy to change to acme.sh or getssl (removing dehydrated) and complete fix this issue.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 23, 2021
@Veldkornet
Copy link

Veldkornet commented Sep 23, 2021

Nope, still broken.

Same as before, removing the aliases and then adding them back temporarily resolves the issue (until the next renewal)

@github-actions github-actions bot removed the stale label Sep 23, 2021
@rvdzanden
Copy link

Any update on this issue?

@p0wertiger
Copy link

I hit this problem 3 days ago. Thanks for the manual workaround, did the job for now but the issue is still not fixed...

@hjed
Copy link

hjed commented Dec 5, 2021

I also have this issue

@pavelkryl
Copy link

The issue still persists with DuckDNS 1.14.0

@enjikaka
Copy link

enjikaka commented Jan 19, 2022

Now my certs expired and DuckDNS 1.14.0 didn't renew because of the alias, once again... It has not worked a single time. Fix from @Veldkornet doesn't work on 1.14.0. It fetches the cert after removing aliases but after adding the alias back and restarting the addon it doesn't fetch due to "Skipping renew!".

Update: Restarting home assistant resolved the issue. Even though /ssl/fullchain.pem and /ssl/privkey.pem was updated they were not applied until after restart. Old cert cached somewhere?

@Veldkornet
Copy link

Still broken...

@github-actions github-actions bot removed the stale label Jun 22, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 22, 2024
@Veldkornet
Copy link

Still broken

@Xebozone
Copy link

Still broken

Thanks for keeping the issue alive. I just wish they would fix it!

@github-actions github-actions bot removed the stale label Jul 22, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 21, 2024
@Veldkornet
Copy link

Nope. It is, as always, still broken.

@github-actions github-actions bot removed the stale label Aug 21, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 20, 2024
@Veldkornet
Copy link

It's busted as always Mr Bot

@github-actions github-actions bot removed the stale label Sep 20, 2024
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 20, 2024
@Veldkornet
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

No

@marcomsousa
Copy link

Still present

@github-actions github-actions bot removed the stale label Oct 20, 2024
@orcaman98
Copy link

Commenting to block the stale-bot. 4 years, devs!! Come on, at least look at it!

Copy link

github-actions bot commented Dec 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 7, 2024
@p0wertiger
Copy link

Definitely not solved yet

@github-actions github-actions bot removed the stale label Dec 7, 2024
Copy link

github-actions bot commented Jan 6, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 6, 2025
@Xebozone
Copy link

Xebozone commented Jan 6, 2025

NOT FIXED

@github-actions github-actions bot removed the stale label Jan 6, 2025
@necrose99
Copy link

domains:

  • null
  • lo******.duckdns.org
  • ne****.duckdns.org
    email: [email protected]
    keyfile: privkey.pem
    certfile: fullchain.pem
    challenge: dns
    dns: {dns-duckdns}
    duckdns_email: mi*****
    duckdns_api_key: ******9
    key_type: rsa
    elliptic_curve: secp384r1

duckdns is a legacy integration however via Lets encypt add on a plus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests