File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ BASE_PATH=$( cd " ` dirname $0 ` /../test/fixtures/ca" && pwd )
4+ cd " ${BASE_PATH} " || exit 4
5+
6+ USAGE=$( cat << EOS
7+ Usage:
8+ $0 --regenerate
9+
10+ Generates a new self-signed CA, for integration testing. This should only need
11+ to be run if you are writing new TLS/SSL tests, and need to generate
12+ additional fixtuer CAs.
13+
14+ This script uses the GnuTLS certtool CLI. If you are on macOS,
15+ 'brew install gnutls', and it will be installed as 'gnutls-certtool'.
16+ Apple unfortunately ships with an incompatible /usr/bin/certtool that does
17+ different things.
18+ EOS
19+ )
20+
21+ if [ " x$1 " != ' x--regenerate' ]; then
22+ echo " ${USAGE} "
23+ exit 1
24+ fi
25+
26+ TOOL=` type -p certtool`
27+ if [ " $( uname) " = " Darwin" ]; then
28+ TOOL=` type -p gnutls-certtool`
29+ if [ ! -x " ${TOOL} " ]; then
30+ echo " Sorry, Darwin requires gnutls-certtool; try ` brew install gnutls` "
31+ exit 2
32+ fi
33+ fi
34+
35+ if [ ! -x " ${TOOL} " ]; then
36+ echo " Sorry, no certtool found!"
37+ exit 3
38+ fi
39+ export TOOL
40+
41+
42+ ${TOOL} --generate-privkey > ./cakey.pem
43+ ${TOOL} --generate-self-signed \
44+ --load-privkey ./cakey.pem \
45+ --template ./ca.info \
46+ --outfile ./cacert.pem
47+
48+ echo " cert and private key generated! Don't forget to check them in"
You can’t perform that action at this time.
0 commit comments