logotype
  • Home
  • News
  • Product dan Services
    • Zimbra Mail Server
      • Excellent Managed Services Email
      • Lisensi Zimbra NE
      • Support dan Maintenance
      • MX Backup & ASAV
      • SMTP Relay
    • Proxmox
      • Proxmox Virtual Environment
      • Proxmox Mail Gateway
      • Proxmox Backup Server
    • XCP-ng
    • Red Hat Enterprise Linux
    • Ubuntu Pro
    • AI Readiness Program
    • Nakivo Backup & Recovery
    • Vinchin Backup & Recovery
    • Lisensi
      • Proxmox Mail Gateway
      • Lisensi Zimbra Network Edition
      • Lisensi Nakivo Backup & Recovery
      • Subscription Zoom
    • Buku Training Mandiri
      • Buku Training Mandiri
      • Ebook Training Mandiri
    • Cloud & Hosting
      • Excellent Managed Services Email Server
      • MX Backup/Anti Spam & Anti Virus
      • SMTP Relay & Mail Gateway
      • Excellent Mail Hosing
    • SSL Sertifikat
  • Training
  • Insight
  • About Us
  • Contacts
logotype
logotype
  • Home
  • News
  • Product dan Services
    • Zimbra Mail Server
      • Excellent Managed Services Email
      • Lisensi Zimbra NE
      • Support dan Maintenance
      • MX Backup & ASAV
      • SMTP Relay
    • Proxmox
      • Proxmox Virtual Environment
      • Proxmox Mail Gateway
      • Proxmox Backup Server
    • XCP-ng
    • Red Hat Enterprise Linux
    • Ubuntu Pro
    • AI Readiness Program
    • Nakivo Backup & Recovery
    • Vinchin Backup & Recovery
    • Lisensi
      • Proxmox Mail Gateway
      • Lisensi Zimbra Network Edition
      • Lisensi Nakivo Backup & Recovery
      • Subscription Zoom
    • Buku Training Mandiri
      • Buku Training Mandiri
      • Ebook Training Mandiri
    • Cloud & Hosting
      • Excellent Managed Services Email Server
      • MX Backup/Anti Spam & Anti Virus
      • SMTP Relay & Mail Gateway
      • Excellent Mail Hosing
    • SSL Sertifikat
  • Training
  • Insight
  • About Us
  • Contacts
logotype
  • Home
  • News
  • Product dan Services
    • Zimbra Mail Server
      • Excellent Managed Services Email
      • Lisensi Zimbra NE
      • Support dan Maintenance
      • MX Backup & ASAV
      • SMTP Relay
    • Proxmox
      • Proxmox Virtual Environment
      • Proxmox Mail Gateway
      • Proxmox Backup Server
    • XCP-ng
    • Red Hat Enterprise Linux
    • Ubuntu Pro
    • AI Readiness Program
    • Nakivo Backup & Recovery
    • Vinchin Backup & Recovery
    • Lisensi
      • Proxmox Mail Gateway
      • Lisensi Zimbra Network Edition
      • Lisensi Nakivo Backup & Recovery
      • Subscription Zoom
    • Buku Training Mandiri
      • Buku Training Mandiri
      • Ebook Training Mandiri
    • Cloud & Hosting
      • Excellent Managed Services Email Server
      • MX Backup/Anti Spam & Anti Virus
      • SMTP Relay & Mail Gateway
      • Excellent Mail Hosing
    • SSL Sertifikat
  • Training
  • Insight
  • About Us
  • Contacts
Blog Post
ResourceSLES, RHEL & Zextras

Tips Export-Import Data Account Zimbra Menjadi Data LDAP

October 1, 2012by Masim Vavai Sugianto

Beberapa waktu yang lalu, team Excellent diminta oleh salah satu klien instansi pemerintah di daerah Bogor untuk melakukan setup Zimbra Mail Server dengan external account authentication menggunakan LDAP. Meski Zimbra sendiri sudah menggunakan LDAP, klien Excellent meminta dibuatkan LDAP tersendiri yang nantinya akan digunakan sebagai pusat account untuk keperluan single identity (SSO/Single Sign On/Single Login)

Konfigurasi LDAP Server menggunakan SUSE Linux Enterprise Server (SLES) tidak terlalu sulit karena bisa mengikuti wizard via YAST | Network Services | LDAP Server. Yang sulit adalah melakukan import data account Zimbra menjadi data LDIF yang bisa diimport ke LDAP server milik SLES.

