Wednesday, March 19, 2008

How to enable Spamassin for new accounts

By default (if enabled), DA gives the User the option to enable spamassassin, but it is not turned on by default.

To have it on by default, you can use the user_create_post.sh script to create it for you.

Create:
/usr/local/directadmin/scripts/custom/user_create_post.sh

in it, add:

#!/bin/sh
if [ "$spam" = "ON" ]; then
DIR=/home/$username/.spamassassin
mkdir $DIR
touch $DIR/user_prefs #or this is where you'd copy the default user_prefs you want them to have, instead of "touch".
chown ${username}:mail $DIR
chmod 771 $DIR
chown $username:$username $DIR/user_prefs
chmod 755 $DIR/user_prefs
touch $DIR/spam
chown mail:$username $DIR/spam
chmod 660 $DIR/spam
fi
exit 0;

Once created, save it and chmod the user_create_post.sh to 755.


This script can be used to also enable spamassassin for all existing accounts. You can create a simple script to do it:

#!/bin/sh
for i in `ls /usr/local/directadmin/data/users`; do
{
username=$i spam=ON /usr/local/directadmin/scripts/custom/user_create_post.sh
};
done;
exit 0;

No comments: