1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

Log when an API key is blocked due to IP restrictions

This commit is contained in:
DaneEveritt 2022-06-18 12:04:51 -04:00
parent 0be96cfd26
commit 6ffe5730da
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@ use Closure;
use IPTools\IP;
use IPTools\Range;
use Illuminate\Http\Request;
use Pterodactyl\Facades\Activity;
use Laravel\Sanctum\TransientToken;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@ -39,6 +40,12 @@ class AuthenticateIPAccess
}
}
Activity::event('auth:ip-blocked')
->actor($request->user())
->subject($request->user(), $token)
->property('identifier', $token->identifier)
->log();
throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.');
}
}

View File

@ -15,6 +15,7 @@ return [
'checkpoint' => 'Two-factor authentication requested',
'recovery-token' => 'Used two-factor recovery token',
'token' => 'Solved two-factor challenge',
'ip-blocked' => 'Blocked request from unlisted IP address for <strong>:identifier</strong>',
],
'user' => [
'account' => [