+ iname="example_ec.$tld"
+ idir=$iname
+
+####
+ # create CAs & server certs
+ rm -fr "$idir"
+
+ # create CA cert + templates
+ clica $V -D "$idir" -p password -B 1024 -I -N $iname -F \
+ -k ec -q nistp521 \
+ -C http://crl.example.$tld/latest.crl -O http://oscp.example.$tld/
+
+ # create server certs
+ # -m <months>
+ clica $V -D $idir -p password -s 2101 -S server1.$iname -m 301 \
+ -k ec -q nistp521 \
+ -8 server1.example.$tld,alternatename.server1.example.$tld,alternatename2.server1.example.$tld,*.test.ex
+
+####
+
+ # openssl seems to generate a file (ca_chain.pam) in an order it
+ # cannot then use (the key applies to the first cert in the file?).
+ # Generate a shuffled one.
+ cd $idir/server1.$iname
+ openssl pkcs12 -in server1.$iname.p12 -passin file:pwdfile -cacerts -out cacerts.pem -nokeys
+ cat server1.$iname.pem cacerts.pem > fullchain.pem
+ rm cacerts.pem
+ cd ../..
+
+####
+
+ # generate unlocked keys and client cert bundles
+ for server in server1