Add the possibility to put contacts in whitelist
This commit is contained in:
parent
4fc4070458
commit
507aea2c66
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
%define version 0.2.0
|
%define version 0.2.1
|
||||||
%define release 1
|
%define release 1.beta0
|
||||||
%define name ipasserelle-groupware
|
%define name ipasserelle-groupware
|
||||||
|
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -33,6 +33,9 @@ Based on smeserver-sogo from nethesis
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 24 2012 Daniel Berteaud <daniel@firewall-services.com> - 0.2.1-1.sme
|
||||||
|
- Add the possibility to put contacts in whitelist
|
||||||
|
|
||||||
* Wed Mar 14 2012 Daniel Berteaud <daniel@firewall-services.com> - 0.2.0-1.sme
|
* Wed Mar 14 2012 Daniel Berteaud <daniel@firewall-services.com> - 0.2.0-1.sme
|
||||||
- Migrate to git
|
- Migrate to git
|
||||||
|
|
||||||
|
@ -132,6 +135,7 @@ rm -f %{name}-%{version}-filelist
|
||||||
--file /var/service/memcached-sogo/log/run 'attr(0755, root, root)' \
|
--file /var/service/memcached-sogo/log/run 'attr(0755, root, root)' \
|
||||||
--dir /var/log/memcached-sogo 'attr(0700, sogo, sogo)' \
|
--dir /var/log/memcached-sogo 'attr(0700, sogo, sogo)' \
|
||||||
--file /etc/cron.hourly/sogo-sessions 'attr(0755, root, root)' \
|
--file /etc/cron.hourly/sogo-sessions 'attr(0755, root, root)' \
|
||||||
|
--file /etc/cron.daily/sogo_whitelist 'attr(0755, root, root)' \
|
||||||
$RPM_BUILD_ROOT > %{name}-%{version}-%{release}-filelist
|
$RPM_BUILD_ROOT > %{name}-%{version}-%{release}-filelist
|
||||||
|
|
||||||
%files -f %{name}-%{version}-%{release}-filelist
|
%files -f %{name}-%{version}-%{release}-filelist
|
||||||
|
|
38
root/etc/cron.daily/sogo_whitelist
Normal file
38
root/etc/cron.daily/sogo_whitelist
Normal file
|
@ -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
|
|
@ -59,4 +59,12 @@
|
||||||
<base>ALLOWED_OR_NOT</base>
|
<base>ALLOWED_OR_NOT</base>
|
||||||
<trans>Autorisé ?</trans>
|
<trans>Autorisé ?</trans>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<base>AUTO_WL_DESC</base>
|
||||||
|
<trans>Cette option permet de placer automatiquement les contacts des différents carnets d'adresses en liste blanche, afin que leurs mails ne soient jamais considérés comme spam</trans>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<base>AUTO_WL</base>
|
||||||
|
<trans>Contacts en liste blanche</trans>
|
||||||
|
</entry>
|
||||||
</lexicon>
|
</lexicon>
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
|
||||||
|
my $sogowl = $sogod{'AutoWhiteList'} || 'no';
|
||||||
|
|
||||||
|
if ($sogowl eq 'yes'){
|
||||||
|
$OUT .= 'include sogo_whitelist';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$OUT .= '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -65,6 +65,12 @@ __DATA__
|
||||||
<description>PUBLIC_ACCESS_DESC</description>
|
<description>PUBLIC_ACCESS_DESC</description>
|
||||||
<label>PUBLIC_ACCESS</label>
|
<label>PUBLIC_ACCESS</label>
|
||||||
</field>
|
</field>
|
||||||
|
<field type="select" id="autoWhiteList" options="'yes' =>
|
||||||
|
'YES', 'no' => 'NO'"
|
||||||
|
value="get_prop('AutoWhiteList')">
|
||||||
|
<description>AUTO_WL_DESC</description>
|
||||||
|
<label>AUTO_WL</label>
|
||||||
|
</field>
|
||||||
<field type="literal" id="allowed_groups_desc"
|
<field type="literal" id="allowed_groups_desc"
|
||||||
value="">
|
value="">
|
||||||
<description>ALLOWED_GROUPS_DESC</description>
|
<description>ALLOWED_GROUPS_DESC</description>
|
||||||
|
|
|
@ -110,6 +110,7 @@ sub apply {
|
||||||
$configdb->set_prop('sogod', 'EMailAlarms', $q->param("mailAlarm"));
|
$configdb->set_prop('sogod', 'EMailAlarms', $q->param("mailAlarm"));
|
||||||
$configdb->set_prop('sogod', 'AuxiliaryUserAccounts', $q->param("auxAccounts"));
|
$configdb->set_prop('sogod', 'AuxiliaryUserAccounts', $q->param("auxAccounts"));
|
||||||
$configdb->set_prop('sogod', 'PublicAccess', $q->param("publicAccess"));
|
$configdb->set_prop('sogod', 'PublicAccess', $q->param("publicAccess"));
|
||||||
|
$configdb->set_prop('sogod', 'AutoWhiteList', $q->param("autoWhiteList"));
|
||||||
$configdb->set_prop('sogod', 'AllowedGroups', join(',', $q->param("allowedGroups")));
|
$configdb->set_prop('sogod', 'AllowedGroups', join(',', $q->param("allowedGroups")));
|
||||||
|
|
||||||
unless ( system ("/sbin/e-smith/signal-event", "email-update") == 0 ){
|
unless ( system ("/sbin/e-smith/signal-event", "email-update") == 0 ){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user