-
Notifications
You must be signed in to change notification settings - Fork 5
/
ca
executable file
·52 lines (39 loc) · 897 Bytes
/
ca
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# Generate a certificate authority.
set -o errexit
for SCRIPT in common/*.sh; do
source ${SCRIPT}
done
LIFETIME=""
FAIL="false"
while getopts ":l:" VARNAME; do
case ${VARNAME} in
l)
LIFETIME="${OPTARG}"
;;
\?)
error "Unrecognized option: -${OPTARG}"
FAIL="true"
;;
:)
error "Option -${OPTARG} requires an argument."
FAIL="true"
;;
esac
done
# Default to 365 days.
[ -z "${LIFETIME}" ] && LIFETIME="365"
# Default to 365 days.
[ -z "${LIFETIME}" ] && LIFETIME="365"
if [ "${FAIL}" = "true" ]; then
cat <<EOM
Usage: docker run [..] cloudpipe/keymaster ca [-l LIFETIME]"
Generate a private certificate authority.
(Optional)
-l LIFETIME Specify the duration for which this certificate authority should be valid, in days.
Defaults to 365.
EOM
exit 1
fi
generate_ca_certificate "${LIFETIME}"