I use a very old method for that which I learned here from forum or docs, don't remember. Maybe it can still be found in the docs somewhere.
But it's quite easy, this is what I did.
1.) Create a user, then configure the Spamassassin settings the way you want to use them.
This wil create the following files:
/etc/virtual/domain.com/filter
/etc/virtual/domain.com/filter.conf
/home/username/.spamassassin/user.prefs
2.) Create a directory, for example in /root and give it a name for example antispam.
Now copy the above files to the /root/antispam folder. Now you have a default set of settings which you can start using.
3.) In the /usr/local/directadmin/scripts/custom directory create the following files:
user_create_post.sh with the following content:
Code:
#!/bin/sh
if [ "$spam" = "ON" ]; then
DIR=/home/$username/.spamassassin
mkdir $DIR
cp -f /root/antispam/user_prefs $DIR/user_prefs
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;
Change owner to directadmin and make executable, should look like this:
-rwx------. 1 diradmin diradmin 458 2017-11-10 15:24 user_create_post.sh
As you can see above, it also works for domains, so in the same directory also create a file called domain_create_post.sh which should look like this:
-rwx------. 1 diradmin diradmin 338 2014-01-08 04:05 domain_create_post.sh
Then put the following content in there:
Code:
#!/bin/sh
cp -f /root/antispam/filter /etc/virtual/$domain/filter >/dev/null 2>&1
cp -f /root/antispam/filter.conf /etc/virtual/$domain/filter.conf >/dev/null 2>&1
chown mail:mail /etc/virtual/$domain/filter
chown mail:mail /etc/virtual/$domain/filter.conf
chmod 640 /etc/virtual/$domain/filter
chmod 600 /etc/virtual/$domain/filter.conf
Now for every new account and new domain these settings will be used.
I don't know the correct code to copy these settings for all users but you can figure it out or maybe someone else can tell you how to copy these to all existing users.