blob: ad10240b948b0724865ae188c030b01e3a149dc5 [file] [log] [blame]
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +02001#!/bin/bash
2
3waitForEjbcaToStart() {
4 until $(curl -kI https://localhost:8443/ejbca/publicweb/healthcheck/ejbcahealth --output /dev/null --silent --head --fail)
5 do
6 sleep 5
7 done
8}
9
10configureEjbca() {
11 ejbca.sh config cmp addalias --alias cmpRA
12 ejbca.sh config cmp updatealias --alias cmpRA --key operationmode --value ra
13 ejbca.sh ca editca --caname ManagementCA --field cmpRaAuthSecret --value ${RA_IAK}
14 ejbca.sh config cmp updatealias --alias cmpRA --key responseprotection --value pbe
Remigiusz Janeczeked6e6212020-09-08 13:00:50 +020015 #Custom EJBCA cert profile and endentity are imported to allow issuing certificates with correct extended usage (containing serverAuth)
16 ejbca.sh ca importprofiles -d /opt/primekey/custom_profiles
17 #Profile name taken from certprofile filename (certprofile_<profile-name>-<id>.xml)
18 ejbca.sh config cmp updatealias --alias cmpRA --key ra.certificateprofile --value CUSTOM_ENDUSER
19 #ID taken from entityprofile filename (entityprofile_<profile-name>-<id>.xml)
20 ejbca.sh config cmp updatealias --alias cmpRA --key ra.endentityprofileid --value 1356531849
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020021 ejbca.sh config cmp dumpalias --alias cmpRA
22 ejbca.sh config cmp addalias --alias cmp
23 ejbca.sh config cmp updatealias --alias cmp --key allowautomatickeyupdate --value true
24 ejbca.sh config cmp updatealias --alias cmp --key responseprotection --value pbe
25 ejbca.sh ra addendentity --username Node123 --dn "CN=Node123" --caname ManagementCA --password ${CLIENT_IAK} --type 1 --token USERGENERATED
26 ejbca.sh ra setclearpwd --username Node123 --password ${CLIENT_IAK}
27 ejbca.sh config cmp updatealias --alias cmp --key extractusernamecomponent --value CN
28 ejbca.sh config cmp dumpalias --alias cmp
29 ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem
30}
31
32
33waitForEjbcaToStart
34configureEjbca