Skip to content

Commit

Permalink
Merge pull request #3092 from catchpoint/whitelist_location_ips
Browse files Browse the repository at this point in the history
Add optional location ips whitelist
  • Loading branch information
claud-io authored Aug 7, 2024
2 parents bd6eeed + c2624f3 commit 0b54592
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions www/work/getwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,16 @@ function GetJob()
$workDir = "./work/jobs/$location";
$locInfo = GetLocationInfo($location);
$locKey = GetSetting('location_key', '');

if (array_key_exists('ips', $locInfo)) {
$tester_ip = $_SERVER['REMOTE_ADDR'];
$ips = explode(',', $locInfo['ips']);
if (!in_array($tester_ip, $ips)) {
header("HTTP/1.1 403 Unauthorized");
exit();
}
}

if (isset($locInfo) && is_array($locInfo) && isset($locInfo['key'])) {
$locKey = $locInfo['key'];
}
Expand Down

0 comments on commit 0b54592

Please sign in to comment.