Skip to content

Delete local certificate files after dehydrated fails #206

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

Merged
merged 1 commit into from
Jul 20, 2020

Conversation

gohai
Copy link
Contributor

@gohai gohai commented Dec 3, 2019

For each issue that doesn't succeed we're still creating three files (cert-.csr, cert-.pem, privkey-*.pem) in dehydrated's cert directory that don't get deleted. While they are not big in size, a seizable number of (sub-) domains can this silently exhaust the number of available inodes.

Without this, or a similar patch to the same end, a single certificate that fails to renew (e.g. because the domain has been moved elsewhere) would add 90 files (three per day), which aren't ever deleted. This is compounded by having each subdomain its own certificate.

This is a follow-up to 49256f8

For each issue that doesn't succeed we're still creating three files (cert-*.csr, cert-*.pem, privkey-*.pem) in dehydrated's cert directory that don't get deleted. While they are not big in size, a seizable number of (sub-) domains can this silently exhaust the number of available inodes.

This is a follow-up to 49256f8
GUI added a commit that referenced this pull request Jul 19, 2020
Building on top of
#206, some tweaks:

- There was similar logic to cleanup dehydrated files both in the
  hook file (if the hook succeeded) and in the SSL provider (in case the
  dehydrated call failed). Since this means the files are deleted in
  either case (success or failure), try to simplify this by shifting the
  logic to always run in the SSL provider regardless of success status.
- For the new delete logic introduced in the SSL provider, switch it to
  use non-blocking shell execution to prevent the `rm` from potentially
  blocking (even though this should be quick).
- Since dehydrated's files are always being removed now, remove the
  logic we had in place to handle an edge-case of storage failing, but
  files remaining in dehydrated's cache, since this scenario is now
  moot.
- Update tests to account for new delete logic..
@GUI GUI merged commit 109c31e into auto-ssl:master Jul 20, 2020
@GUI
Copy link
Collaborator

GUI commented Jul 20, 2020

@gohai: Many thanks, as always (and as always sorry for the delays too)! I've tweaked some of this in aa018af before merging. The commit message attempts to explain the changes I made, but let me know if you have any feedback regarding the tweaks I made:

  • There was similar logic to cleanup dehydrated files both in the hook file (if the hook succeeded) and in the SSL provider (in case the dehydrated call failed). Since this means the files are deleted in either case (success or failure), try to simplify this by shifting the logic to always run in the SSL provider regardless of success status.
  • For the new delete logic introduced in the SSL provider, switch it to use non-blocking shell execution to prevent the rm from potentially blocking (even though this should be quick).
  • Since dehydrated's files are always being removed now, remove the logic we had in place to handle an edge-case of storage failing, but files remaining in dehydrated's cache, since this scenario is now moot.
  • Update tests to account for new delete logic.

@gohai
Copy link
Contributor Author

gohai commented Jul 20, 2020

Thank you @GUI for merging and improving this patch! Your changes look much cleaner to me, we'll pick them up next time we'll rebase our tree.

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

Successfully merging this pull request may close these issues.

2 participants