forked from mxroute/rspamd_rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenable_rspamd.sh
32 lines (28 loc) · 1.09 KB
/
enable_rspamd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# Enable rspamd for all accounts
# If they have no filters configured, give them a baseline
for i in $(find /etc/virtual -name filter.conf)
do
if ! grep -q "high_score_block" $i; then
echo "high_score=25" >> $i
echo "high_score_block=yes" >> $i
echo "where=delete" >> $i
fi
done
# Rspamd configs won't be generated by DirectAdmin unless user_prefs exists, so handle it
for username in $(ls /usr/local/directadmin/data/users);
do
DIR=/home/$username/.spamassassin
mkdir -p $DIR
UP=$DIR/user_prefs
if [ ! -s ${UP} ]; then
echo 'required_score 25.0' > ${UP}
echo 'report_safe 1' >> ${UP}
chown $username:$username ${UP}
chmod 644 ${UP}
fi
chown ${username}:mail $DIR
chmod 771 $DIR
done
# Rewrite Rspamd configs for users
echo "action=rewrite&value=rspamd" >> /usr/local/directadmin/data/task.queue