Sylvain Desbureaux | d1ca1ee | 2020-04-07 14:52:20 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | waitForEjbcaToStart() { |
| 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 | |
| 10 | configureEjbca() { |
| 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 |
| 15 | ejbca.sh config cmp dumpalias --alias cmpRA |
| 16 | ejbca.sh config cmp addalias --alias cmp |
| 17 | ejbca.sh config cmp updatealias --alias cmp --key allowautomatickeyupdate --value true |
| 18 | ejbca.sh config cmp updatealias --alias cmp --key responseprotection --value pbe |
| 19 | ejbca.sh ra addendentity --username Node123 --dn "CN=Node123" --caname ManagementCA --password ${CLIENT_IAK} --type 1 --token USERGENERATED |
| 20 | ejbca.sh ra setclearpwd --username Node123 --password ${CLIENT_IAK} |
| 21 | ejbca.sh config cmp updatealias --alias cmp --key extractusernamecomponent --value CN |
| 22 | ejbca.sh config cmp dumpalias --alias cmp |
| 23 | ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem |
| 24 | } |
| 25 | |
| 26 | |
| 27 | waitForEjbcaToStart |
| 28 | configureEjbca |