Skip to content

Commit 85b7b79

Browse files
committed
OCSP grace period
1 parent ac9f43e commit 85b7b79

1 file changed

Lines changed: 5 additions & 25 deletions

File tree

utils/ocspweb/index.php

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -146,31 +146,11 @@
146146
}
147147
// this might be a very young certificate, just issued, OCSP statement is
148148
// not on the server yet. Apply some amount of grace for a while...
149-
$graceRaw = file_get_contents("gracelist.serialised");
150-
if ($graceRaw !== FALSE) {
151-
$grace = unserialize($graceRaw);
152-
if (array_key_exists($serialHex, $grace)) {
153-
// we applied grace earlier. Check if we are still in the window.
154-
$now = new DateTime();
155-
$first = $grace[$serialHex]; // this is a DateTime object
156-
$diff = $now->diff($first);
157-
if ($diff->y == 0 && $diff->m == 0 && $diff->d == 0 && $diff->h == 0) {
158-
// this certificate gets a small dose of amazing grace.
159-
error_log("Not sending any reply for serial $serialHex because we've applied grace (subsequently).");
160-
exit(1);
161-
} else {
162-
$response = $unauthResponse;
163-
}
164-
} else {
165-
// this certificate gets a small dose of amazing grace. Do not reply
166-
// but remember when this happened.
167-
$grace[$serialHex] = new DateTime();
168-
file_put_contents("gracelist.serialised", serialize($grace));
169-
error_log("Not sending any reply for serial $serialHex because we've applied grace (first time).");
170-
exit(1);
171-
}
172-
}
173-
// if we are outside the grace window, send back a negative reply
149+
//
150+
// grace period wasn't used on production for years
151+
// if needed should be implemented using JSON or a simple DB like redis/sqlite
152+
// purging of gracelist have to be implemented
153+
174154
$response = $unauthResponse;
175155
error_log("Serving OCSP response for serial number $serialHex! (we ran out of grace)");
176156
} else {

0 commit comments

Comments
 (0)