Bladeren bron

Setup script that installs/configures postfix

Joe Ceresini 7 jaren geleden
commit
c0d44aed3c
1 gewijzigde bestanden met toevoegingen van 30 en 0 verwijderingen
  1. 30 0
      setup.sh

+ 30 - 0
setup.sh

@@ -0,0 +1,30 @@
+yum update -y
+yum install postfix -y
+
+useradd -m -s /sbin/nologin incoming
+
+sed -i -e 's/^\s*\(inet_interfaces\s*=\)/#\1/' \
+       -e 's/^\s*\(mydestination\s*=\)/#\1/' \
+       -e 's/^\s*\(mynetworks\s*=\)/#\1/' \
+       -e 's/^\s*\(home_mailbox\s*=\)/#\1/' \
+       -e 's/^\s*\(alias_maps\s*=\)/#\1/' \
+       /etc/postfix/main.cf
+
+cat <<EOF >> /etc/postfix/main.cf
+# HOSTING CONFIG FOR EMAIL PARSING
+inet_interfaces = all
+mynetworks = 127.0.0.1/32
+virtual_alias_maps = regexp:/etc/postfix/virtual_aliases
+virtual_alias_domains = accounts.hosting.com
+home_mailbox = Maildir/
+smtpd_reject_unlisted_recipient = no
+EOF
+
+cat <<EOF > /etc/postfix/virtual_aliases
+/^[0-9]+-[0-9]+@accounts\.hosting\.com$/  incoming
+/^support@accounts\.hosting\.com$/        incoming
+EOF
+
+systemctl restart postfix
+
+