From d625d840a9e3f8469493f9c5ebb05169e95cf80a Mon Sep 17 00:00:00 2001 From: Tristan PILAT Date: Thu, 19 Sep 2019 16:26:54 +0200 Subject: [PATCH] We want to relay mails from the container to localhost (the LXC host mail system) --- lxc-php/tasks/php.yml | 8 ++++---- lxc-php/templates/smtpd.conf.j2 | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 lxc-php/templates/smtpd.conf.j2 diff --git a/lxc-php/tasks/php.yml b/lxc-php/tasks/php.yml index d13bb06b..909b204f 100644 --- a/lxc-php/tasks/php.yml +++ b/lxc-php/tasks/php.yml @@ -88,10 +88,10 @@ when: name != 'php73' - name: Configure opensmtpd - replace: - name: "/var/lib/lxc/{{name}}/rootfs/etc/smtpd.conf" - regexp: "^listen.*" - replace: "#listen on localhost" + template: + src: smtpd.conf.j2 + dest: "/var/lib/lxc/{{name}}/rootfs/etc/smtpd.conf" + mode: "0644" notify: "Restart opensmtpd" when: name == 'php73' diff --git a/lxc-php/templates/smtpd.conf.j2 b/lxc-php/templates/smtpd.conf.j2 new file mode 100644 index 00000000..8458d4b4 --- /dev/null +++ b/lxc-php/templates/smtpd.conf.j2 @@ -0,0 +1,14 @@ +# This is the smtpd server system-wide configuration file. +# See smtpd.conf(5) for more information. + +# To accept external mail, replace with: listen on all +#listen on localhost + +# If you edit the file, you have to run "smtpctl update table aliases" +table aliases file:/etc/aliases + +# Uncomment the following to accept external mail for domain "example.org" +#accept from any for domain "example.org" alias deliver to mbox + +accept for local alias deliver to mbox +accept for any relay via "smtp://127.0.0.1"