summaryrefslogtreecommitdiff
path: root/community/partimage/partimaged-gencrt
blob: 16fe5ff16570f5cbd79d15605951a3dadf96d8f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

if [ `whoami` != "root" ]; then
	echo "You must be root to generate certificates."
	exit
fi

echo -n "==> Generating certificate for Partimage/PartimageD SSL... "
cd /etc/partimaged
openssl req -new -x509 -outform PEM > partimaged.csr
openssl rsa -in privkey.pem -out partimaged.key
rm privkey.pem
openssl x509 -in partimaged.csr -out partimaged.cert -signkey partimaged.key
rm partimaged.csr
chmod 600 partimaged.key
chmod 600 partimaged.cert
chown partimag:partimag partimaged.key
chown partimag:partimag partimaged.cert