mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-01-13 15:13:33 +01:00
When there is an error, it removes domains.txt #376
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bortzmeyer on GitHub (Sep 25, 2018).
I ran dehydrated and there was a error in my request ("status": 400). As a result, dehydrated removed domains.txt.
Running it again, same issue with my request, it tries again to remove it and prints:
rm: cannot remove '/etc/dehydrated/domains.txt': No such file or directory@lukas2511 commented on GitHub (Sep 26, 2018):
Mh... Are you using the
--signcsrfunction combined with--domainparameters? Those are not designed to be used with this function and seem to be the trigger for this bug.@bortzmeyer commented on GitHub (Sep 26, 2018):
I do. OK, I'll try without
--domain(it is in the CSR after all) but the bug is still really damaging.@ilyaevseev commented on GitHub (Feb 29, 2020):
The problem still here, /etc/dehydrated/domains.txt is removed on error:
@txr13 commented on GitHub (Feb 29, 2020):
I found the error.
command_sign_domainscallsinit_systemfirst, and checks forPARAM_DOMAINafterward (creating a temp file if present).In
init_system, line 298, get CA URLs by callinghttp_request.In
http_request, if the CA is experiencing a temporary issue, we fail through to lines 559-581, where we remove the "temporary"DOMAINS_TXTfile. But at this point in the chain, we have not yet created a temporary domains file, and so the actual domains.txt is removed instead.This is a bug, but it's an extremely specific bug that would only ever be seen if you were using the
-cargument, and the-dargument, and had an actual domains.txt file as well, and the CA experienced a temporary issue during the initial request for the directory URLs. Tricky!@usev6 commented on GitHub (Apr 15, 2020):
Since I've wondered if this might become a problem for my setup, I've looked at the related code. If I'm not mistaken the bug was introduced a long time ago when the call to
ìnit_systemwas added before the temporary domains.txt was defined.However, from the perspective of separation of concerns it seems strange to have
http_requesttaking care of cleaning up a temporary domains.txt file. Maybe it would be best to just remove these lines: https://github.com/dehydrated-io/dehydrated/blob/dbb0ef1ce1/dehydrated#L577-L578. I guess there are other code pathes that let the script exit without hitting one of the two statements that remove the temporary domains.txt file.Instead the cleanup of the temporary domains.txt could perhaps be done with a
trap. (I'm aware of this suggestion being a bit handwavy ;-) E.g. there already is a trap command ininit_system, so this would need some coordination.)