1

Topic: Migrate all accounts to new server

Hi, I need help. I need to migrate whole iredmail with iredadmin pro from old server to new one. I installed fresh debian squeeze server with fresh installation of iredmail and iredadmin ldap pro. But when I want to migrate ldap from old server, i ged this errors:

==================================================================================
Could not add the object to the LDAP server.
LDAP said:    Constraint violation
Error number:    0x13 (LDAP_CONSTRAINT_VIOLATION)
Description:    Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.

LDIF text import
Could not add object domainname=domena.cz,o=domains,dc=xxx,dc=cz
LDAP said:    Constraint violation
Error number:    0x13 (LDAP_CONSTRAINT_VIOLATION)
Description:    Some constraint would be violated by performing the action. This can happen when you try to add a second value to a single-valued attribute, for example.

=========================================================================================================


So nothing was imported. I followed this help: http://www.iredmail.org/wiki/index.php? … ail.Server

Maybe I made mistake by removing lines from ldif file? Which lines must I remove? Other steps are ok, but ldap can get to work. Can anyone help me?


==== Provide required information to help troubleshoot and get quick answer ====
- iRedMail version: last LDAP version
- Linux/BSD distribution name and version: Debian Squeeze
====

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Migrate all accounts to new server

Please follow this wiki tutorial to backup and restore LDAP data:
http://www.iredmail.org/wiki/index.php? … FAQ/Backup

3

Re: Migrate all accounts to new server

This howto i followed already x times. I followed step after step. I remove all content in /var/lib/ldap/server.cz, I made import with slapadd, but when I start slapd, the iredadmin give mi error message: internal server error. Why??


ZhangHuangbin wrote:

Please follow this wiki tutorial to backup and restore LDAP data:
http://www.iredmail.org/wiki/index.php? … FAQ/Backup

4

Re: Migrate all accounts to new server

karl_cz wrote:

... I made import with slapadd, but when I start slapd, the iredadmin give mi error message: internal server error. Why??

- Was there any error while import import LDIF data with slapadd?
- Any error log in Apache log file of "Internal server error"?

P.S. I just realized i missed another step after restoring LDIF data, here it is:

IMPORTANT NOTE:

If you're restoring LDIF data (exported on an old iRedMail server) to a new
iRedMail server, you MUST login to phpLDAPadmin and reset passwords of
below two DNs. Because they're hard-coded in many config files. For example,
/etc/postfix/ldap/*.cf, /etc/dovecot/dovecot-ldap.conf.

    cn=vmail,dc=xxx,dc=xxx
    cn=vmailadmin,dc=xxx,dc=xxx 

The new passwords you should use can be found in the root directory of
iRedMail installation directory, for example, /root/iRedMail-0.7.4/iRedMail.tips.
Below is the sample of the passwords in file iRedMail.tips:

-------------
# File: iRedMail.tips

OpenLDAP:
    ...
    * LDAP bind dn (read-only): cn=vmail,dc=example,dc=com, password: py2BQwM0zoRM5nciK68AlP8dyu2Mq6               
    * LDAP admin dn (used for iRedAdmin): cn=vmailadmin,dc=example,dc=com, password: 9wr0mHeVYz2uaxSAGBLucVkOgYPSBB
-------------

Please login to phpLDAPadmin and reset passwords. 

It's updated in wiki tutorial also:
http://www.iredmail.org/wiki/index.php? … FAQ/Backup

So sorry about my mistake. sad

5

Re: Migrate all accounts to new server

Hi, thanks.

You wrote "If you're restoring LDIF data (exported on an old iRedMail server) to a new
iRedMail server, you MUST login to phpLDAPadmin and reset passwords of
below two DNs." - you mean on the new server?

This is my apache error log:

[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx] Traceback (most recent call last):
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/pymodules/python2.6/web/application.py", line 242, in process
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return self.handle()
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/pymodules/python2.6/web/application.py", line 233, in handle
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return self._delegate(fn, self.fvars, args)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/pymodules/python2.6/web/application.py", line 415, in _delegate
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return handle_class(cls)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/pymodules/python2.6/web/application.py", line 390, in handle_class
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return tocall(*args)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/share/apache2/iredadmin/controllers/base.py", line 40, in proxyfunc
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return func(self, *args, **kw)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/share/apache2/iredadmin/controllers/ldap/basic.py", line 244, in GET
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     connutils = connUtils.Utils()
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/share/apache2/iredadmin/libs/ldaplib/core.py", line 46, in __init__
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     self.conn.bind_s(cfg.ldap.get('bind_dn'), cfg.ldap.get('bind_pw'))
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 221, in bind_s
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     return self.result(msgid,all=1,timeout=self.timeout)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 422, in result
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 426, in result2
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 432, in result3
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]   File "/usr/lib/python2.6/dist-packages/ldap/ldapobject.py", line 96, in _ldap_call
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx]     result = func(*args,**kwargs)
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx] INVALID_CREDENTIALS: {'desc': 'Invalid credentials'}
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx] 
[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx] File does not exist: /var/www/favicon.ico

6

Re: Migrate all accounts to new server

Hi, next problem. All steps went fine. I imported ldif file from old server, but I can not do last step. I can not login to phpldapadmin. If I want to login a get this error message:

Unable to connect to LDAP server My LDAP Server
Error: Can't contact LDAP server (-1) for user
    Failed to Authenticate to server
Invalid Username or Password.

Can you help me?

7

Re: Migrate all accounts to new server

karl_cz wrote:

you mean on the new server?

Yes. (Sorry about the confusion, fixed in wiki tutorial.)

karl_cz wrote:

[Sat Apr 14 13:28:59 2012] [error] [client xx.xx.xx.xx] INVALID_CREDENTIALS: {'desc': 'Invalid credentials'}

INVALID_CREDENTIALS always means you're using an incorrect bind dn and/or password.

karl_cz wrote:

Unable to connect to LDAP server My LDAP Server Error: Can't contact LDAP server (-1) for user Failed to Authenticate to server Invalid Username or Password.

1) Make sure OpenLDAP is running
2) Make sure you're using correct bind dn and password.

8

Re: Migrate all accounts to new server

Hi, but I log in with the same password and dn, as before ldif import. Is it possible, that is any problem with openldap? For example when I want to stop this service it didnt stopped and this is problem?

9

Re: Migrate all accounts to new server

karl_cz wrote:

For example when I want to stop this service it didnt stopped and this is problem?

You can use command 'ps' to verify whether it's stopped or not. For example:

# ps aux | grep ldap
# ps aux | grep slapd

10

Re: Migrate all accounts to new server

Hi, I am sorry, but I can get it! I followed your howto step by step, but I can not get it work.

1. I export data on an old server with your ldap backup script, than I copy ldif on new server
2. I stop slapd, delete all files except DB_CONFIG
3. I imported data from ldif file
4. I start slapd - but I dont get the error messages which you wrote at howto
5. Here comes the problem, I can not login to phpldapadmin, it tells me, that can not connect, so I can not reset the passwords

Is it possible, that you make one script which can make the whole process of migrate datas???
I need to migrate datas, but now it is already 2 - 3 month of my attempts to migrate datas. It is for me really important....