+# This router delivers to the LDAP generated mail-forward file.
+# It's only really useful for debian.org
+virt_users:
+ debug_print = "R: virt_users for $local_part@$domain"
+ driver = redirect
+ allow_defer
+ allow_fail
+ router_home_directory = ${extract{directory}{VDOMAINDATA}}
+ transport_current_directory = ${extract{directory}{VDOMAINDATA}}
+ user = ${extract{user}{VDOMAINDATA}}
+ group = ${extract{group}{VDOMAINDATA}}
+ # Manually construct the forwarding address, preserving the
+ # local_part_suffix if the remote host is master.
+ data = ${if and {{exists{${extract{directory}{VDOMAINDATA}{${value}/mail-forward.db}}}}\
+ {! eq {${lookup{$local_part}dbmnz\
+ {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.db}}}}}\
+ {}}}\
+ {${local_part:${lookup{$local_part}dbmnz\
+ {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.db}}}}}\
+ ${if eq {${domain:${lookup{$local_part}dbmnz\
+ {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.db}}}}}}{master.debian.org}{$local_part_suffix} {}}\
+ @\
+ ${domain:${lookup{$local_part}dbmnz\
+ {${extract{directory}{VDOMAINDATA}{${value}/mail-forward.db}}}}}}}
+ domains = +virtual_domains
+ file_transport = address_file
+ headers_add = "Delivered-To: ${local_part}${local_part_suffix}@${domain}"
+ pipe_transport = address_pipe
+ local_part_suffix = -*
+ local_part_suffix_optional
+ retry_use_local_part
+
+<%- if @is_bugsmx -%>
+# This router delivers for bugs.d.o
+bugs:
+ debug_print = "R: bugs for $local_part@$domain"
+ driver = accept
+ transport = bugs_pipe
+ domains = bugs.debian.org
+ cannot_route_message = Unknown or archived bug
+ require_files = /srv/bugs.debian.org/mail/run-procmail
+ no_more
+ local_parts = ${if match\
+ {$local_part}\
+ {\N^(\d+)(\d{2})(?:-(?:(?:submit|maintonly|quiet|forwarded|done|close|request|submitter)|(?:unsubscribe|ignore|help|(?:sub(?:scribe|help|yes|approve|reject))|unsubyes|bounce|probe|approve|reject|setlistyes|setlistsilentyes).*))?$\N}\
+ {${if exists{/srv/bugs.debian.org/spool/db-h/$2/$1$2.summary}\
+ {$local_part}fail}}fail}
+<%- end -%>