Pengenalan
iRedMail merupakan email server berbasis open source yang dapat diimplementasikan pada berbagai jenis distribusi linux seperti CentOS Stream, Rocky, Alma, Debian, Ubuntu, FreeBSD, OpenBSD. iRedMail mulai dikembangkan pada tahun 2007 dan sampai saat ini masih dikembangkan oleh komunitas.
Saya mendapatkan kesempatan untuk melakukan migrasi data email dari iRedMail ke Zimbra Network Edition. Proses migrasi akan menggunakan tools IMAPSync, tools IMAPSync sudah menjadi alternatif bagi yang ingin memindahkan data email dari platform satu ke platform lain secara gratis.
Catatan penting :
IMAPSync hanya akan memindahkan data email saja.
Persiapan
Sebelum melakukan migrasi, berikut beberapa hal yang perlu dipersiapkan terlebih dahulu.
- Zimbra Network Edition 8.8.15
- iRedMail 1.1
- Tools IMAPSync.
Konfigurasi iRedMail
Pada server iRedMail terdapat konfigurasi yang perlu dilakukan sebelum dilakukannya migrasi.
- Ubah file dovecot.conf yang terdapat di direktori /etc/dovecot, agar mendukung PLAIN autentikasi. Ubah sehingga menjadi seperti berikut.
ssl = yes #line 47
disable_plaintext_auth = no #line 57
- Restart service Dovecot
# systemctl restart dovecot
- Pastikan user sudah bisa login menggunakan PLAIN autentikasi. Pakai perintah berikut untuk memastikan user sudah bisa login menggunakan PLAIN autentikasi.
# telnet 192.168.1.166 143
Trying 192.168.1.166...
Connected to 192.168.1.166.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
a1 login user@domain.com password
a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT
SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1
CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY
MOVE SNIPPET=FUZZY SPECIAL-USE QUOTA ACL RIGHTS=texk] Logged in
- Membuat User Master pada Dovecot yang berfungsi seperti user admin pada zimbra. User Master ini digunakan untuk login saat proses IMAPSync dan dapat mengakses mailbox user.
- Masuk ke direktori /etc/dovecot ubah hak akses file dovecot-master-user menjadi seperti berikut.
# chmod 777 dovecot-master-user
- Jalankan perintah doveadm pw -s SSHA512 untuk generate password dengan enkripsi SSHA 512.
# doveadm pw -s SSHA512
Enter new password: masukkan_password_baru
Retype new password: Masukkan_ulang_password_baru
//output password dengan enkripsi SSHA 512
{SSHA512}B0VHomJaMk6aLXOPglgNgJtCUA8JRnOweAwJxRW6NPWSNZ25rG/L6T05DJXH+t8WCQkemBilgkcEi6mq4Kadssivtts=
- Tambahkan user dan password yang telah digenerate pada file dovecot-master-user dengan format username:password.
master@not-exist.com:{SSHA512}B0VHomJaMk6aLXOPglgNgJtCUA8JRnOweAwJxRW6NPWSNZ25rG/L6T05DJXH+t8WCQkemBilgkcEi6mq4Kadssivtts=
- Ubah hak akses file dovecot-master-user yang terdapat di /etc/dovecot ke dafault atau seperti semula.
# chmod 500 dovecot-master-user
Baca juga artikel Instalasi RedHat 8 di Virtualbox
Migrasi
Proses lamanya migrasi tergantung besaran data email yang akan dimigrasikan. Tool IMAPSync akan dijalankan di server Zimbra.
- Install paket-paket dependency atau paket-paket pendukung agar IMAPSync dapat berjalan.
# sudo apt-get install \
libauthen-ntlm-perl \
libclass-load-perl \
libcrypt-openssl-rsa-perl \
libcrypt-ssleay-perl \
libdata-uniqid-perl \
libdigest-hmac-perl \
libdist-checkconflicts-perl \
libencode-imaputf7-perl \
libfile-copy-recursive-perl \
libfile-tail-perl \
libio-compress-perl \
libio-socket-inet6-perl \
libio-socket-ssl-perl \
libio-tee-perl \
libjson-webtoken-perl \
libmail-imapclient-perl \
libmodule-scandeps-perl \
libnet-dbus-perl \
libnet-ssleay-perl \
libpar-packer-perl \
libproc-processtable-perl \
libreadonly-perl \
libregexp-common-perl \
libsys-meminfo-perl \
libterm-readkey-perl \
libtest-fatal-perl \
libtest-mock-guard-perl \
libtest-mockobject-perl \
libtest-pod-perl \
libtest-requires-perl \
libtest-simple-perl \
libunicode-string-perl \
liburi-perl \
libtest-nowarnings-perl \
libtest-deep-perl \
libtest-warn-perl \
make \
time \
cpanminus -y
- Download IMAPSync package.
# wget -N https://imapsync.lamiral.info/imapsync
- Ubah permission pada file imapsync agar dapat di eksekusi sebagai bash script.
# chmod +x imapsync
- Pindahkan file imapsync ke folder /usr/bin agar file tersebut bisa dijalankan sebagai perintah system linux.
# cp imapsync /usr/bin/
- Buat file scriptmigrasi.sh berisikan syntax berikut.
#!/bin/bash
##Modified by Steve Fink stevef-at-ublug.org
##This IMAPSync Batch Script is used when you have different
##usernames on the Source and Destination servers
##(kinda what IMAPSync was intended for)
##the format for the user-list.csv file is
##sourceusername,sourcepassword,destinationusername,destinationpassword
## Get the info
while [ -z $infile ]; do
echo "What is the path to the input file?"
read infile
done
while [ -z $host1 ]; do
echo "What is the Source Host? (mail1.domain.com)"
read host1
done
while [ -z $host2 ]; do
echo "What is the Destination Host? (mail2.domain.com)"
read host2
done
#while [ -z $domain ]; do
# echo "What is the Domain? (domain.com)"
# read domain
#done
while [ -z $logfile ]; do
echo "Where would you like the log? (synclog.txt)"
read logfile
done
if [ ! -f $infile ]; then
echo "The input file does not exist!"
echo ""
echo "What is the path to the input file?"
read infile
fi
INPUTFILE=$infile
clear
echo "IMAPSync is about to begin using:"
echo "Input File $INPUTFILE"
echo "Source Host $host1"
echo "Destination Host $host2"
#echo "Domain $domain"
echo "Log File $logfile"
echo ""
echo "Is this information correct?"
echo "Press Enter to continue or"
echo "Hit CTRL+C to start over"
read wait
## Begin IMAPSync
date=`date +%X_-_%x`
echo "IMAPSync Logfile started @ $logfile"
echo "" >> $logfile
echo "------------------------------------" >> $logfile
echo "IMAPSync started.. $date" >> $logfile
echo "" >> $logfile
#Get rid of the commas
tr "," " " <$INPUTFILE | while read u1 u2
do
user=$u1
user2=$u2
echo "Syncing User $user to $user2"
date=`date +%X_-_%x`
echo "Start Syncing User $user to $user2"
echo "Starting $u1 $date" >> $logfile
imapsync --host1 $host1 --user1 $user*master@not-exist.com --password1 PASSWORD \
--host2 $host2 --user2 $user2 --authuser2 admin --password2 PASSWORD -ssl1 -ssl2 \
--nofoldersizes --nofoldersizesatend --skipsize --fast
date=`date +%X_-_%x`
echo "User $user to $user2 done"
echo "Finished $user to $user2 $date" >> $logfile
echo "" >> $logfile
done
date=`date +%X_-_%x`
echo "" >> $logfile
echo "IMAPSync Finished.. $date" >> $logfile
echo "------------------------------------" >> $
- Ubah permission pada file scriptmigrasi.sh agar dapat di eksekusi sebagai bash script.
# chmod +x scriptmigrasi.sh
- Masukan informasi server iRedMail dan Zimbra serta masukan list user yang ingin dimigrasikan. Jalankan script tersebut.
# ./scriptmigrasi.sh
What is the path to the input file?
/root/imapsync/listuser.csv ##masukan path list user yang telah dibuat
What is the Source Host? (mail1.domain.com)
192.168.1.166 ##IP Host1
What is the Destination Host? (mail2.domain.com)
192.168.1.168 ##IP Host2
Where would you like the log? (synclog.txt)
/tmp/log-migrasi.txt ##path file log
- Pastikan informasi server iRedMail dan Zimbra sudah benar.
IMAPSync is about to begin using:
Input File /root/imapsync/listuser.csv
Source Host 192.168.1.166
Destination Host 192.168.1.168
Log File /tmp/log-migrasi.txt
Is this information correct?
Press Enter to continue or Hit CTRL+C to start over (Press Enter)
- Proses migrasi sedang berjalan dan akan ada log seperti di bawah ini
Finalisasi
Login ke webmail zimbra menggunakan user yang telah dimigrasikan data email-nya, pastikan data email sudah tersinkronisasi.
Terima kasih sudah membaca artikel ini. Jika terdapat pertanyaan atau kritik/saran bisa tuliskan di komentar ya!
