Parcourir la source

Ignore tripwire emails if there are no violations

Bob Mottram il y a 9 ans
Parent
révision
9a4cacde23

+ 0
- 4
locale/de/freedombone-image-customise.json Voir le fichier

@@ -6,10 +6,6 @@
6 6
     "\n .---.                  .              .\n |                      |              |\n |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.\n |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'\n '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'\n\n                    Initial base install\n\nYour system is not yet installed. To complete the process run the\nfollowing commands, then enter your details.\n\n    sudo su\n    ${PROJECT_NAME} menuconfig\n\n": "",
7 7
     "Using ssh public key:": "",
8 8
     "Install failed. Press x to continue...": "",
9
-    "File not found /usr/local/bin/tox-bootstrapd": "",
10
-    "Account to run Tox's DHT bootstrap daemon": "",
11
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
12
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
13 9
     "warning: creating initial user $username with well known password!": "",
14 10
     "info: killing leftover processes in chroot": ""
15 11
 }

+ 1
- 4
locale/de/freedombone.json Voir le fichier

@@ -60,6 +60,7 @@
60 60
     "Please plug in the OneRNG device": "",
61 61
     "ERROR: Exim does not appear to have installed. $CHECK_MESSAGE": "",
62 62
     "Added onion site for ${onion_service_name}": "",
63
+    "# Tripwire reports which have no violations don't need to be logged": "",
63 64
     "ERROR: Dovecot does not appear to have installed. $CHECK_MESSAGE": "",
64 65
     "Unknown subkey usage: $GPG_KEY_USAGE": "",
65 66
     "Public key:  $MY_GPG_PUBLIC_KEY": "",
@@ -97,10 +98,6 @@
97 98
     "Note that there's a usability/security trade-off made here.": "",
98 99
     "In order to allow git clone via http we don't redirect everything": "",
99 100
     "should change /etc/nginx/sites-available/$GIT_DOMAIN_NAME to redirect everything over https.": "",
100
-    "File not found /usr/local/bin/tox-bootstrapd": "",
101
-    "Account to run Tox's DHT bootstrap daemon": "",
102
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
103
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
104 101
     "Your Tox node public key is": "",
105 102
     "tox onion domain: ${TOX_ONION_HOSTNAME}": "",
106 103
     "Your Tox node public key is: $TOX_PUBLIC_KEY": "",

+ 0
- 4
locale/es/freedombone-image-customise.json Voir le fichier

@@ -6,10 +6,6 @@
6 6
     "\n .---.                  .              .\n |                      |              |\n |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.\n |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'\n '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'\n\n                    Initial base install\n\nYour system is not yet installed. To complete the process run the\nfollowing commands, then enter your details.\n\n    sudo su\n    ${PROJECT_NAME} menuconfig\n\n": "",
7 7
     "Using ssh public key:": "",
8 8
     "Install failed. Press x to continue...": "",
9
-    "File not found /usr/local/bin/tox-bootstrapd": "",
10
-    "Account to run Tox's DHT bootstrap daemon": "",
11
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
12
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
13 9
     "warning: creating initial user $username with well known password!": "",
14 10
     "info: killing leftover processes in chroot": ""
15 11
 }

+ 1
- 4
locale/es/freedombone.json Voir le fichier

@@ -60,6 +60,7 @@
60 60
     "Please plug in the OneRNG device": "",
61 61
     "ERROR: Exim does not appear to have installed. $CHECK_MESSAGE": "",
62 62
     "Added onion site for ${onion_service_name}": "",
63
+    "# Tripwire reports which have no violations don't need to be logged": "",
63 64
     "ERROR: Dovecot does not appear to have installed. $CHECK_MESSAGE": "",
64 65
     "Unknown subkey usage: $GPG_KEY_USAGE": "",
65 66
     "Public key:  $MY_GPG_PUBLIC_KEY": "",
@@ -97,10 +98,6 @@
97 98
     "Note that there's a usability/security trade-off made here.": "",
98 99
     "In order to allow git clone via http we don't redirect everything": "",
99 100
     "should change /etc/nginx/sites-available/$GIT_DOMAIN_NAME to redirect everything over https.": "",
100
-    "File not found /usr/local/bin/tox-bootstrapd": "",
101
-    "Account to run Tox's DHT bootstrap daemon": "",
102
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
103
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
104 101
     "Your Tox node public key is": "",
105 102
     "tox onion domain: ${TOX_ONION_HOSTNAME}": "",
