APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version


Converting Sendmail and other mail servers to Kerio


As some of our readers know, I sell and support Kerio® Mailserver (and other Kerio products also).

Very often a customer is switching to Kerio from some other messaging product such as Exchange. Kerio has conversion tools for migration from Exchange or (Mac) 4D Mail, but doesn't have a tool to migrate from Sendmail or other Unix based systems. That's probably because there are so many possibilities that it would be difficult to write a tool that would handle all conditions.

Drag and Drop

Often the easiest way to convert is just to let users drag and drop the messages they want from the old system to Kerio. Set up both accounts and let the users migrate whatever messages they wish.

Imapcopy

It's also possible to convert from one system to another using tools like Kerio's free Imap migration tool. Contact me if you have a large number of users and need help generating a configuration file for this.

Kerio tools

Kerio has conversion tools for imap and Exchange.

Scripting a conversion

If the above suggestions aren't appropriate, it's never very hard to migrate to Kerio Mailserver from just about anything. Kerio is easy to understand, and easy to bring data to.

Keep in mind when reading this that actual locations vary with operating system choice and that these can be over-ridden during installation. Therefore, the relevant files may not be at the locations I show here. Adjust your coding accordingly.

Users

If you have a small number of users, it may be easy to just use the Kerio Administration console to add the users. However, if you have more than a handful, it isn't difficult to script a transfer. Kerio stores user profiles in an XMLish file. Here's an example:












Kerio now has a csv import bulit in: Import Users

<config>
<list name="User">
  <listitem>
    <variable name="Name">Admin</variable>
    <variable name="Domain">foo.com</variable>
    <variable name="Account_enabled">1</variable>
    <variable name="Auth_type">0</variable>
    <variable
    name="Password">DE3:4d3736c7d71fdf60da6431b714634c8d
6a711cd60c0eba6ee0630d5458a8</variable>
    <variable name="PIN"></variable>
    <variable name="Rights">3</variable>
    <variable name="ForwardMode">0</variable>
    <variable name="HomeServer"></variable>
    <variable name="MailboxLocation"></variable>
    <variable name="Qstorage">0</variable>
    <variable name="Qmessage">0</variable>
    <variable name="MaxOutgoingMessageSize">0</variable>
    <variable name="DefSpamFilter">1</variable>
    <variable name="PreferredAddress"></variable>
    <variable name="ReplyToAddress"></variable>
    <variable name="Fullname">Administrator</variable>
    <variable name="Description"></variable>
  </listitem>
  <listitem>
    <variable name="Name">tony</variable>
    <variable name="Domain">foo.com</variable>
    <variable name="Account_enabled">1</variable>
    <variable name="Auth_type">0</variable>
    <variable
    name="Password">DE3:b5d44bda4338bb43a76de23c8
f72b87bd0c52615cd9c5770e61e51e580dc</variable>
    <variable name="PIN"></variable>
    <variable name="Rights">0</variable>
    <variable name="ForwardMode">0</variable>
    <variable name="HomeServer"></variable>
    <variable name="MailboxLocation"></variable>
    <variable name="Qstorage">0</variable>
    <variable name="Qmessage">0</variable>
    <variable name="MaxOutgoingMessageSize">0</variable>
    <variable name="DefSpamFilter">1</variable>
    <variable name="PreferredAddress"></variable>
    <variable name="ReplyToAddress"></variable>
    <variable name="Fullname">tony l</variable>
    <variable name="Description"></variable>
  </listitem>
  <listitem>
    <variable name="Name">fred</variable>
    <variable name="Domain">foo.com</variable>
    <variable name="Account_enabled">1</variable>
    <variable name="Auth_type">0</variable>
    <variable name="Password">DE3:b5d44bda4338bb43a
76de23c8f72b87bd0c52615cd9c5770e61e51e580dc</variable>
    <variable name="PIN"></variable>
    <variable name="Rights">0</variable>
    <variable name="Authorization">kms.own.domain.only</variable>
    <variable name="Groups">shop</variable>
    <variable name="ForwardMode">2</variable>
    <variable name="ForwardAddress">fredsmith@yahoo.com</variable>
    <variable name="HomeServer"></variable>
    <variable name="MailboxLocation"></variable>
    <variable name="Qstorage">1024000</variable>
    <variable name="Qmessage">300</variable>
    <variable name="MaxOutgoingMessageSize">307200</variable>
    <variable name="DefSpamFilter">1</variable>
    <variable name="PreferredAddress"></variable>
    <variable name="ReplyToAddress"></variable>
    <variable name="Fullname">fred smith</variable>
    <variable name="Description">shop manager</variable>
  </listitem>
</list>

<list name="Group">
  <listitem>
    <variable name="Name">shop</variable>
    <variable name="Domain">foo.com</variable>
    <variable name="Rights">0</variable>
    <variable name="Description">shop group</variable>
  </listitem>
</list>

<list name="Alias">
  <listitem>
    <variable name="Lhs">boss</variable>
    <variable name="Rhs">tony@foo.com</variable>
    <variable name="Domain">foo.com</variable>
    <variable name="Description">boss</variable>
  </listitem>
</list>

</config>
 

As Kerio might change that format to add new features, you should add at least one user manually, and also add a group and alias if you will need those immediately. Then examine the file to determine its format, and then write your code to transfer from whatever you have (passwd and group files or whatever).

You need to stop the Kerio Mail Server, create your users.cfg file, and then restart Kerio. Your user information will now show up in the Administration console software.

Kerio now has a csv import bulit in: Import Users

Messages

Messages are a little more difficult. The actual storage is very simple, but Kerio doesn't create the necessary directories for a user until the user receives mail. Again, Kerio may change the structure of these directories, so the easiest method is just to send a test message to at least one user and duplicate the hierarchy. Or create a group that includes all users and send a message to that group.

Actual messages are stored within folders using a simple hexadecimal naming scheme. For example, here's simple code that will read a "mbox" format mail file and put it out to individual Kerio files:

#!/usr/bin/perl
$user=shift @ARGV;
$out=0;
open(MBOX,$user);
system("mkdir -p /opt/kerio/mailserver/store/mail/admin/$user/INBOX");
while(<MBOX>) {
   if (/^From /) {
      close O;
      $out++;
      $message=sprintf("%0.8x.eml",$out);
      open(O,">/opt/kerio/mailserver/store/mail/admin/$user/INBOX/#msgs/$message")
      or die("User has no directory yet.  Send a test message to
      create their hierarchy\n");
   }
   print O;
}
close O;
rename "/opt/kerio/mailserver/store/mail/admin/$user/INBOX/index.fld",
"/opt/kerio/mailserver/store/mail/admin/$user/INBOX/index.bad";
 

Again, you'd stop the Kerio Mailserver, run your code, and restart. For simplicity, this code ignores setting proper ownership and permissions on the created files, and of course how to do that is a little OS dependent also. On a OS X box, these would be 600, owned by root:

-rw-------   1 root  apl  276 Apr 21 10:06 00000001.eml
 

The code also doesn't attempt to set modification time - again, OS dependent and you may not care. If you do, you'll need to extract the date from the message and use that information to modify the time stamp of the file you create.

Notice the rename of "index.fld". That triggers the mailserver to update its indexes, so can also be used to remove unwanted messages (for example for a user who refuses to clean out a junk mail folder). Just stop the mailserver, do whatever you need to do, rename the appropriate "index.fld" files, and it's ready to run.

Kerio is a powerful, full featured mail server, but they have made it easy for you to work with it from the outside. The use of text files and reindexing of messages gives you the control you need.


Technorati tags:

Kerio®, and related trademarks, names and logos are the property of Kerio Technologies, Inc. and are registered and/or used in the U.S. and other countries. Used under license from Kerio Technologies, Inc.


If this page was useful to you, please help others find it:  





Comments?




More Articles by Anthony Lawrence - Find me on Google+



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


Kerio Connect Recovery

Kerio Connect Mailserver

Kerio Control Firewall

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

pavatar.jpg

This post tagged:

       - Kerio
       - Kerio Info
       - Kerio Pricing
       - Kerio RSS Feed
       - Mail
       - Sendmail


















My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide



Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals