comparison make-certificate @ 0:e85e3470a41e

Initial commit of useful scripts
author IBBoard <dev@ibboard.co.uk>
date Sat, 02 Aug 2014 19:31:02 +0100
parents
children 14c88dd76d53
comparison
equal deleted inserted replaced
-1:000000000000 0:e85e3470a41e
1 #! /bin/bash
2
3 set -e
4
5 if [ $# -ne 1 ]; then
6 echo "Usage: $0 <key-name>"
7 exit 1
8 fi
9
10 if [ ! -d ~/Websites/certs/ ]; then
11 echo "~/Websites/certs/ didn't exist - can't create certs"
12 exit 1
13 fi
14
15 pushd ~/Websites/certs/
16
17 #openssl genrsa -des3 -out $1.key 4096
18 #openssl req -new -key $1.key -out $1.csr
19 #openssl x509 -req -days 365 -in $1.csr -CA ~/.ssh/CA/ca.crt -CAkey ~/.ssh/CA/ca.key -CAserial ~/.ssh/CA/ca.srl -out $1.crt
20 #-set_serial $serial
21 #openssl rsa -in $1.key -out $1.key.insecure
22 #mv $1.key $1.key.secure
23 #mv $1.key.insecure $1.key
24 #echo $(($serial + 1)) > ~/.ssh/CA/next-serial.dat
25 openssl req -nodes -newkey rsa:2048 -keyout $1.key -out $1.csr -subj "/C=GB/ST=Worcestershire/O=$1/CN=$1"
26 openssl x509 -req -days 365 -in $1.csr -CA ~/.ssh/CA/ca.crt -CAkey ~/.ssh/CA/ca.key -CAserial ~/.ssh/CA/ca.srl -out $1.crt
27 popd