migrating from SME 7 to Zimbra 8

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

migrating from SME 7 to Zimbra 8

Postby agarrett5 » Mon Jun 09, 2014 8:08 am

I am trying to migrate the aliases from SME 7 to Zimbra 8 (sitting on top of a Ubuntu 12.04 LTS server).

I have a script that works now after a rewrite on the 'recommended' one on the Zimbra wiki. (for migrating aliases & groups)

The issue I have is the script that Zimbra recommend looks for a file /etc/aliases. The problem I am having is this file on our SME server doesn't correlate with the web GUI (server-manager) on the SME server. I have done a find to see if I could find it, but only comes up with 3 aliases files none of which are correct. I also did the search for pseudonym as well. When I have approached zimbra forum about it they don't seem to be able to come up with the answer.

My question is what file should I be looking at and where is it likely to be?

Also if I can't be pointed to that file is there a config file that tells the SME system to where to pull the aliases info from?

The original script is here

http://wiki.zimbra.com/wiki/Aliases_file_Migration

The rewrite of the script is

Code: Select all
#!/usr/bin/perl
use strict;
use warnings;

my @CNAME_SKIP= qw( ftp news postmaster root webmaster );
my @ALIAS_SKIP= qw( abuse mailer-daemon postmaster );
my @DISTRIBUTION_LISTS;
my $DOMAIN = 'abacuscover.com';
my $SOURCE_HOST = 'eserver';

use File::Basename;

while(<>) {
   chomp;
   s/#.*$//; # skip comments
   next if /^\s*$/; # skip blank lines

   my ($description,$display_name,@cnames);
   my ($alias,$cname) = split(/:/,$_,2);

   $alias =~ s/\s*//g;
   # scrutinize the aliases
   #if (grep /^$alias$/, @ALIAS_SKIP) {
      #warn "skipping alias $alias -> $cname";
      #next;
   #}

   $cname =~ s/\s*//g; # remove all spaces

   # scrutinize the canonical names
   if ($cname =~ m/:include:/) {
      my ($description, $display_name, $cnames_ref) = parse_include($alias,$cname);
      next unless $cnames_ref;
      @cnames = @{$cnames_ref};
   }

   if ($cname =~ m/,/) {
      # multiple recipients make this a list instead of an alias
      @cnames = split(/,/,$cname);
   }

   # if more than one cname then it is a dist list
   if (length($cnames[0])) {
      print "\n";
      print "createDistributionList $alias\@$DOMAIN\n";
      push (@DISTRIBUTION_LISTS, $alias);
   
      if ($display_name) {
         print "modifyDistributionList $alias\@$DOMAIN displayname \"$display_name\"\n";
         $display_name = undef;
      }
   
      if ($description) {
         print "modifyDistributionList $alias\@$DOMAIN description \"$description\"\n";
         $description = undef;
      }
   
      foreach my $member (@cnames) {
          #skip aliases to certain users
         if (grep /^$member$/, @CNAME_SKIP) {
            warn "skipping cname $member <- $alias";
            next; # go to next member
         }
      
          #A Zimbra distribution list may contain users or remote hosts.
         if ($member =~ m/\@/) {
            #print "addDistributionListMember $alias\@$DOMAIN $member\n";
         } else {
            #print "addDistributionListMember $alias\@$DOMAIN $member\@$DOMAIN\n";
         }
      }
   
      print "\n";
      @cnames=();
      next; # go to next line of aliases file
   }

   # skip aliases to certain users
   #if (grep /^$cname$/, @CNAME_SKIP) {
      #warn "skipping cname $cname <- $alias";
      #next;
   #}

   if ($cname =~ m/\/|\|/) {
      # alias to a file or a program. don't try to accomodate
      warn "WARNING skipping cname $cname <- $alias it is a file or pipe";
      next;
   }

   # A Zimbra alias must be associated with exactly one Zimbra account.
   if ($cname =~ m/\@/) {
      # alias to remote host. this could be created as a dist list with 1 member
      # that seems undersirable though.
      print "\n";
      print "createDistributionList $alias\@$DOMAIN\n";
      print "addDistributionListMember $alias\@$DOMAIN $cname\n";
      print "\n";
      next; # go to next line of aliases file
   }

   # is the cname a distribution_list already?
   if (grep /^$cname$/, @DISTRIBUTION_LISTS) {
      print "addDistributionListAlias $cname\@$DOMAIN $alias\@$DOMAIN\n";
   } else {
      print "zmprov aaa $cname\@$DOMAIN $alias\@$DOMAIN\n";
   }
}

# read an included alias file. comments with Name: and Description:
# are placed into LDAP attributes for the list
sub parse_include {
   my ($alias, $cname) = @_;
   
   # need to pull in contents of file and make a dist
   # list instead of an alias
   my $fullfile = $cname;
   $fullfile =~ s/:include://;
   
   my ($file,$path) = fileparse($fullfile);
   
   if (! -e $file) {
      warn "WARNING skipping $alias -> $cname Please run 'scp $SOURCE_HOST:$fullfile .'";
      return; # go to next line of aliases file
   } else {
      my (@cnames, $description, $display_name);
      
      # process include file
      open(F,$file) || warn "Can not read $file";

      while (<F>) {
         chomp;
         #(m/#\s*Department:*\s*(.*)/) && ($ou = $1); #can't make use of this in zmprov mdl
         
         if (m/#\s*Description:*\s*(.*)/) {
            $description = $1;
            $description =~ s/"/'/g; # don't blow our command line
         }

         if (m/#\s*Name:*\s*(.*)/) {
            $display_name = $1;
            $display_name =~ s/"/'/g; # don't blow our command line
         }
         
         s/#.*$//; # skip comments
         next if /^\s*$/; # skip blank lines
         push @cnames, $_;
      }
      
      return ($description, $display_name, \@cnames);
   }
}
agarrett5
 
Posts: 2
Joined: Thu May 15, 2014 8:17 am
Location: UK

Return to Help!

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest