parent
4fc4070458
commit
987296a53c
6 changed files with 61 additions and 2 deletions
@ -0,0 +1,29 @@ |
||||
#!/bin/bash |
||||
|
||||
HOME=/root |
||||
|
||||
SOGOWL=$(/sbin/e-smith/db/configuration getprop sogod AutoWhiteList || $(echo no)) |
||||
|
||||
if [ "$SOGOWL" != 'yes' ]; then |
||||
exit 0 |
||||
fi |
||||
|
||||
/usr/bin/mysql <<'EOF' | grep -iE "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" | sed -e 's/^/whitelist_from /' > /etc/mail/spamassassin/sogo_whitelist |
||||
connect sogo; |
||||
SELECT CONCAT( |
||||
'SELECT * FROM (SELECT c_mail FROM ', |
||||
GROUP_CONCAT(tb SEPARATOR ' UNION SELECT c_mail FROM '), |
||||
') AS emails ORDER BY c_mail' |
||||
) |
||||
INTO @mailquery FROM |
||||
( |
||||
SELECT TABLE_NAME tb |
||||
FROM INFORMATION_SCHEMA.COLUMNS |
||||
WHERE column_name LIKE 'c_mail' |
||||
AND TABLE_SCHEMA='sogo' |
||||
) AS tbls; |
||||
PREPARE stmt FROM @mailquery; |
||||
EXECUTE stmt; |
||||
DEALLOCATE PREPARE stmt; |
||||
EOF |
||||
|
@ -0,0 +1,12 @@ |
||||
{ |
||||
|
||||
my $sogowl = $sogod{'AutoWhiteList'} || 'no'; |
||||
|
||||
if ($sogowl eq 'yes'){ |
||||
$OUT .= 'include sogo_whitelist'; |
||||
} |
||||
else{ |
||||
$OUT .= ''; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue