Skip to content

Commit 0b54592

Browse files
authored
Merge pull request #3092 from catchpoint/whitelist_location_ips
Add optional location ips whitelist
2 parents bd6eeed + c2624f3 commit 0b54592

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

www/work/getwork.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,16 @@ function GetJob()
285285
$workDir = "./work/jobs/$location";
286286
$locInfo = GetLocationInfo($location);
287287
$locKey = GetSetting('location_key', '');
288+
289+
if (array_key_exists('ips', $locInfo)) {
290+
$tester_ip = $_SERVER['REMOTE_ADDR'];
291+
$ips = explode(',', $locInfo['ips']);
292+
if (!in_array($tester_ip, $ips)) {
293+
header("HTTP/1.1 403 Unauthorized");
294+
exit();
295+
}
296+
}
297+
288298
if (isset($locInfo) && is_array($locInfo) && isset($locInfo['key'])) {
289299
$locKey = $locInfo['key'];
290300
}

0 commit comments

Comments
 (0)