mirror of
				https://github.com/mail-in-a-box/mailinabox.git
				synced 2025-11-03 19:30:54 +00:00 
			
		
		
		
	tweak the site-wide bayesian spam filtering config
This commit is contained in:
		
							parent
							
								
									b5bb12d0d2
								
							
						
					
					
						commit
						d06bfa6c1b
					
				
							
								
								
									
										10
									
								
								setup/spamassassin.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										10
									
								
								setup/spamassassin.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
# Spam filtering with spamassassin via spampd
 | 
					# Spam filtering with spamassassin via spampd
 | 
				
			||||||
#############################################
 | 
					#############################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -9,6 +10,7 @@
 | 
				
			|||||||
# plugin. The tools/mail.py tool creates the necessary sieve script for each mail
 | 
					# plugin. The tools/mail.py tool creates the necessary sieve script for each mail
 | 
				
			||||||
# user when the mail user is created.
 | 
					# user when the mail user is created.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source /etc/mailinabox.conf # get global vars
 | 
				
			||||||
source setup/functions.sh # load our functions
 | 
					source setup/functions.sh # load our functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install packages.
 | 
					# Install packages.
 | 
				
			||||||
@ -35,7 +37,7 @@ sudo sed -i "s/#mail_plugins = .*/mail_plugins = \$mail_plugins antispam/" /etc/
 | 
				
			|||||||
# from http://wiki2.dovecot.org/Plugins/Antispam
 | 
					# from http://wiki2.dovecot.org/Plugins/Antispam
 | 
				
			||||||
cat > /usr/bin/sa-learn-pipe.sh << EOF;
 | 
					cat > /usr/bin/sa-learn-pipe.sh << EOF;
 | 
				
			||||||
cat<&0 >> /tmp/sendmail-msg-\$\$.txt
 | 
					cat<&0 >> /tmp/sendmail-msg-\$\$.txt
 | 
				
			||||||
/usr/bin/sa-learn \$* /tmp/sendmail-msg-\$\$.txt --username user-data > /dev/null
 | 
					/usr/bin/sa-learn \$* /tmp/sendmail-msg-\$\$.txt > /dev/null
 | 
				
			||||||
rm -f /tmp/sendmail-msg-\$\$.txt
 | 
					rm -f /tmp/sendmail-msg-\$\$.txt
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
@ -53,14 +55,14 @@ plugin {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Configure spamassassin to use site-wide bayesian filtering
 | 
					# Tell spamassassin where to load and store site-wide bayesean filtering data.
 | 
				
			||||||
source /etc/mailinabox.conf # get global vars
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkdir -p $STORAGE_ROOT/mail/spamassassin
 | 
					mkdir -p $STORAGE_ROOT/mail/spamassassin
 | 
				
			||||||
chown -R mail:mail $STORAGE_ROOT/mail/spamassassin
 | 
					chown -R mail:mail $STORAGE_ROOT/mail/spamassassin
 | 
				
			||||||
chmod -R 775 $STORAGE_ROOT/mail/spamassassin
 | 
					chmod -R 775 $STORAGE_ROOT/mail/spamassassin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tools/editconf.py /etc/spamassassin/local.cf -s bayes_path=$STORAGE_ROOT/mail/spamassassin/bayes
 | 
					tools/editconf.py /etc/spamassassin/local.cf -s \
 | 
				
			||||||
 | 
						bayes_path=$STORAGE_ROOT/mail/spamassassin/bayes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Initial training?
 | 
					# Initial training?
 | 
				
			||||||
# sa-learn --ham storage/mail/mailboxes/*/*/cur/
 | 
					# sa-learn --ham storage/mail/mailboxes/*/*/cur/
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user