-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid race condition when renewing certificates
Only single certificate can be processed at the same time. Make sure to obtain exclusive lock before executing renewal command.
- Loading branch information
Showing
4 changed files
with
80 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Managed by Puppet | ||
LOCKFILE="/var/lock/certbot" | ||
LOCKFD=99 | ||
# private | ||
function _lock() { flock "$@" $LOCKFD; } | ||
function _release_lock() { _lock -u; _lock -xn && rm -f $LOCKFILE; } | ||
function _prepare_lock() { eval "exec $LOCKFD>\"$LOCKFILE\""; trap _release_lock EXIT; } | ||
|
||
# on start | ||
_prepare_lock | ||
|
||
# public | ||
function exlock() { _lock -x --timeout 30; } # obtain an exclusive lock | ||
function unlock() { _lock -u; } # drop a lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters