parent
4fc4070458
commit
507aea2c66
7 changed files with 72 additions and 2 deletions
@ -0,0 +1,38 @@ |
||||
#!/bin/bash |
||||
|
||||
HOME=/root |
||||
|
||||
SOGOWL=$(/sbin/e-smith/db configuration getprop sogod AutoWhiteList || $(echo no)) |
||||
|
||||
if [ "$SOGOWL" != 'yes' ]; then |
||||
exit 0 |
||||
fi |
||||
|
||||
OLDMD5=$(md5sum /etc/mail/spamassassin/sogo_whitelist) |
||||
|
||||
/usr/bin/mysql <<'EOF' | grep -iE "^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" \ |
||||
| tr '[:upper:]' '[:lower:]' | 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 |
||||
|
||||
NEWMD5=$(md5sum /etc/mail/spamassassin/sogo_whitelist) |
||||
|
||||
if [ "$OLDMD5" != "$NEWMD5" ]; then |
||||
/usr/bin/sv h /service/spamd |
||||
fi |
||||
|
@ -0,0 +1 @@ |
||||
no |
@ -0,0 +1,12 @@ |
||||
{ |
||||
|
||||
my $sogowl = $sogod{'AutoWhiteList'} || 'no'; |
||||
|
||||
if ($sogowl eq 'yes'){ |
||||
$OUT .= 'include sogo_whitelist'; |
||||
} |
||||
else{ |
||||
$OUT .= ''; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue