summaryrefslogtreecommitdiff
path: root/mailserver.sh
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-05-27 19:24:15 -0400
committerLuke Smith <luke@lukesmith.xyz>2019-05-27 19:24:15 -0400
commit26b54e600a5dcb3ede0905fe5433ba650f0298d1 (patch)
tree70fed8e77c2d8b6137e3b23174cbc2520564b801 /mailserver.sh
parente66829d2eb4b3fe2c77d59f1c0bac27de0ff4281 (diff)
autodetermine domain
Diffstat (limited to 'mailserver.sh')
-rwxr-xr-xmailserver.sh12
1 files changed, 5 insertions, 7 deletions
diff --git a/mailserver.sh b/mailserver.sh
index 7429947..0c5eb30 100755
--- a/mailserver.sh
+++ b/mailserver.sh
@@ -1,10 +1,5 @@
#!/bin/sh
-# Put your website in the $domain variable.
-domain="lukesmith.xyz"
-subdom="mail"
-maildomain="$subdom.$domain"
-
# THE SETUP
# - Mail will be stored in non-retarded Maildirs because it's $currentyear. This makes it easier for use with isync, which is what I care about so I can have an offline repo of mail.
@@ -22,6 +17,9 @@ maildomain="$subdom.$domain"
echo "Installing programs..."
apt install postfix dovecot-imapd opendkim spamassassin spamc
+domain="$(cat /etc/mailname)"
+subdom="mail"
+maildomain="$subdom.$domain"
# NOTE ON POSTCONF COMMANDS
@@ -32,8 +30,8 @@ apt install postfix dovecot-imapd opendkim spamassassin spamc
echo "Configuring Postfix's main.cf..."
# Change the cert/key files to the default locations of the Let's Encrypt cert/key
-postconf -e smtpd_tls_key_file=/etc/letsencrypt/live/$maildomain/privkey.pem
-postconf -e smtpd_tls_cert_file=/etc/letsencrypt/live/$maildomain/fullchain.pem
+postconf -e "smtpd_tls_key_file=/etc/letsencrypt/live/$maildomain/privkey.pem"
+postconf -e "smtpd_tls_cert_file=/etc/letsencrypt/live/$maildomain/fullchain.pem"
postconf -e "smtpd_use_tls = yes"
postconf -e "smtpd_tls_auth_only = yes"