-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvagrant-bootstrap.sh
executable file
·31 lines (25 loc) · 1.01 KB
/
vagrant-bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
postfix dnsmasq mutt vim
# Provide hostnames so the boxes can talk to each other. DNSMasq will also serve
# results to each box based on these contents.
cat >> /etc/hosts <<EOF
192.168.33.5 sender sender.example.com
192.168.33.7 valid valid-example-recipient.com
EOF
# All local domains get an MX record pointing at themselves
echo selfmx > /etc/dnsmasq.conf
# Not sure why restart is necessary, but otherwise dnsmasq doesn't use
# /etc/hosts to answer queries.
/etc/init.d/dnsmasq restart
if [ "`hostname`" = "sender" ]; then
(while sleep 10; do
echo -e 'Subject: hi\n\nhi' | sendmail [email protected]
done) &
ln -sf "/vagrant/postfix-config-sender-tls_policy.cf" /etc/postfix/tls_policy
fi
ln -sf "/vagrant/postfix-config-`hostname`.cf" /etc/postfix/main.cf
ln -sf "/vagrant/certificates" /etc/certificates
postfix reload