iredmail_restore_from_ldif
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=Manager,dc=<yourdomain>,dc=com" -w password -h localhost -b "dc=<yourdomain>,dc=com"
iredmail_restore_from_ldif.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1