mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-01-13 15:13:33 +01:00
exit_hook is called at invalid_challenge and not at the end of the cron command #439
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 @kepi on GitHub (Oct 22, 2019).
Originally assigned to: @lukas2511 on GitHub.
TL;DR:
exit_hookis called after every invalid challenge instead of end of the cron run.I think that during fix of #630 in
1c77730regression was introduced.exit_hook has this description (as stated in #630 too):
Problem is that when running with keep going option,
exit_hookis now called after first validation error. We have similar setup as described in #630 - instartup_hookwe are starting simple httpd server which serves well known requests. Inexit_hookwe are sending SIGQUIT to it.We had same problem as in #630 - http server was not killed and remained running sometimes. But in our case it wasn't big deal. Much bigger problem is current behavior - after first error https server is killed in
exit_hookand all other requests are failing (as we are using keep going option). As we had one failing domain near the start of couple hundred long domains file... fortunately we have monitoring and couple days to fix the situation :)@aderumier commented on GitHub (Oct 23, 2019):
Hi,
I have updated recently, and I have also keep going not working anymore.
@usev6 commented on GitHub (Apr 14, 2020):
I'm also using
--keep-goingand I'm afraid this problem prevents an update to https://github.com/dehydrated-io/dehydrated/commit/1c77730373 and newer for me.I think that #630 raised a valid concern:
exit_hookwas not called anymore if_exiterrwas called first -- thus breaking the ability to do cleanup tasks via this hook.On the other hand, the possibility to have
exit_hookcalled more than once looks like a bug to me (and breaks--keep-goingbadly). Before https://github.com/dehydrated-io/dehydrated/commit/1c77730373 there was only one place that calledexit_hookand that was at the end ofcommand_sign_domains-- exactly as advertised.IMHO calling a hook in
_exiterrand passing it the actual error message is a Good Thing. But re-using the existing hook that was especially useful in combination with--keep-goingleads to problems.I don't see a clean solution. Maybe one could set a global variable (as a flag) before the call to
sign_domainif--keep-goingwas used. (If I'm not mistaken only stuff insign_domainseems to be protected -- other calls to_exiterrdo end the script and should callexit_hook.)_exiterrcould then look for that global variable to decide whetherexit_hookshould be called or not. Something along this line (totally untested):@kepi commented on GitHub (Apr 27, 2020):
@lukas2511 can we please get your opinion? I believe this is critical issue, even if only for some use cases.
I'm willing to try fix this and send pull request but I don't want to spend time with approach witch will not be according to project direction. Thanks.
@lukas2511 commented on GitHub (Apr 27, 2020):
@kepi i'll have a look at this either today or tomorrow 👍 sorry for not responding earlier
@lukas2511 commented on GitHub (Apr 28, 2020):
This should be fixed now. I basically took 1:1 the suggested patch by @usev6. Not the prettiest solution but it works.