Master Server and two slaves

The data will be loaded with the same script of the previous section, in the master and in the slaves, with the following differences:

In the master "DC=CHAOSDIMENSION, dc=ORG" we will execute this script creating_base.sh to create the base:

Create Base Configuration
#!/bin/sh
if [ ${#@} != 1 ]
then
echo "Is needed the parameter base DN of the master"
echo "For example creating_base.sh dc=CHAOSDIMENSION,dc=ORG"
exit
fi
DC=`echo $1|cut -d\= -f 2|cut -d\, -f 1`
slapadd << EOF
dn: $1
objectClass: dcObject
objectClass: organization
description: Base object
dc: $DC
o: My own Base Organization
EOF
End

Also with the script of the previous section we will load the domains
"DC=domain1, DC=CHAOSDIMENSION, DC=ORG" and "DC=domain2, DC=CHAOSDIMENSION, DC=ORG".

In slave1 we will execute script with "DC=domain1, DC=CHAOSDIMENSION, DC=ORG" and in slave2 with "DC=domain2, DC=CHAOSDIMENSION, DC=ORG". In both cases both LDAP slave servers will be configured for their own DN.

At last we need to create the user for replica, who could make with the following script (user_replica.sh) with parameters name of the user and the DN base:

Create replica user Configuration
#!/bin/sh
if [ ${#@} != 2 ]
then
echo "Are needed the parameters name of user and DN base for replica"
echo "For example user_replica.sh replicator dc=domain1,dc=CHAOSDIMENSION,dc=ORG"
exit
fi
KEY=`makepasswd -crypt -chars=7 \
-string="abcdefghijklmnopqrstuvwxyz1234567890"`
PASS=`echo $KEY|awk '{ print $1}'`
CRYPT=`echo $KEY|awk '{ print $2}'`

echo "Creating user $1 with password: $PASS"

slapadd << EOF
dn: cn=$1,ou=people,$2
displayName: Debian User,,,
userPassword: {crypt} $CRYPT
sambaLMPassword:
sambaNTPassword:
sn: $1
givenName: $1
cn: $1
homeDirectory: /home/$1
loginShell: /bin/false
uidNumber: 10000
gidNumber: 100
gecos: $1
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
shadowInactive: 0
shadowLastChange: 12438
gosaDefaultLanguage: en_EN
uid: $1
objectClass: posixAccount
objectClass: shadowAccount
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: gosaAccount
objectClass: top
EOF
End

aescanero AT gmail.com