Bagi rekan-rekan yang mengalami kendala yang sama, berikut adalah script modifikasi dari artikel Script untuk Export-Import Account Zimbra+Password . Script ini saya modifikasi agar memasukkan data home directory, GID, UID dan lain-lain yang diperlukan oleh POSIX Schema. Silakan dimodifikasi sesuai keperluan.

[code lang=”bash”] #!/bin/sh

#Hapus Layar
clear

echo -e “###################################################################################”
echo -e “# Zimbra export-ldap.sh ver 0.0.1 #”
echo -e “# Skrip untuk export account Zimbra berikut profile dan password #”
echo -e “# Masim ‘Vavai’ Sugianto – vavai@vavai.com – http://www.vavai.com #”
echo -e “# PT. Excellent Infotama Kreasindo : http://www.excellent.co.id #”
echo -e “###################################################################################”

# /* Variable untuk bold */
ibold=”\033[1m””\n===> ”
ebold=”\033[0m”

# /* Parameter */
echo “”
echo -n “Enter Domain Name (ex : vavai.com) : ”
read NAMA_DOMAIN
echo -n “Enter path folder for exported account (ex : /home/vavai/) : ”
read FOLDER

# /* Membuat file hasil export dan mengisi nama domain */
MOD_FILE=”$FOLDER/zcs-acc-mod.ldif”
LDIF_FILE=”$FOLDER/acc-add.ldif”

vUID=1004

rm -f $MOD_FILE
rm -f $LDIF_FILE

touch $MOD_FILE
touch $LDIF_FILE

# /* Check versi Zimbra yang digunakan */
VERSION=`su – zimbra -c ‘zmcontrol -v’`;
ZCS_VER=”/tmp/zcsver.txt”
# get Zimbra LDAP password
ZIMBRA_LDAP_PASSWORD=`su – zimbra -c “zmlocalconfig -s zimbra_ldap_password | cut -d ‘ ‘ -f3″`

touch $ZCS_VER
echo $VERSION > $ZCS_VER

echo -e $ibold”Retrieve Zimbra User…………………………”$ebold

grep “Release 5.” $ZCS_VER
if [ $? = 0 ]; then
USERS=`su – zimbra -c ‘zmprov gaa’`;
LDAP_MASTER_URL=`su – zimbra -c “zmlocalconfig -s ldap_master_url | cut -d ‘ ‘ -f3″`
fi

grep “Release 7.” $ZCS_VER
if [ $? = 0 ]; then
USERS=`su – zimbra -c ‘zmprov -l gaa’`;
LDAP_MASTER_URL=”ldapi:///”
fi

echo -e $ibold”Processing account, please wait…………………………”$ebold
# /* Proses insert account kedalam file hasil export */
for ACCOUNT in $USERS; do
NAME=`echo $ACCOUNT`;
DOMAIN=`echo $ACCOUNT | awk -F@ ‘{print $2}’`;
ACCOUNT=`echo $ACCOUNT | awk -F@ ‘{print $1}’`;
ACC=`echo $ACCOUNT | cut -d ‘.’ -f1`

if [ $NAMA_DOMAIN == $DOMAIN ] ;
then
OBJECT=”(&(objectClass=zimbraAccount)(mail=$NAME))”
dn=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep dn:`

displayName=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep displayName: | cut -d ‘:’ -f2 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

givenName=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep givenName: | cut -d ‘:’ -f2 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

userPassword=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep userPassword: | cut -d ‘:’ -f3 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

cn=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep cn: | cut -d ‘:’ -f2 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

initials=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep initials: | cut -d ‘:’ -f2 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

sn=`/opt/zimbra/bin/ldapsearch -H $LDAP_MASTER_URL -w $ZIMBRA_LDAP_PASSWORD -D uid=zimbra,cn=admins,cn=zimbra -x $OBJECT | grep sn: | cut -d ‘:’ -f2 | sed ‘s/^ *//g’ | sed ‘s/ *$//g’`

if [ “$giveName” == “” ]; then
echo ”
dn: uid=$ACCOUNT,ou=people,dc=excellent,dc=co,dc=id
cn: $displayName
sn: $sn
uid: $ACCOUNT
objectClass: top
objectClass: inetOrgPerson
objectClass: posixAccount
gidNumber: 100
uidNumber: $vUID
homeDirectory: /home/$ACCOUNT
loginShell: /bin/bash
” >> $LDIF_FILE

echo “$dn
changetype: modify
replace: userPassword
userPassword:: $userPassword
” >> $MOD_FILE

else

echo ”
dn: uid=$ACCOUNT,ou=people,dc=excellent,dc=co,dc=id
cn: $displayName
givenName: $givenName
sn: $sn
uid: $ACCOUNT
objectClass: top
objectClass: inetOrgPerson
objectClass: posixAccount
gidNumber: 100
uidNumber: $vUID
homeDirectory: /home/$ACCOUNT
loginShell: /bin/bash
” >> $LDIF_FILE

echo “$dn
changetype: modify
replace: userPassword
userPassword:: $userPassword
” >> $MOD_FILE

fi

echo “Adding account $NAME”
fi
let vUID=vUID+1
done
echo -e $ibold”All account has been exported sucessfully into $MOD_FILE and $LDIF_FILE…”$ebold

[/code]

Script diatas akan menghasilkan 2 buah file. File pertama adalah acc-add.ldif dan zcs-acc-mod.ldif. File yang pertama digunakan untuk input data LDAP dengan perintah sebagai berikut :

[code lang=”bash”] ldapadd -Wx -D “cn=Administrator,dc=excellent,dc=co,dc=id” -H ldap://localhost -f acc-add.ldif
[/code]

Sedangkan file kedua digunakan untuk modify password agar sesuai dengan password yang ada di Zimbra, dijalankan dengan perintah :
[code lang=”bash”] ldapmodify -f zcs-acc-mod.ldif -x -H ldapi:/// -D “cn=Administrator,dc=excellent,dc=co,dc=id” -w PasswordLDAPServer
[/code]

LDAP Script Zimbra
Prev

Instalasi & Konfigurasi Samba 4 Sebagai Active Directory Server Bagian 5-NTP Server & Join Domain

Next

Training : Mastering Proxmox VE (iSCSI/NFS/DRBD Cluster & High Availability), 27-28 Oktober 2012

Related Posts

Resource
September 23, 2012

Instalasi & Konfigurasi Samba 4 Sebagai Active Directory Server-Bagian 1-Instalasi & Kompilasi

Read more
ResourceZimbra
January 8, 2013

Tips Zimbra : Otomatis Bounce jika Account Tujuan Over Kuota

Read more
ResourceZimbra
August 1, 2012

Tips Zimbra : Konfigurasi Waktu Deferred Email (Queue Life Time/Mailer Daemon)

Read more

Comments(02)

  1. By novian nur cahya
    October 4, 2012

    mas, klo misalnya SSOnya pake Ms. AD, punya tutornya gak untuk export-import?

  2. By ekosan
    November 23, 2012

    Mas misal mau backup account+password tapi banyak sub domain itu bagaimana? terima kasih

Leave a Reply

Your email address will not be published. Required fields are marked *

Search
Recent Post
  • Mengurangi Ketergantungan pada Server Fisik dengan Proxmox VE
  • Migrasi Proxmox VE Tanpa Pendampingan Ahli? Risiko Downtime Bisa Menghentikan Operasional Bisnis Anda
  • Informasi Keamanan: Mengatasi Celah Keamanan SNMP Swatchdog di Zimbra (Severity S1)
  • Apa itu AI Readiness Program? Panduan bagi Perusahaan yang Ingin Mulai Menggunakan AI
  • 36.000+ Packages, 10 Tahun Perlindungan
Categories
Archives
Featured image: Tips Export-Import Data Account Zimbra Menjadi Data LDAP
Get in Touch

KATEGORI

  • Home
  • Artikel
  • Training
  • Event
  • Berita

LAYANAN

  • Zimbra Mail Server
  • Ubuntu
  • XCP-ng
  • Vinchin
  • ASAV
  • Proxmox
  • RHEL
  • Nakivo
  • SMTP Relay
  • SSL Certificate

KONTAK KAMI

PT. Excellent Infotama Kreasindo, Premier Serenity Blok J12, Jl. KH. Agus Salim No. 40E, Bekasi Jaya, Bekasi Timur, Bekasi 17112, Jawa Barat, Indonesia

TENTANG KAMI

PT. Excellent Infotama Kreasindo merupakan entitas bisnis yang fokus pada layanan komputerisasi seperti implementasi sistem, konsultasi, training/workshop, dan maintenance sistem, terutama migrasi dari sistem Windows ke Linux. more…