summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xemailwiz.sh35
2 files changed, 32 insertions, 5 deletions
diff --git a/README.md b/README.md
index 22488a0..616ade7 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ The script works for me and if it works for you without a problem, be thankful a
If you decide to start a VPS, specifically Vultr since I made this script and have tempered it most on their default setup,
use [this referal link of mine](https://www.vultr.com/?ref=7914655-4F) because you get a free $50 credit, and if you stay on the site, eventually I get a kickback too.
-I honestly have to really strong preference of Vultr over other VPS providers, but they're about as cheap and reliable as it gets and if we can get free money, lol whatever click the link 👏👏.
+I honestly have no really strong preference of Vultr over other VPS providers, but they're about as cheap and reliable as it gets and if we can get free money, lol whatever click the link 👏👏.
## Details
diff --git a/emailwiz.sh b/emailwiz.sh
index cd6440a..e1bb1fb 100755
--- a/emailwiz.sh
+++ b/emailwiz.sh
@@ -17,6 +17,8 @@
echo "Installing programs..."
apt install postfix dovecot-imapd opendkim spamassassin spamc
+# Install another requirement for opendikm only if the above command didn't get it already
+[ -e $(which opendkim-genkey) ] || apt install opendkim-tools
domain="$(cat /etc/mailname)"
subdom="mail"
maildomain="$subdom.$domain"
@@ -59,15 +61,14 @@ sed -i "/^\s*-o/d;/^\s*submission/d;/^\s*smtp/d" /etc/postfix/master.cf
echo "smtp unix - - n - - smtp
smtp inet n - y - - smtpd
+ -o content_filter=spamassassin
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
- -o content_filter=spamassassin
-o smtpd_sasl_auth_enable=yes
-o smtpd_tls_auth_only=yes
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
- -o content_filter=spamassassin
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
spamassassin unix - n n - - pipe
@@ -140,14 +141,40 @@ service auth {
group = postfix
}
}
+
+protocol lda {
+ mail_plugins = \$mail_plugins sieve
+}
+
+protocol lmtp {
+ mail_plugins = \$mail_plugins sieve
+}
+
+plugin {
+ sieve = ~/.dovecot.sieve
+ sieve_default = /var/lib/dovecot/sieve/default.sieve
+ #sieve_global_path = /var/lib/dovecot/sieve/default.sieve
+ sieve_dir = ~/.sieve
+ sieve_global_dir = /var/lib/dovecot/sieve/
+}
" > /etc/dovecot/dovecot.conf
+mkdir /var/lib/dovecot/sieve/
+
+echo "require [\"fileinto\", \"mailbox\"];
+if header :contains \"X-Spam-Flag\" \"YES\"
+ {
+ fileinto \"Junk\";
+ }" > /var/lib/dovecot/sieve/default.sieve
+
+chown -R vmail:vmail /var/lib/dovecot
+sievec /var/lib/dovecot/sieve/default.sieve
+
echo "Preparing user authetication..."
grep nullok /etc/pam.d/dovecot >/dev/null ||
echo "auth required pam_unix.so nullok
account required pam_unix.so" >> /etc/pam.d/dovecot
-
# OpenDKIM
# A lot of the big name email services, like Google, will automatically rejectmark as spam unfamiliar and unauthenticated email addresses. As in, the server will flattly reject the email, not even deliverring it to someone's Spam folder.
@@ -190,7 +217,7 @@ postconf -e "milter_default_action = accept"
postconf -e "milter_protocol = 2"
postconf -e "smtpd_milters = inet:localhost:8891"
postconf -e "non_smtpd_milters = inet:localhost:8891"
-
+postconf -e "mailbox_command = /usr/lib/dovecot/deliver"
echo "Restarting Dovecot..."
service dovecot restart && echo "Dovecot restarted."