Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


iredmail_restore_from_ldif

This is an old revision of the document!


~~TOC~~

iRedMail (OpenLDAP) restore from LDIF

  • Stop slapd:
    systemctl stop slapd
  • Check LDAP directory and delete files in directory below, except DB_CONFIG:
    # find openldap directory
    grep ^directory /etc/openldap/slapd.conf
    directory   /var/lib/ldap/<yourdomain>
    
    # delete files from directory
    cd /var/lib/ldap/<yourdomain>
    shopt -s extglob
    rm -f !(DB_CONFIG)
  • Start and immediately stop slapd to recreate nessecary files:
    systemctl start slapd
    systemctl stop slapd
  • Make sure OpenLDAP is NOT running, then restore from LDIF:
    slapadd -f /etc/openldap/slapd.conf -l /path/to/backup/backup.ldif
  • Start slapd:
    systemctl start slapd
  • Set correct permissions and restart slapd:
    chown ldap. /var/lib/ldap/<yourdomain>/*.bdb
    systemctl restart slapd
  • Change passwords for vmail and vmailadmin (see iRedMail.tips file):
    #cn=vmail,dc=xxx,dc=xxx
    #cn=vmailadmin,dc=xxx,dc=xxx
    
    ldappasswd -x -h localhost -D "cn=Manager,dc=<yourdomain>,dc=com" -w <rootpass> -s <userpass> "cn=vmail,dc=<yourdomain>,dc=com"
    ldappasswd -x -h localhost -D "cn=Manager,dc=<yourdomain>,dc=com" -w <rootpass> -s <userpass> "cn=vmailadmin,dc=<yourdomain>,dc=com"
  • Verify example:
    ldapsearch -D "cn=directory manager" -w secret -p 389 -h server.example.com -b "dc=example,dc=com"
iredmail_restore_from_ldif.1428351441.txt.gz · Last modified: 2015/04/06 20:17 by admin