11{% from "vault/map.jinja" import vault with context -%}
22{% set vssc = vault .self_signed_cert -%}
3- #!/usr/bin/env bash
3+ #!/usr/bin/env sh
44
55###
66 # Check for root name.
77 ##
88root=$1
99shift
10- if [[ -z "$root" ] ]; then
10+ if [ -z "$root" ]; then
1111 echo "you must pass 2 arguments; first for root name, second for child name"
1212 exit
1313fi
1616 # Check for child name
1717 ##
1818child=$1
19- if [[ -z "$child" ] ]; then
19+ if [ -z "$child" ]; then
2020 echo "you must pass 2 arguments; first for root name ($root), second for child name"
2121 exit
2222fi
@@ -38,7 +38,7 @@ root_p12="$root.p12"
3838###
3939 # Generate the root private key
4040 ##
41- if [[ -e "$root_key" ] ]; then
41+ if [ -e "$root_key" ]; then
4242 echo "$root_key already exits"
4343else
4444 echo "generate $root_key"
4848###
4949 # Genereate the the root privacy enhanced email (PEM)
5050 ##
51- if [[ -e "$root_pem" ] ]; then
51+ if [ -e "$root_pem" ]; then
5252 echo "$root_pem already exits"
5353else
5454 echo "generate $root_pem"
5858###
5959 # Generate the root public key (P12)
6060 ##
61- if [[ -e "$root_p12" ] ]; then
61+ if [ -e "$root_p12" ]; then
6262 echo "$root_p12 already exits"
6363else
6464 echo "generate $root_p12"
@@ -80,17 +80,17 @@ child_jks="$child_name.jks"
8080###
8181 # Generate the child private key
8282 ##
83- if [[ -e "$child_key" ] ]; then
83+ if [ -e "$child_key" ]; then
8484 echo "$child_key already exits"
8585else
8686 echo "generate $child_key"
8787 openssl genrsa -aes256 -passout pass:"$pw" -out "$child_key" 4096
8888fi
8989
9090###
91- # Genereate the the child privacy enhanced email (PEM)
91+ # Generate the the child privacy enhanced email (PEM)
9292 ##
93- if [[ -e "$child_pem" ] ]; then
93+ if [ -e "$child_pem" ]; then
9494 echo "$child_pem already exits"
9595else
9696 echo "generate $child_csr"
103103###
104104 # Generate the child public key (P12)
105105 ##
106- if [[ -e "$child_p12" ] ]; then
106+ if [ -e "$child_p12" ]; then
107107 echo "$child_p12 already exits"
108108else
109109 echo "generate $child_p12"
114114###
115115 # Generate the Java Keystore (JKS)
116116 ##
117- if [[ -e "$child_jks" ] ]; then
117+ if [ -e "$child_jks" ]; then
118118 echo "$child_jks already exits"
119119else
120120 keytool="keytool"
121- if [[ -n $(command -v $keytool) ] ]; then
121+ if [ -n " $(command -v $keytool)" ]; then
122122 echo "generate $child_jks with $root trustedCertEntry"
123123 $keytool -importcert -trustcacerts -noprompt -file "$root_pem" -destkeystore "$child_jks" -storepass "$pw" \
124124 -alias "$root" -v
0 commit comments