Log when an API key is blocked due to IP restrictions
This commit is contained in:
parent
0be96cfd26
commit
6ffe5730da
2 changed files with 8 additions and 0 deletions
|
@ -6,6 +6,7 @@ use Closure;
|
||||||
use IPTools\IP;
|
use IPTools\IP;
|
||||||
use IPTools\Range;
|
use IPTools\Range;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Pterodactyl\Facades\Activity;
|
||||||
use Laravel\Sanctum\TransientToken;
|
use Laravel\Sanctum\TransientToken;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
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.');
|
throw new AccessDeniedHttpException('This IP address (' . $request->ip() . ') does not have permission to access the API using these credentials.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ return [
|
||||||
'checkpoint' => 'Two-factor authentication requested',
|
'checkpoint' => 'Two-factor authentication requested',
|
||||||
'recovery-token' => 'Used two-factor recovery token',
|
'recovery-token' => 'Used two-factor recovery token',
|
||||||
'token' => 'Solved two-factor challenge',
|
'token' => 'Solved two-factor challenge',
|
||||||
|
'ip-blocked' => 'Blocked request from unlisted IP address for <strong>:identifier</strong>',
|
||||||
],
|
],
|
||||||
'user' => [
|
'user' => [
|
||||||
'account' => [
|
'account' => [
|
||||||
|
|
Loading…
Reference in a new issue