EximConfigVirtualDomain

From Request Tracker Wiki
Jump to navigation Jump to search

This sets up a full virtual domain system in exim so that RT can be supported in a virtual domain.

1. Edit exim.conf.

2. At the top with the domain lists, add

domainlist virtual_domains = lsearch;/virtual/mail/virtual

3. Modify your ACLs to permit virtual domains:

accept  local_parts   = postmaster
        domains       = +local_domains : +virtual_domains

accept  domains       = +local_domains : +virtual_domains
        endpass
        message       = unknown user
        verify        = recipient

4. Modify routers to handle virtual domains:

dnslookup:
  driver = dnslookup
  domains = ! +local_domains : ! +virtual_domains
  transport = remote_smtp
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  no_more

5. Add a specific router to handle virtual domains. This goes between dnslookup and system_aliases:

  1. This director handles local aliases. Because it has no transport setting, it # just expands local parts that it recognises into new addresses.
virtual_alias:
    driver = redirect
    domains = +virtual_domains
    local_part_suffix = +*
    local_part_suffix_optional
    data = ${lookup{$local_part}lsearch*{/virtual/${domain}/mail/aliases}}
    qualify_preserve_domain
    file_transport = address_file
    pipe_transport = address_pipe
    no_more

6. Create the directory /virtual/<rt-host-name>/mail

7. Take and modify the following pr3l skr1p+ as appropriate to your setup:

#!/usr/bin/perl
 
 use strict;
 use warnings;
 
 my $urlflag = "--url 'http://rt.anarres.org/'";
 my $gate = "/usr/local/rt3/bin/rt-mailgate";
 my %queues = (
     "General"       => {
             Correspondence  => {
                     Address => 'correspondence',
             },
             Comments                => {
                     Address => 'comments',
             },
     },
     "SPF Library"   => {
             Base    => 'libspf2',
     },
     "SRS Library"   => {
             Base    => 'libsrs2',
     },
 );
 
 my $acorr = "--action correspond";
 my $acomm = "--action comment";
 
 foreach my $queue (sort keys %queues) {
     my $data = $queues{$queue};
     my $corr = $data->{Correspondence};
     my $comm = $data->{Comments};
     my $corraddr = $corr->{Address};
     $corraddr = $data->{Base} unless defined $corraddr;
     my $commaddr = $comm->{Address};
     $commaddr = $data->{Base} . "-comments" unless defined $commaddr;
     print "$corraddr: \"|$gate --queue '$queue' $acorr $urlflag\"\n";
     print "$commaddr: \"|$gate --queue '$queue' $acomm $urlflag\"\n";
     print "\n";
 }
 
 

7. Run the perl script, redirect the output into the file 'aliases'.

8. Restart exim.