jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/387158 )

Change subject: Add BounceHandler role
......................................................................


Add BounceHandler role

Add a role to provision the BounceHandler extension. The role also tries
to setup postfix to forward bounces to the BounceHandler api. This is
probably tricky to actually use however since the postfix server is
still configured to trap all messages inside the VM.

It would be neat to figure out how to make some set of addresses always
bounce, but there was no obvious means for that in the documentation
searches I've done so far.

Change-Id: Ia7a7443bbd70e7182909a5b7c163f16ffcf5bf43
---
M puppet/modules/postfix/manifests/init.pp
M puppet/modules/postfix/templates/main.cf.erb
A puppet/modules/role/manifests/bouncehandler.pp
A puppet/modules/role/templates/bouncehandler/aliases.erb
A puppet/modules/role/templates/bouncehandler/virtual.erb
5 files changed, 41 insertions(+), 2 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/modules/postfix/manifests/init.pp 
b/puppet/modules/postfix/manifests/init.pp
index 9282bbb..b8f52c4 100644
--- a/puppet/modules/postfix/manifests/init.pp
+++ b/puppet/modules/postfix/manifests/init.pp
@@ -14,7 +14,7 @@
         install_options => [ '--force-yes' ],
     }
 
-    package { 'postfix': }
+    package { ['postfix', 'postfix-pcre']: }
 
     file { '/etc/postfix':
         ensure  => directory,
@@ -38,6 +38,13 @@
         mode    => '0444',
     }
 
+    file { '/etc/postfix/aliases':
+        content => '',
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
+
     exec { 'postmap_virtual':
         command     => 'postmap /etc/postfix/virtual',
         subscribe   => File['/etc/postfix/virtual'],
diff --git a/puppet/modules/postfix/templates/main.cf.erb 
b/puppet/modules/postfix/templates/main.cf.erb
index 9ebd232..4affa00 100644
--- a/puppet/modules/postfix/templates/main.cf.erb
+++ b/puppet/modules/postfix/templates/main.cf.erb
@@ -1 +1,2 @@
-virtual_alias_maps = regexp:/etc/postfix/virtual
+alias_maps = hash:/etc/postfix/aliases
+virtual_alias_maps = pcre:/etc/postfix/virtual
diff --git a/puppet/modules/role/manifests/bouncehandler.pp 
b/puppet/modules/role/manifests/bouncehandler.pp
new file mode 100644
index 0000000..a65a834
--- /dev/null
+++ b/puppet/modules/role/manifests/bouncehandler.pp
@@ -0,0 +1,28 @@
+# == Class: role::bouncehandler
+# Installs the [BounceHandler][1] extension which allows wikis to handle
+# bounce emails efficiently.
+#
+# [1] https://www.mediawiki.org/wiki/Extension:BounceHandler
+#
+class role::bouncehandler {
+    include ::postfix
+    include ::role::mediawiki
+
+    mediawiki::extension { 'BounceHandler':
+        needs_update => true,
+    }
+
+    File<|title == '/etc/postfix/virtual'|> {
+        content => template('role/bouncehandler/virtual.erb'),
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
+    File<|title == '/etc/postfix/aliases'|> {
+        content => template('role/bouncehandler/aliases.erb'),
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
+}
+
diff --git a/puppet/modules/role/templates/bouncehandler/aliases.erb 
b/puppet/modules/role/templates/bouncehandler/aliases.erb
new file mode 100644
index 0000000..d933e43
--- /dev/null
+++ b/puppet/modules/role/templates/bouncehandler/aliases.erb
@@ -0,0 +1 @@
+curl_email: "|curl -d action=bouncehandler --data-urlencode email@- http://<%= 
scope['::role::mediawiki::hostname'] %>:<%= scope['::forwarded_port'] 
%>/w/api.php"
diff --git a/puppet/modules/role/templates/bouncehandler/virtual.erb 
b/puppet/modules/role/templates/bouncehandler/virtual.erb
new file mode 100644
index 0000000..d15d829
--- /dev/null
+++ b/puppet/modules/role/templates/bouncehandler/virtual.erb
@@ -0,0 +1,2 @@
+/wiki-[\w.]+-\w+-\w+-\w...............@<%= 
scope['::role::mediawiki::hostname'] %>/  curl_email
+/.+/ vagrant

-- 
To view, visit https://gerrit.wikimedia.org/r/387158
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7a7443bbd70e7182909a5b7c163f16ffcf5bf43
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to