From: Vincent Vanwaelscappel Date: Thu, 4 May 2023 09:47:45 +0000 (+0200) Subject: wait #5906 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1d8edc7888b64e4faec4d4de5112511f7d91cff1;p=fluidbook-toolbox.git wait #5906 @0.75 --- diff --git a/app/Models/TeamEmails.php b/app/Models/TeamEmails.php index 08f3f8c3b..01d324727 100644 --- a/app/Models/TeamEmails.php +++ b/app/Models/TeamEmails.php @@ -27,11 +27,11 @@ class TeamEmails extends CubistMagicAbstractModel $this->addField('domains', Table::class, __('Domaines'), ['entity_singular' => __('un domaine'), 'columns' => ['domaine' => __('Domaine')], 'translatable' => false, 'tab' => __('Comptes et redirections')]); $this->addField('mailboxes', Table::class, __('Boîtes mail'), ['entity_singular' => __('une boîte mail'), 'columns' => ['mailbox' => __('E-mail'), 'password' => __('Mot de passe')], 'translatable' => false, 'hint' => __('Laisser le mot de passe vide pour utiliser celui du compte "Toolbox"'), 'tab' => __('Comptes et redirections')]); $this->addField('aliases', Table::class, __('Redirections'), ['entity_singular' => __('une redirection'), 'columns' => ['from' => __('Alias'), 'dest' => __('Destinations')], 'translatable' => false, 'tab' => __('Comptes et redirections')]); - $this->addField('ip_whitelist', Table::class, __('Liste blanche IP'), ['tab' => __('Listes blanches et noires'), 'entity_singular' => __('une IP'), 'columns' => ['ip' => __('IP ou nom d\'hôte')], 'translatable' => false, 'hint' => __('IP qui sont sur la liste blanche (fail2ban, my_networks)')]); - $this->addField('postgrey_whitelist', Code::class, __('Liste blanche postgrey'), ['translatable' => false, 'tab' => __('Listes blanches et noires'), 'language' => 'properties', 'hint' => __('Serveurs ignorés par le Grey listing')]); - $this->addField('spam_whitelist', Table::class, __('Liste blanche SPAM'), ['tab' => __('Listes blanches et noires'), 'entity_singular' => __('un e-mail'), 'columns' => ['email' => __('E-mail')], 'translatable' => false, 'hint' => __('Les e-mails provenant de ces expéditeurs ne sont jamais considérés comme des spam (expressions régulières possibles)')]); - $this->addField('auth_whitelist', Table::class, __('Liste blanche DMARC/DKIM'), ['tab' => __('Listes blanches et noires'), 'entity_singular' => __('un domaine'), 'columns' => ['domain' => __('Domaine')], 'translatable' => false, 'hint' => __('Les e-mails provenant de ces domaines ne sont pas vérifiés par DMARC et DKIM')]); - $this->addField('spam_blacklist', Table::class, __('Liste noire SPAM'), ['tab' => __('Listes blanches et noires'), 'entity_singular' => __('un e-mail'), 'columns' => ['email' => __('E-mail')], 'translatable' => false, 'hint' => __('Ces e-mails sont toujours considérés comme des spam (expressions régulières possibles)')]); + $this->addField('ip_whitelist', Table::class, __('Liste blanche IP'), ['tab' => __('Listes blanches'), 'entity_singular' => __('une IP'), 'columns' => ['ip' => __('IP ou nom d\'hôte')], 'translatable' => false, 'hint' => __('IP qui sont sur la liste blanche (fail2ban, my_networks)')]); + $this->addField('postgrey_whitelist', Code::class, __('Liste blanche postgrey'), ['translatable' => false, 'tab' => __('Listes blanches'), 'language' => 'properties', 'hint' => __('Serveurs ignorés par le Grey listing')]); + $this->addField('spam_whitelist', Table::class, __('Liste blanche SPAM'), ['tab' => __('Listes blanches'), 'entity_singular' => __('un e-mail'), 'columns' => ['email' => __('E-mail')], 'translatable' => false, 'hint' => __('Les e-mails provenant de ces expéditeurs ne sont jamais considérés comme des spam (expressions régulières possibles)')]); + $this->addField('auth_whitelist', Table::class, __('Liste blanche DMARC/DKIM'), ['tab' => __('Listes blanches'), 'entity_singular' => __('un domaine'), 'columns' => ['domain' => __('Domaine')], 'translatable' => false, 'hint' => __('Les e-mails provenant de ces domaines ne sont pas vérifiés par DMARC et DKIM')]); + $this->addField('spam_blacklist', Table::class, __('Liste noire SPAM'), ['tab' => __('Listes noires'), 'entity_singular' => __('un e-mail'), 'columns' => ['email' => __('E-mail')], 'translatable' => false, 'hint' => __('Ces e-mails sont toujours considérés comme des spam (expressions régulières possibles)')]); } @@ -46,6 +46,7 @@ class TeamEmails extends CubistMagicAbstractModel $ip = json_decode($this->ip_whitelist, true); $spam_whitelist = json_decode($this->spam_whitelist, true); $spam_blacklist = json_decode($this->spam_blacklist, true); + $auth_whitelist = json_decode($this->auth_whitelist, true); $spam_bl = []; foreach ($spam_blacklist as $item) { @@ -56,6 +57,11 @@ class TeamEmails extends CubistMagicAbstractModel $spam_wl[] = 'whitelist_from ' . $item['email']; } + $auth_wl = []; + foreach ($auth_whitelist as $item) { + $auth_wl[] = $item['domain']; + } + $accounts = []; foreach ($mailboxes as $k => $m) { @@ -146,7 +152,7 @@ class TeamEmails extends CubistMagicAbstractModel file_put_contents(storage_path('emailconfig/whitelist_clients.local'), str_replace("\r\n", "\n", $this->postgrey_whitelist)); // OpenDMARC - file_put_contents(storage_path('emailconfig/opendmarc_whitelist'), json_decode($this->auth_whitelist, true)); + file_put_contents(storage_path('emailconfig/opendmarc.whitelist'), implode("\n", $auth_wl)); // IP Whitelist $my_networks = [];