# (C) 2004 Jean-Michel Dault # This program is Free Software under the GNU General Public License (>=v2). # Read the file COPYING that comes with this packages for details. #!/bin/bash # Backup LDAP DB because it might be overwrited during transition # From DLS 10.1 to DLS 2006 if [ ! -e /mnt/storage/backup-kolab ]; then mkdir /mnt/storage/backup-kolab fi if [ ! -e /mnt/storage/backup-kolab/orig ]; then BAK="/mnt/storage/backup-kolab/orig" else BAK="/mnt/storage/backup-kolab/`date +%Y%m%d-%H%M%S`" fi echo "Backuping config files in $BAK" mkdir -p $BAK for files in /etc/postfix/main.cf /etc/postfix/master.cf \ /etc/postfix/transport /etc/postfix/virtual \ /etc/cyrus.conf /etc/imapd.conf \ /etc/proftpd.conf /etc/openldap/slapd.conf \ /etc/sysconfig/saslauthd \ /etc/httpd/conf.d/41_mod_ssl.default-vhost.conf \ /etc/samba/smb.conf do cp $files $BAK done cp -a /var/lib/ldap $BAK if [ ! -d /var/lib/kolab ]; then mkdir -p /var/lib/kolab chown ldap.ldap /var/lib/kolab chmod 750 /var/lib/kolab else cp -a /var/lib/kolab $BAK fi for service in ldap saslauthd cyrus-imapd httpd postfix do chkconfig --level 35 $service off done SLAP="/etc/openldap/slapd.conf" SSL="/etc/httpd/conf.d/41_mod_ssl.default-vhost.conf" perl -pi -e "s|include.*kolab.*||sg;" $SLAP perl -pi -e "s|^#.*KOLAB.*||sg;" $SLAP perl -pi -e "s|^(#\s)?(rootpw)(.*)|# *** NOTE: *** KOLAB USES /etc/openldap/slapd-kolab.conf\n\1\2\3|;" $SLAP perl -pi -e "s|^(#\s)?(rootdn)(.*)|# *** NOTE: *** KOLAB USES /etc/openldap/slapd-kolab.conf\n\1\2\3|;" $SLAP grep -qv "kolab/slapd" $SLAP && echo "include /etc/openldap/slapd-kolab.conf" >> $SLAP PVER=`ls /usr/share/doc/|grep postfix|sort -n|tail -n1` perl -pi -e "s|(postfix-.*/)(README.*)|postfix-$PVER/\2|;" /etc/kolab/main.cf.template perl -pi -e "s|(postfix-.*/)(sample.*)|postfix-$PVER/\2|;" /etc/kolab/main.cf.template #Temporary hack perl -pi -e "s|TLS_CACERT |#TLS_CACERT |;" /etc/openldap/ldap.conf /etc/init.d/kolab-server stop #groupadd -g 60001 kolab 2>/dev/null #usermod -G kolab apache #usermod -G kolab cyrus #usermod -G kolab,postdrop postfix #usermod -G kolab,adm ldap #chown root:kolab /usr/sbin/kolab-mkntpwd #chmod 750 /usr/sbin/kolab-mkntpwd #Make sure Samba is started and a SID is created. #The only way to do it is these three commands. /etc/init.d/smb stop >/dev/null 2>/dev/null /usr/sbin/smbd -D -s /etc/kolab/smb-fake.conf >/dev/null 2>/dev/null smbclient -s /etc/kolab/smb-fake.conf -L localhost -N >/dev/null 2>/dev/null samba_sid=`net -s /etc/kolab/smb-fake.conf getlocalsid|cut -f2 -d:|cut -c2-` echo -n $samba_sid > /etc/kolab/sambasid /usr/sbin/kolab_bootstrap.real $@ killall smbd /etc/init.d/kolab-server stop if [ -f /etc/kolab/cert.pem ];then perl -pi -e "s|(.*)(SSLCertificateFile\s*)(/etc.*server\..*)|# MODIFIED BY KOLAB\n\1\2/etc/kolab/cert.pem|g;" $SSL perl -pi -e "s|(.*)(SSLCertificateKeyFile\s*)(/etc.*server\..*)|# MODIFIED BY KOLAB\n\1\2/etc/kolab/key.pem|g;" $SSL perl -pi -e "s|^(TLSCertificateFile\s*)(.*)|# MODIFIED BY KOLAB\n\1/etc/kolab/cert.pem|g;" $SLAP perl -pi -e "s|^(TLSCertificateKeyFile\s*)(.*)|# MODIFIED BY KOLAB\n\1/etc/kolab/key.pem|g;" $SLAP fi touch /etc/kolab/.configured