File: CreatePem.sh

package info (click to toggle)
znc 0.045-3%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,120 kB
  • ctags: 2,324
  • sloc: cpp: 17,406; sh: 2,380; perl: 448; makefile: 134
file content (28 lines) | stat: -rwxr-xr-x 514 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh

if [ "$1" = "" ]; then
	echo CreatePem.sh file.pem
	exit 1
fi

log () {
	echo [`date`] $*
}

log Creating Random File for key seed
dd if=/dev/urandom of=blah-1234.txt bs=1024k count=10 >/dev/null 2>&1

openssl genrsa -rand blah-1234.txt -out ${1}.key
openssl req -new -key ${1}.key -out ${1}.csr
openssl x509 -req -days 365 -in ${1}.csr -signkey ${1}.key -out ${1}.crt

log Cleaning up
rm -f blah-1234.txt ${1}.csr
log done

cat ${1}.key > $1
cat ${1}.crt >> $1

rm ${1}.key ${1}.crt

echo "Created $1"