public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Rspamd] Mime from and rcpt can now be checked by from_mime and rcpt_mime
e04e15ed
data/conf/rspamd/dynmaps/settings.php | 43 +++++++++--------------------------
1 file changed, 11 insertions(+), 32 deletions(-)
Diff
diff --git a/data/conf/rspamd/dynmaps/settings.php b/data/conf/rspamd/dynmaps/settings.php
index 4d78456e..3d42bcf3 100644
--- a/data/conf/rspamd/dynmaps/settings.php
+++ b/data/conf/rspamd/dynmaps/settings.php
@@ -107,8 +107,8 @@ function ucl_rcpts($object, $type) {
settings {
watchdog {
priority = 10;
- rcpt = "/null@localhost/i";
- from = "/watchdog@localhost/i";
+ rcpt_mime = "/null@localhost/i";
+ from_mime = "/watchdog@localhost/i";
apply "default" {
actions {
reject = 9999.0;
@@ -199,12 +199,13 @@ while ($row = array_shift($rows)) {
?>
whitelist_<?=$username_sane;?> {
<?php
+ $list_items = array();
$stmt = $pdo->prepare("SELECT `value` FROM `filterconf`
WHERE `object`= :object
AND `option` = 'whitelist_from'");
$stmt->execute(array(':object' => $row['object']));
$list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
- while ($item = array_shift($list_items)) {
+ foreach ($list_items as $item) {
?>
from = "/<?='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
<?php
@@ -237,24 +238,13 @@ while ($row = array_shift($rows)) {
"MAILCOW_WHITE"
]
}
- whitelist_header_<?=$username_sane;?> {
+ whitelist_mime_<?=$username_sane;?> {
<?php
- $header_from = array();
- $stmt = $pdo->prepare("SELECT `value` FROM `filterconf`
- WHERE `object`= :object
- AND `option` = 'whitelist_from'");
- $stmt->execute(array(':object' => $row['object']));
- $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($list_items as $item) {
?>
- header = {
+ from_mime = "/<?='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
<?php
- while ($item = array_shift($list_items)) {
- $header_from[] = str_replace('\*', '.*', preg_quote($item['value'], '/'));
}
-?>
- "From" = "/(<?=implode('|', $header_from);?>)/i";
- }
-<?php
if (!filter_var(trim($row['object']), FILTER_VALIDATE_EMAIL)) {
?>
priority = 5;
@@ -297,13 +287,13 @@ while ($row = array_shift($rows)) {
?>
blacklist_<?=$username_sane;?> {
<?php
- $items[] = array();
+ $list_items = array();
$stmt = $pdo->prepare("SELECT `value` FROM `filterconf`
WHERE `object`= :object
AND `option` = 'blacklist_from'");
$stmt->execute(array(':object' => $row['object']));
$list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
- while ($item = array_shift($list_items)) {
+ foreach ($list_items as $item) {
?>
from = "/<?='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
<?php
@@ -338,22 +328,11 @@ while ($row = array_shift($rows)) {
}
blacklist_header_<?=$username_sane;?> {
<?php
- $header_from = array();
- $stmt = $pdo->prepare("SELECT `value` FROM `filterconf`
- WHERE `object`= :object
- AND `option` = 'blacklist_from'");
- $stmt->execute(array(':object' => $row['object']));
- $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($list_items as $item) {
?>
- header = {
+ from_mime = "/<?='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
<?php
- while ($item = array_shift($list_items)) {
- $header_from[] = str_replace('\*', '.*', preg_quote($item['value'], '/'));
}
-?>
- "From" = "/(<?=implode('|', $header_from);?>)/i";
- }
-<?php
if (!filter_var(trim($row['object']), FILTER_VALIDATE_EMAIL)) {
?>
priority = 5;