45 lines
1.3 KiB
Ruby
45 lines
1.3 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
Vagrant.configure("2") do |config|
|
|
config.vm.box = "debian/stretch64"
|
|
|
|
config.vm.synced_folder "./", "/vagrant", type: "rsync"
|
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
# Give that vagrant box an apparently good FQDN
|
|
echo "local-vagrant.example.com" > /etc/hostname
|
|
echo "local-vagrant.example.com" > /etc/mailname
|
|
hostnamectl set-hostname local-vagrant.example.com
|
|
|
|
# Basic preparations
|
|
apt-get update
|
|
|
|
# Install postfix
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix
|
|
|
|
# Enable and launch postfix
|
|
systemctl enable postfix.service
|
|
systemctl start postfix.service
|
|
|
|
# Block port 25 for IPv4
|
|
iptables -A INPUT -p tcp --dport 25 -j DROP
|
|
iptables -A FORWARD -p tcp --dport 25 -j DROP
|
|
iptables -A OUTPUT -p tcp --dport 25 -j DROP
|
|
|
|
# Block port 25 for IPv6
|
|
ip6tables -A INPUT -p tcp --dport 25 -j DROP
|
|
ip6tables -A FORWARD -p tcp --dport 25 -j DROP
|
|
ip6tables -A OUTPUT -p tcp --dport 25 -j DROP
|
|
|
|
# Install mailutils (tools to send mail)
|
|
apt-get install -y mailutils
|
|
|
|
# Invoke script that sends test mails, so we have test data
|
|
/vagrant/vagrant-util/send-test-mails.sh --LETS-REALLY-DO-THIS-AND-SEND-MAIL
|
|
|
|
# That's it
|
|
echo "That's it. We're set up. Enjoy your test environment."
|
|
SHELL
|
|
end
|