106 103
     "Your Tox node public key is: $TOX_PUBLIC_KEY": "",

+ 0
- 4
locale/fr/freedombone-image-customise.json Voir le fichier

@@ -6,10 +6,6 @@
6 6
     "\n .---.                  .              .\n |                      |              |\n |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.\n |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'\n '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'\n\n                    Initial base install\n\nYour system is not yet installed. To complete the process run the\nfollowing commands, then enter your details.\n\n    sudo su\n    ${PROJECT_NAME} menuconfig\n\n": "",
7 7
     "Using ssh public key:": "",
8 8
     "Install failed. Press x to continue...": "",
9
-    "File not found /usr/local/bin/tox-bootstrapd": "",
10
-    "Account to run Tox's DHT bootstrap daemon": "",
11
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
12
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
13 9
     "warning: creating initial user $username with well known password!": "",
14 10
     "info: killing leftover processes in chroot": ""
15 11
 }

+ 1
- 4
locale/fr/freedombone.json Voir le fichier

@@ -60,6 +60,7 @@
60 60
     "Please plug in the OneRNG device": "",
61 61
     "ERROR: Exim does not appear to have installed. $CHECK_MESSAGE": "",
62 62
     "Added onion site for ${onion_service_name}": "",
63
+    "# Tripwire reports which have no violations don't need to be logged": "",
63 64
     "ERROR: Dovecot does not appear to have installed. $CHECK_MESSAGE": "",
64 65
     "Unknown subkey usage: $GPG_KEY_USAGE": "",
65 66
     "Public key:  $MY_GPG_PUBLIC_KEY": "",
@@ -97,10 +98,6 @@
97 98
     "Note that there's a usability/security trade-off made here.": "",
98 99
     "In order to allow git clone via http we don't redirect everything": "",
99 100
     "should change /etc/nginx/sites-available/$GIT_DOMAIN_NAME to redirect everything over https.": "",
100
-    "File not found /usr/local/bin/tox-bootstrapd": "",
101
-    "Account to run Tox's DHT bootstrap daemon": "",
102
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf": "",
103
-    "File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.service": "",
104 101
     "Your Tox node public key is": "",
105 102
     "tox onion domain: ${TOX_ONION_HOSTNAME}": "",
106 103
     "Your Tox node public key is: $TOX_PUBLIC_KEY": "",

+ 188
- 181
src/freedombone Voir le fichier

