File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,7 +95,15 @@ function request() {
9595 application=$1
9696 cn=$2
9797 ttl=$3
98- openssl req -new -newkey rsa:2048 -nodes -keyout ${application} .priv.pem -out ${application} .csr -subj " /CN=${cn} " 2> /dev/null
98+ # Beam only supports multiple certificates per proxy when they share one key.
99+ # devsetup enrolls some proxies repeatedly to create duplicate certs, so reuse
100+ # an existing key on re-enrollment and generate a fresh one only the first time;
101+ # otherwise senders may encrypt to a key the proxy no longer holds.
102+ if [ -s " ${application} .priv.pem" ] && openssl pkey -in " ${application} .priv.pem" -noout 2> /dev/null; then
103+ openssl req -new -key " ${application} .priv.pem" -out ${application} .csr -subj " /CN=${cn} " 2> /dev/null
104+ else
105+ openssl req -new -newkey rsa:2048 -nodes -keyout ${application} .priv.pem -out ${application} .csr -subj " /CN=${cn} " 2> /dev/null
106+ fi
99107 data=$( jq -Rs ' {common_name: "' $cn ' ", ttl: "' $ttl ' ", csr: .}' < ${application} .csr)
100108 echo " Creating Certificate for domain $cn "
101109 curl --header " X-Vault-Token: $VAULT_TOKEN " \
You can’t perform that action at this time.
0 commit comments