mailq-inspector/Vagrantfile

46 lines
1.4 KiB
Plaintext
Raw Normal View History

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
# Give that vagrant box an apparently good FQDN
echo "local-vagrant.example.com" > /etc/hostname
echo "local-vagrant.example.com" > /etc/mailname
echo "127.0.1.2 local-vagrant.example.com local-vagrant" > /etc/hosts
hostnamectl set-hostname local-vagrant.example.com
# Basic preparations
2019-01-26 11:10:20 +01:00
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."
2019-01-26 11:10:20 +01:00
SHELL
end