On Thu, 24 Jan 2002, Brendon Colby wrote:
> I'm curious if there's a better / easier way to add a rcpthosts and locals entry
> to the LDAP database, in a qmail-ldap cluster environment, rather than having to
> update every mail host separately. What I do now is pull down the LDIF and
> add the entries, then use ldapmodify to add the updated list of rcpthosts and
> locals. I do this on all 8 mail hosts (which is a real pain). Is there something
> I'm missing?
hehe. how does rsync let you sync up to LDAP?
A simple shell script could work like:
#!/bin/sh
HOSTDN="dc=myhost,ou=Devices,dc=domain,dc=tld"
TMPFILE=/tmp/mod.ldif
echo "dn: $HOSTDN" > $TMPFILE
echo "changetype: modify" >> $TMPFILE
echo "replace: locals" >> $TMPFILE
for i in $(cat /var/qmail/control/locals)
do
echo "locals: $i" >> $TMPFILE
done
echo "-" >> $TMPFILE
echo "replace: rcpthosts" >> $TMPFILE
for i in $(cat /var/qmail/control/rcpthosts)
do
echo "rcpthosts: $i" >> $TMPFILE
done
# eof
and then sync up to LDAP based on local system values. If there is some
other way you're modifying the LDAP entries, you'll need to pull them
down. But then, you could ask the question: why aren't you updating LDAP
using that method?
d!