Sophie

Sophie

distrib > Mandriva > 10.0 > i586 > by-pkgid > 29284430c3b8d1fcc7e667ccf5265667 > files > 11

kolab-server-1.0-0.23.100mdk.i586.rpm

#!/bin/sh

##  Copyright (c) 2003 Martin Konold <martin.konold@erfrakon.de>
##  Copyright (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
##  This program is Free Software under the GNU General Public License (>=v2).
##  Read the file COPYING that comes with this packages for details.


cd /etc/kolab

if [ $1 ];then
  HN=$1
else
  HN=`hostname -f`
fi

echo "[ req ]" > tmp.req.cnf
echo "distinguished_name = req_distinguished_name" >> tmp.req.cnf
echo "default_bits = 1024" >> tmp.req.cnf
echo "prompt = no" >> tmp.req.cnf
echo "x509_extensions = v3_req" >> tmp.req.cnf
echo >> tmp.req.cnf
echo "string_mask = nombstr" >> tmp.req.cnf
echo >> tmp.req.cnf
echo "[ req_distinguished_name ]" >> tmp.req.cnf
echo "CN = $HN" >> tmp.req.cnf
echo >> tmp.req.cnf
echo "[ v3_req ]" >> tmp.req.cnf
echo "basicConstraints = CA:TRUE" >> tmp.req.cnf

echo -n "generate self-signed certificate for hostname $HN... "

    /usr/bin/openssl req -new -x509 -outform PEM -keyform PEM -nodes \
                                   -days 3650 -out cert.pem -keyout key.pem \
		                   -config tmp.req.cnf >/dev/null 2>&1
echo "done"

#chgrp kolab key.pem
chmod 0644 key.pem
#chgrp kolab cert.pem
chmod 0644 cert.pem

rm -f tmp.req.cnf

cd -

echo "New certificate has been installed under /etc/kolab/"