|
146 | 146 | } |
147 | 147 | // this might be a very young certificate, just issued, OCSP statement is |
148 | 148 | // 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 | + |
174 | 154 | $response = $unauthResponse; |
175 | 155 | error_log("Serving OCSP response for serial number $serialHex! (we ran out of grace)"); |
176 | 156 | } else { |
|
0 commit comments