From e08e377b3492ac6c72a31dd223b3bf47be9e777e Mon Sep 17 00:00:00 2001 From: paulwer Date: Sun, 19 May 2024 06:31:26 +0200 Subject: [PATCH] fixes: env vars --- app/Services/InboundMail/InboundMailEngine.php | 8 ++++---- config/ninja.php | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Services/InboundMail/InboundMailEngine.php b/app/Services/InboundMail/InboundMailEngine.php index 31f242476094..f207d47f216e 100644 --- a/app/Services/InboundMail/InboundMailEngine.php +++ b/app/Services/InboundMail/InboundMailEngine.php @@ -16,7 +16,7 @@ use App\Factory\ExpenseFactory; use App\Jobs\Util\SystemLogger; use App\Libraries\MultiDB; use App\Models\ClientContact; -use App\Models\Company; +use App\Models\Company; use App\Models\SystemLog; use App\Models\VendorContact; use App\Services\InboundMail\InboundMail; @@ -99,13 +99,13 @@ class InboundMailEngine // sender occured in more than 500 emails in the last 12 hours $senderMailCountTotal = Cache::get('inboundMailCountSender:' . $from, 0); - if ($senderMailCountTotal >= 5000) { + if ($senderMailCountTotal >= config('global_inbound_sender_permablock_mailcount')) { nlog('E-Mail blocked permanent, because the sender sended more than ' . $senderMailCountTotal . ' emails in the last 12 hours: ' . $from); $this->blockSender($from); $this->saveMeta($from, $to); return true; } - if ($senderMailCountTotal >= 1000) { + if ($senderMailCountTotal >= config('global_inbound_sender_block_mailcount')) { nlog('E-Mail blocked, because the sender sended more than ' . $senderMailCountTotal . ' emails in the last 12 hours: ' . $from); $this->saveMeta($from, $to); return true; @@ -113,7 +113,7 @@ class InboundMailEngine // sender sended more than 50 emails to the wrong mailbox in the last 6 hours $senderMailCountUnknownRecipent = Cache::get('inboundMailCountSenderUnknownRecipent:' . $from, 0); - if ($senderMailCountUnknownRecipent >= 50) { + if ($senderMailCountUnknownRecipent >= config('company_inbound_sender_block_unknown_reciepent')) { nlog('E-Mail blocked, because the sender sended more than ' . $senderMailCountUnknownRecipent . ' emails to the wrong mailbox in the last 6 hours: ' . $from); $this->saveMeta($from, $to); return true; diff --git a/config/ninja.php b/config/ninja.php index 0a5ea312d77d..f800871d3a48 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -235,7 +235,11 @@ return [ ], 'inbound_mailbox' => [ 'expense_mailbox_endings' => env('EXPENSE_MAILBOX_ENDINGS', '@expense.invoicing.co'), - 'inbound_webhook_key' => env('INBOUND_WEBHOOK_KEY', null) + 'inbound_webhook_key' => env('INBOUND_WEBHOOK_KEY', null), + 'global_inbound_sender_block_mailcount' => env('GLOBAL_INBOUND_SENDER_BLOCK_MAILCOUNT', 1000), + 'global_inbound_sender_permablock_mailcount' => env('GLOBAL_INBOUND_SENDER_PERMABLOCK_MAILCOUNT', 5000), + 'company_inbound_sender_block_unknown_reciepent' => env('COMPANY_INBOUND_SENDER_BLOCK_UNKNOWN_RECIEPENT', 50), + 'global_inbound_sender_permablock_unknown_reciepent' => env('GLOBAL_INBOUND_SENDER_PERMABLOCK_UNKNOWN_RECIEPENT', 5000), ], 'cloudflare' => [ 'turnstile' => [