From c748253803ef615981f09836822fcc3405f38981 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sat, 23 Nov 2019 19:44:07 +0100 Subject: [PATCH] Introduce Vagrantfile for a test environment --- Vagrantfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Vagrantfile diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..426da5a --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,40 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "debian/buster64" + + config.vm.synced_folder "./", "/vagrant", type: "rsync" + + # Export postfix port 25 (guest) to port 2525 (host) + # This is useful for throwing swaks and other tools against postfix + config.vm.network "forwarded_port", guest: 25, host: 2525 + + 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 + apt-get update + + # Install postfix + DEBIAN_FRONTEND=noninteractive apt-get install -y postfix + + # Add milter to configuration + postconf smtpd_milters=inet:127.0.0.1:7777 + postconf non_smtpd_milters=inet:127.0.0.1:7777 + + # Enable and launch postfix + systemctl enable postfix.service + systemctl start postfix.service + + # Install swaks + DEBIAN_FRONTEND=noninteractive apt-get install -y swaks + + # That's it + echo "That's it. We're set up. Enjoy your test environment." + SHELL +end