@@ -4555,6 +4555,13 @@ function create_procmail {
4555 4555
         echo 'DEFAULT=$MAILDIR/' >> /home/$MY_USERNAME/.procmailrc
4556 4556
         echo 'LOGFILE=$HOME/log/procmail.log' >> /home/$MY_USERNAME/.procmailrc
4557 4557
         echo 'LOGABSTRACT=all' >> /home/$MY_USERNAME/.procmailrc
4558
+        echo '' >> /home/$MY_USERNAME/.procmailrc
4559
+		echo $"# Tripwire reports which have no violations don't need to be logged" >> /home/$MY_USERNAME/.procmailrc
4560
+		echo ':0 BD:' >> /home/$MY_USERNAME/.procmailrc
4561
+		TRIPWIRE_VIOLATIONS_STR=$'Total violations found:  0'
4562
+		echo "  * .*$TRIPWIRE_VIOLATIONS_STR" >> /home/$MY_USERNAME/.procmailrc
4563
+		echo '/dev/null' >> /home/$MY_USERNAME/.procmailrc
4564
+        echo '' >> /home/$MY_USERNAME/.procmailrc
4558 4565
         chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
4559 4566
     fi
4560 4567
 
@@ -4606,141 +4613,141 @@ function spam_filtering {
4606 4613
     echo 'warn  message = X-Spam-Report: $spam_report' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4607 4614
     echo '      spam = nobody' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4608 4615
     echo '# reject spam at high scores (> 12)' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4609
-    echo 'deny  message = This message scored $spam_score spam points.' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4610
-    echo '      spam = nobody:true' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4611
-    echo '      condition = ${if >{$spam_score_int}{120}{1}{0}}' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4612
-    # procmail configuration
4613
-    echo '# get spamassassin to check emails' >> /home/$MY_USERNAME/.procmailrc
4614
-    echo ':0fw: .spamassassin.lock' >> /home/$MY_USERNAME/.procmailrc
4615
-    echo '  * < 256000' >> /home/$MY_USERNAME/.procmailrc
4616
-    echo '| spamc' >> /home/$MY_USERNAME/.procmailrc
4617
-    echo '# strong spam are discarded' >> /home/$MY_USERNAME/.procmailrc
4618
-    echo ':0' >> /home/$MY_USERNAME/.procmailrc
4619
-    echo '  * ^X-Spam-Level: \*\*\*\*\*\*' >> /home/$MY_USERNAME/.procmailrc
4620
-    echo '/dev/null' >> /home/$MY_USERNAME/.procmailrc
4621
-    echo '# weak spam are kept just in case - clear this out every now and then' >> /home/$MY_USERNAME/.procmailrc
4622
-    echo ':0' >> /home/$MY_USERNAME/.procmailrc
4623
-    echo '  * ^X-Spam-Level: \*\*\*\*\*' >> /home/$MY_USERNAME/.procmailrc
4624
-    echo 'maybe-spam/' >> /home/$MY_USERNAME/.procmailrc
4625
-    echo '# otherwise, marginal spam goes here for revision' >> /home/$MY_USERNAME/.procmailrc
4626
-    echo ':0' >> /home/$MY_USERNAME/.procmailrc
4627
-    echo '  * ^X-Spam-Level: \*\*' >> /home/$MY_USERNAME/.procmailrc
4628
-    echo 'spam/' >> /home/$MY_USERNAME/.procmailrc
4629
-    chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
4630
-    echo '# get spamassassin to check emails' >> /etc/skel/.procmailrc
4631
-    echo ':0fw: .spamassassin.lock' >> /etc/skel/.procmailrc
4632
-    echo '  * < 256000' >> /etc/skel/.procmailrc
4633
-    echo '| spamc' >> /etc/skel/.procmailrc
4634
-    echo '# strong spam are discarded' >> /etc/skel/.procmailrc
4635
-    echo ':0' >> /etc/skel/.procmailrc
4636
-    echo '  * ^X-Spam-Level: \*\*\*\*\*\*' >> /etc/skel/.procmailrc
4637
-    echo '/dev/null' >> /etc/skel/.procmailrc
4638
-    echo '# weak spam are kept just in case - clear this out every now and then' >> /etc/skel/.procmailrc
4639
-    echo ':0' >> /etc/skel/.procmailrc
4640
-    echo '  * ^X-Spam-Level: \*\*\*\*\*' >> /etc/skel/.procmailrc
4641
-    echo 'maybe-spam/' >> /etc/skel/.procmailrc
4642
-    echo '# otherwise, marginal spam goes here for revision' >> /etc/skel/.procmailrc
4643
-    echo ':0' >> /etc/skel/.procmailrc
4644
-    echo '  * ^X-Spam-Level: \*\*' >> /etc/skel/.procmailrc
4645
-    echo 'spam/' >> /etc/skel/.procmailrc
4646
-    # filtering scripts
4647
-    echo '#!/bin/bash' > /usr/bin/filterspam
4648
-    echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
4649
-    echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
4650
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then' >> /usr/bin/filterspam
4651
-    echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
4652
-    echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
4653
-    echo '           exit' >> /usr/bin/filterspam
4654
-    echo '        fi' >> /usr/bin/filterspam
4655
-    echo '        for f in `ls $MAILDIR/cur`' >> /usr/bin/filterspam
4656
-    echo '        do' >> /usr/bin/filterspam
4657
-    echo '            spamc -L spam < "$MAILDIR/cur/$f" > /dev/null' >> /usr/bin/filterspam
4658
-    echo '            rm "$MAILDIR/cur/$f"' >> /usr/bin/filterspam
4659
-    echo '        done' >> /usr/bin/filterspam
4660
-    echo '        for f in `ls $MAILDIR/new`' >> /usr/bin/filterspam
4661
-    echo '        do' >> /usr/bin/filterspam
4662
-    echo '            spamc -L spam < "$MAILDIR/new/$f" > /dev/null' >> /usr/bin/filterspam
4663
-    echo '            rm "$MAILDIR/new/$f"' >> /usr/bin/filterspam
4664
-    echo '        done' >> /usr/bin/filterspam
4665
-    echo '    fi' >> /usr/bin/filterspam
4666
-    echo 'done' >> /usr/bin/filterspam
4667
-    echo 'exit 0' >> /usr/bin/filterspam
4668
-
4669
-    echo '#!/bin/bash' > /usr/bin/filterham
4670
-    echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
4671
-    echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
4672
-    echo '    if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then' >> /usr/bin/filterham
4673
-    echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
4674
-    echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
4675
-    echo '            exit' >> /usr/bin/filterham
4676
-    echo '        fi' >> /usr/bin/filterham
4677
-    echo '        for f in `ls $MAILDIR/cur`' >> /usr/bin/filterham
4678
-    echo '        do' >> /usr/bin/filterham
4679
-    echo '            spamc -L ham < "$MAILDIR/cur/$f" > /dev/null' >> /usr/bin/filterham
4680
-    echo '            rm "$MAILDIR/cur/$f"' >> /usr/bin/filterham
4681
-    echo '        done' >> /usr/bin/filterham
4682
-    echo '        for f in `ls $MAILDIR/new`' >> /usr/bin/filterham
4683
-    echo '        do' >> /usr/bin/filterham
4684
-    echo '            spamc -L ham < "$MAILDIR/new/$f" > /dev/null' >> /usr/bin/filterham
4685
-    echo '            rm "$MAILDIR/new/$f"' >> /usr/bin/filterham
4686
-    echo '        done' >> /usr/bin/filterham
4687
-    echo '    fi' >> /usr/bin/filterham
4688
-    echo 'done' >> /usr/bin/filterham
4689
-    echo 'exit 0' >> /usr/bin/filterham
4690
-
4691
-    if ! grep -q "filterspam" /etc/crontab; then
4692
-        echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterspam" >> /etc/crontab
4693
-    fi
4694
-    if ! grep -q "filterham" /etc/crontab; then
4695
-        echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterham" >> /etc/crontab
4696
-    fi
4697
-    chmod 655 /usr/bin/filterspam /usr/bin/filterham
4698
-    sed -i 's/# use_bayes 1/use_bayes 1/g' /etc/mail/spamassassin/local.cf
4699
-    sed -i 's/# bayes_auto_learn 1/bayes_auto_learn 1/g' /etc/mail/spamassassin/local.cf
4700
-
4701
-    # user preferences
4702
-    if [ ! -d /home/$MY_USERNAME/.spamassassin ]; then
4703
-        mkdir /home/$MY_USERNAME/.spamassassin
4704
-        echo $'# How many points before a mail is considered spam.' > /home/$MY_USERNAME/.spamassassin/user_prefs
4705
-        echo '# required_score        5' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4706
-        echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4707
-        echo $'# Whitelist and blacklist addresses are now file-glob-style patterns, so' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4708
-        echo $'# "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4709
-        echo '# whitelist_from    someone@somewhere.com' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4710
-        echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4711
-        echo $'# Add your own customised scores for some tests below.  The default scores are' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4712
-        echo $'# read from the installed spamassassin rules files, but you can override them' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4713
-        echo $'# here.  To see the list of tests and their default scores, go to' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4714
-        echo '# http://spamassassin.apache.org/tests.html .' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4715
-        echo '#' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4716
-        echo '# score SYMBOLIC_TEST_NAME n.nn' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4717
-        echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4718
-        echo $'# Speakers of Asian languages, like Chinese, Japanese and Korean, will almost' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4719
-        echo $'# definitely want to uncomment the following lines.  They will switch off some' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4720
-        echo $'# rules that detect 8-bit characters, which commonly trigger on mails using CJK' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4721
-        echo $'# character sets, or that assume a western-style charset is in use. ' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4722
-        echo '# ' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4723
-        echo '# score HTML_COMMENT_8BITS  0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4724
-        echo '# score UPPERCASE_25_50     0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4725
-        echo '# score UPPERCASE_50_75     0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4726
-        echo '# score UPPERCASE_75_100    0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4727
-        echo '# score OBSCURED_EMAIL      0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4728
-        echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4729
-        echo $'# Speakers of any language that uses non-English, accented characters may wish' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4730
-        echo $'# to uncomment the following lines.   They turn off rules that fire on' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4731
-        echo $'# misformatted messages generated by common mail apps in contravention of the' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4732
-        echo $'# email RFCs.' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4733
-        echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4734
-        echo '# score SUBJ_ILLEGAL_CHARS      0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4735
-    fi
4736
-    # this must be accessible by root
4737
-    chown -R $MY_USERNAME:root /home/$MY_USERNAME/.spamassassin
4738
-
4739
-    systemctl restart spamassassin
4740
-    systemctl restart exim4
4741
-    systemctl restart cron
4742
-
4743
-    echo 'spam_filtering' >> $COMPLETION_FILE
4616
+	echo 'deny  message = This message scored $spam_score spam points.' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4617
+	echo '      spam = nobody:true' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4618
+	echo '      condition = ${if >{$spam_score_int}{120}{1}{0}}' >> /etc/exim4/conf.d/acl/40_exim4-config_check_data
4619
+	# procmail configuration
4620
+	echo '# get spamassassin to check emails' >> /home/$MY_USERNAME/.procmailrc
4621
+	echo ':0fw: .spamassassin.lock' >> /home/$MY_USERNAME/.procmailrc
4622
+	echo '  * < 256000' >> /home/$MY_USERNAME/.procmailrc
4623
+	echo '| spamc' >> /home/$MY_USERNAME/.procmailrc
4624
+	echo '# strong spam are discarded' >> /home/$MY_USERNAME/.procmailrc
4625
+	echo ':0' >> /home/$MY_USERNAME/.procmailrc
4626
+	echo '  * ^X-Spam-Level: \*\*\*\*\*\*' >> /home/$MY_USERNAME/.procmailrc
4627
+	echo '/dev/null' >> /home/$MY_USERNAME/.procmailrc
4628
+	echo '# weak spam are kept just in case - clear this out every now and then' >> /home/$MY_USERNAME/.procmailrc
4629
+	echo ':0' >> /home/$MY_USERNAME/.procmailrc
4630
+	echo '  * ^X-Spam-Level: \*\*\*\*\*' >> /home/$MY_USERNAME/.procmailrc
4631
+	echo 'maybe-spam/' >> /home/$MY_USERNAME/.procmailrc
4632
+	echo '# otherwise, marginal spam goes here for revision' >> /home/$MY_USERNAME/.procmailrc
4633
+	echo ':0' >> /home/$MY_USERNAME/.procmailrc
4634
+	echo '  * ^X-Spam-Level: \*\*' >> /home/$MY_USERNAME/.procmailrc
4635
+	echo 'spam/' >> /home/$MY_USERNAME/.procmailrc
4636
+	chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.procmailrc
4637
+	echo '# get spamassassin to check emails' >> /etc/skel/.procmailrc
4638
+	echo ':0fw: .spamassassin.lock' >> /etc/skel/.procmailrc
4639
+	echo '  * < 256000' >> /etc/skel/.procmailrc
4640
+	echo '| spamc' >> /etc/skel/.procmailrc
4641
+	echo '# strong spam are discarded' >> /etc/skel/.procmailrc
4642
+	echo ':0' >> /etc/skel/.procmailrc
4643
+	echo '  * ^X-Spam-Level: \*\*\*\*\*\*' >> /etc/skel/.procmailrc
4644
+	echo '/dev/null' >> /etc/skel/.procmailrc
4645
+	echo '# weak spam are kept just in case - clear this out every now and then' >> /etc/skel/.procmailrc
4646
+	echo ':0' >> /etc/skel/.procmailrc
4647
+	echo '  * ^X-Spam-Level: \*\*\*\*\*' >> /etc/skel/.procmailrc
4648
+	echo 'maybe-spam/' >> /etc/skel/.procmailrc
4649
+	echo '# otherwise, marginal spam goes here for revision' >> /etc/skel/.procmailrc
4650
+	echo ':0' >> /etc/skel/.procmailrc
4651
+	echo '  * ^X-Spam-Level: \*\*' >> /etc/skel/.procmailrc
4652
+	echo 'spam/' >> /etc/skel/.procmailrc
4653
+	# filtering scripts
4654
+	echo '#!/bin/bash' > /usr/bin/filterspam
4655
+	echo 'for d in /home/*/ ; do' >> /usr/bin/filterspam
4656
+	echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterspam
4657
+	echo '    if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then' >> /usr/bin/filterspam
4658
+	echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-spam' >> /usr/bin/filterspam
4659
+	echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterspam
4660
+	echo '           exit' >> /usr/bin/filterspam
4661
+	echo '        fi' >> /usr/bin/filterspam
4662
+	echo '        for f in `ls $MAILDIR/cur`' >> /usr/bin/filterspam
4663
+	echo '        do' >> /usr/bin/filterspam
4664
+	echo '            spamc -L spam < "$MAILDIR/cur/$f" > /dev/null' >> /usr/bin/filterspam
4665
+	echo '            rm "$MAILDIR/cur/$f"' >> /usr/bin/filterspam
4666
+	echo '        done' >> /usr/bin/filterspam
4667
+	echo '        for f in `ls $MAILDIR/new`' >> /usr/bin/filterspam
4668
+	echo '        do' >> /usr/bin/filterspam
4669
+	echo '            spamc -L spam < "$MAILDIR/new/$f" > /dev/null' >> /usr/bin/filterspam
4670
+	echo '            rm "$MAILDIR/new/$f"' >> /usr/bin/filterspam
4671
+	echo '        done' >> /usr/bin/filterspam
4672
+	echo '    fi' >> /usr/bin/filterspam
4673
+	echo 'done' >> /usr/bin/filterspam
4674
+	echo 'exit 0' >> /usr/bin/filterspam
4675
+
4676
+	echo '#!/bin/bash' > /usr/bin/filterham
4677
+	echo 'for d in /home/*/ ; do' >> /usr/bin/filterham
4678
+	echo '    USERNAME=$(echo "$d" | awk -F '"'"'/'"'"' '"'"'{print $3}'"'"')' >> /usr/bin/filterham
4679
+	echo '    if [[ $USERNAME != "git" && $USERNAME != "mirrors" ]]; then' >> /usr/bin/filterham
4680
+	echo '        MAILDIR=/home/$USERNAME/Maildir/.learn-ham' >> /usr/bin/filterham
4681
+	echo '        if [ ! -d "$MAILDIR" ]; then' >> /usr/bin/filterham
4682
+	echo '            exit' >> /usr/bin/filterham
4683
+	echo '        fi' >> /usr/bin/filterham
4684
+	echo '        for f in `ls $MAILDIR/cur`' >> /usr/bin/filterham
4685
+	echo '        do' >> /usr/bin/filterham
4686
+	echo '            spamc -L ham < "$MAILDIR/cur/$f" > /dev/null' >> /usr/bin/filterham
4687
+	echo '            rm "$MAILDIR/cur/$f"' >> /usr/bin/filterham
4688
+	echo '        done' >> /usr/bin/filterham
4689
+	echo '        for f in `ls $MAILDIR/new`' >> /usr/bin/filterham
4690
+	echo '        do' >> /usr/bin/filterham
4691
+	echo '            spamc -L ham < "$MAILDIR/new/$f" > /dev/null' >> /usr/bin/filterham
4692
+	echo '            rm "$MAILDIR/new/$f"' >> /usr/bin/filterham
4693
+	echo '        done' >> /usr/bin/filterham
4694
+	echo '    fi' >> /usr/bin/filterham
4695
+	echo 'done' >> /usr/bin/filterham
4696
+	echo 'exit 0' >> /usr/bin/filterham
4697
+
4698
+	if ! grep -q "filterspam" /etc/crontab; then
4699
+		echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterspam" >> /etc/crontab
4700
+	fi
4701
+	if ! grep -q "filterham" /etc/crontab; then
4702
+		echo "*/3 * * * * root /usr/bin/timeout 120 /usr/bin/filterham" >> /etc/crontab
4703
+	fi
4704
+	chmod 655 /usr/bin/filterspam /usr/bin/filterham
4705
+	sed -i 's/# use_bayes 1/use_bayes 1/g' /etc/mail/spamassassin/local.cf
4706
+	sed -i 's/# bayes_auto_learn 1/bayes_auto_learn 1/g' /etc/mail/spamassassin/local.cf
4707
+
4708
+	# user preferences
4709
+	if [ ! -d /home/$MY_USERNAME/.spamassassin ]; then
4710
+		mkdir /home/$MY_USERNAME/.spamassassin
4711
+		echo $'# How many points before a mail is considered spam.' > /home/$MY_USERNAME/.spamassassin/user_prefs
4712
+		echo '# required_score        5' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4713
+		echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4714
+		echo $'# Whitelist and blacklist addresses are now file-glob-style patterns, so' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4715
+		echo $'# "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4716
+		echo '# whitelist_from    someone@somewhere.com' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4717
+		echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4718
+		echo $'# Add your own customised scores for some tests below.  The default scores are' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4719
+		echo $'# read from the installed spamassassin rules files, but you can override them' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4720
+		echo $'# here.  To see the list of tests and their default scores, go to' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4721
+		echo '# http://spamassassin.apache.org/tests.html .' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4722
+		echo '#' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4723
+		echo '# score SYMBOLIC_TEST_NAME n.nn' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4724
+		echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4725
+		echo $'# Speakers of Asian languages, like Chinese, Japanese and Korean, will almost' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4726
+		echo $'# definitely want to uncomment the following lines.  They will switch off some' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4727
+		echo $'# rules that detect 8-bit characters, which commonly trigger on mails using CJK' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4728
+		echo $'# character sets, or that assume a western-style charset is in use. ' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4729
+		echo '# ' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4730
+		echo '# score HTML_COMMENT_8BITS  0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4731
+		echo '# score UPPERCASE_25_50     0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4732
+		echo '# score UPPERCASE_50_75     0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4733
+		echo '# score UPPERCASE_75_100    0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4734
+		echo '# score OBSCURED_EMAIL      0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4735
+		echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4736
+		echo $'# Speakers of any language that uses non-English, accented characters may wish' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4737
+		echo $'# to uncomment the following lines.   They turn off rules that fire on' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4738
+		echo $'# misformatted messages generated by common mail apps in contravention of the' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4739
+		echo $'# email RFCs.' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4740
+		echo '' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4741
+		echo '# score SUBJ_ILLEGAL_CHARS      0' >> /home/$MY_USERNAME/.spamassassin/user_prefs
4742
+	fi
4743
+	# this must be accessible by root
4744
+	chown -R $MY_USERNAME:root /home/$MY_USERNAME/.spamassassin
4745
+
4746
+	systemctl restart spamassassin
4747
+	systemctl restart exim4
4748
+	systemctl restart cron
4749
+
4750
+	echo 'spam_filtering' >> $COMPLETION_FILE
4744 4751
 }
4745 4752
 
4746 4753
 function configure_imap {
@@ -4781,52 +4788,52 @@ function configure_imap {
4781 4788
     sed -i 's|#ssl_dh_parameters_length.*|ssl_dh_parameters_length = 2048|g' /etc/dovecot/conf.d/10-ssl.conf
4782 4789
     sed -i 's/#ssl_prefer_server_ciphers.*/ssl_prefer_server_ciphers = yes/g' /etc/dovecot/conf.d/10-ssl.conf
4783 4790
     sed -i "s|#ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
4784
-    sed -i "s|ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
4785
-    echo "ssl_cipher_list = '$SSL_CIPHERS'" >> /etc/dovecot/conf.d/10-ssl.conf
4786
-
4787
-    if [ ! -f /etc/dovecot/conf.d/10-master.conf ]; then
4788
-        echo $'Unable to find /etc/dovecot/conf.d/10-master.conf'
4789
-        exit 49259
4790
-    fi
4791
-    sed -i 's/#process_limit =.*/process_limit = 100/g' /etc/dovecot/conf.d/10-master.conf
4792
-    sed -i 's/#default_client_limit.*/default_client_limit = 100/g' /etc/dovecot/conf.d/10-master.conf
4793
-    sed -i 's|#default_process_limit =.*|default_process_limit = 100|g' /etc/dovecot/conf.d/10-master.conf
4794
-
4795
-    if [ ! -f /etc/dovecot/conf.d/10-logging.conf ]; then
4796
-        echo $'Unable to find /etc/dovecot/conf.d/10-logging.conf'
4797
-        exit 48936
4798
-    fi
4799
-    sed -i 's/#auth_verbose.*/auth_verbose = yes/g' /etc/dovecot/conf.d/10-logging.conf
4800
-
4801
-    if [ ! -f /etc/dovecot/dovecot.conf ]; then
4802
-        echo $'Unable to find /etc/dovecot/dovecot.conf'
4803
-        exit 43890
4804
-    fi
4805
-    sed -i 's/#listen =.*/listen = */g' /etc/dovecot/dovecot.conf
4806
-
4807
-    if [ ! -f /etc/dovecot/conf.d/10-auth.conf ]; then
4808
-        echo $'Unable to find /etc/dovecot/conf.d/10-auth.conf'
4809
-        exit 843256
4810
-    fi
4811
-    sed -i 's/#disable_plaintext_auth =.*/disable_plaintext_auth = no/g' /etc/dovecot/conf.d/10-auth.conf
4812
-    sed -i 's/auth_mechanisms =.*/auth_mechanisms = plain login/g' /etc/dovecot/conf.d/10-auth.conf
4813
-
4814
-    if [ ! -f /etc/dovecot/conf.d/10-mail.conf ]; then
4815
-        echo $'Unable to find /etc/dovecot/conf.d/10-mail.conf'
4816
-        exit 42036
4817
-    fi
4818
-    sed -i 's|mail_location =.*|mail_location = maildir:~/Maildir:LAYOUT=fs|g' /etc/dovecot/conf.d/10-mail.conf
4819
-
4820
-    # This long notify interval makes the system more suited for use with
4821
-    # battery powered mobile devices
4822
-    sed -i 's|#imap_idle_notify_interval =.*|imap_idle_notify_interval = 29|g' /etc/dovecot/conf.d/20-imap.conf
4823
-
4824
-    if [ -f /var/lib/dovecot/ssl-parameters.dat ]; then
4825
-        rm /var/lib/dovecot/ssl-parameters.dat
4826
-    fi
4827
-
4828
-    systemctl restart dovecot
4829
-    echo 'configure_imap' >> $COMPLETION_FILE
4791
+	sed -i "s|ssl_protocols =.*|ssl_protocols = '$SSL_PROTOCOLS'|g" /etc/dovecot/conf.d/10-ssl.conf
4792
+	echo "ssl_cipher_list = '$SSL_CIPHERS'" >> /etc/dovecot/conf.d/10-ssl.conf
4793
+
4794
+	if [ ! -f /etc/dovecot/conf.d/10-master.conf ]; then
4795
+		echo $'Unable to find /etc/dovecot/conf.d/10-master.conf'
4796
+		exit 49259
4797
+	fi
4798
+	sed -i 's/#process_limit =.*/process_limit = 100/g' /etc/dovecot/conf.d/10-master.conf
4799
+	sed -i 's/#default_client_limit.*/default_client_limit = 100/g' /etc/dovecot/conf.d/10-master.conf
4800
+	sed -i 's|#default_process_limit =.*|default_process_limit = 100|g' /etc/dovecot/conf.d/10-master.conf
4801
+
4802
+	if [ ! -f /etc/dovecot/conf.d/10-logging.conf ]; then
4803
+		echo $'Unable to find /etc/dovecot/conf.d/10-logging.conf'
4804
+		exit 48936
4805
+	fi
4806
+	sed -i 's/#auth_verbose.*/auth_verbose = yes/g' /etc/dovecot/conf.d/10-logging.conf
4807
+
4808
+	if [ ! -f /etc/dovecot/dovecot.conf ]; then
4809
+		echo $'Unable to find /etc/dovecot/dovecot.conf'
4810
+		exit 43890
4811
+	fi
4812
+	sed -i 's/#listen =.*/listen = */g' /etc/dovecot/dovecot.conf
4813
+
4814
+	if [ ! -f /etc/dovecot/conf.d/10-auth.conf ]; then
4815
+		echo $'Unable to find /etc/dovecot/conf.d/10-auth.conf'
4816
+		exit 843256
4817
+	fi
4818
+	sed -i 's/#disable_plaintext_auth =.*/disable_plaintext_auth = no/g' /etc/dovecot/conf.d/10-auth.conf
4819
+	sed -i 's/auth_mechanisms =.*/auth_mechanisms = plain login/g' /etc/dovecot/conf.d/10-auth.conf
4820
+
4821
+	if [ ! -f /etc/dovecot/conf.d/10-mail.conf ]; then
4822
+		echo $'Unable to find /etc/dovecot/conf.d/10-mail.conf'
4823
+		exit 42036
4824
+	fi
4825
+	sed -i 's|mail_location =.*|mail_location = maildir:~/Maildir:LAYOUT=fs|g' /etc/dovecot/conf.d/10-mail.conf
4826
+
4827
+	# This long notify interval makes the system more suited for use with
4828
+	# battery powered mobile devices
4829
+	sed -i 's|#imap_idle_notify_interval =.*|imap_idle_notify_interval = 29|g' /etc/dovecot/conf.d/20-imap.conf
4830
+
4831
+	if [ -f /var/lib/dovecot/ssl-parameters.dat ]; then
4832
+		rm /var/lib/dovecot/ssl-parameters.dat
4833
+	fi
4834
+
4835
+	systemctl restart dovecot
4836
+	echo 'configure_imap' >> $COMPLETION_FILE
4830 4837
 }
4831 4838
 
4832 4839
 function configure_imap_client_certs {