2019-01-26 11:10:20 +01:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
2019-11-03 15:41:38 +01:00
|
|
|
config.vm.box = "debian/buster64"
|
2019-01-26 11:10:20 +01:00
|
|
|
|
|
|
|
config.vm.synced_folder "./", "/vagrant", type: "rsync"
|
|
|
|
|
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
2019-01-26 19:31:19 +01:00
|
|
|
# Give that vagrant box an apparently good FQDN
|
|
|
|
echo "local-vagrant.example.com" > /etc/hostname
|
|
|
|
echo "local-vagrant.example.com" > /etc/mailname
|
2019-01-27 10:45:45 +01:00
|
|
|
echo "127.0.1.2 local-vagrant.example.com local-vagrant" > /etc/hosts
|
2019-01-26 19:31:19 +01:00
|
|
|
hostnamectl set-hostname local-vagrant.example.com
|
|
|
|
|
2019-01-26 11:38:32 +01:00
|
|
|
# Basic preparations
|
2019-01-26 11:10:20 +01:00
|
|
|
apt-get update
|
2019-01-26 11:38:32 +01:00
|
|
|
|
|
|
|
# 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."
|
2019-01-26 11:10:20 +01:00
|
|
|
SHELL
|
|
|
|
end
|