[CA] BuyPass: Add check for CA account and request email if necessary

This commit is contained in:
Alex Thomassen 2020-11-13 15:38:43 +01:00
parent 707589c2f4
commit aaf48648b4
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
1 changed files with 13 additions and 0 deletions

View File

@ -17,6 +17,19 @@ if [[ "${CMD_PARAMS}" =~ "--buypass" ]]; then
BUYPASS=1;
fi
# BuyPass requires a valid email to be registered
# before we issue certificates.
if [[ $BUYPASS -eq 1 ]]; then
CA_DIR="${ACME_DIR}/ca/api.buypass.com";
if [[ ! -d "${CA_DIR}" ]]; then
echo "${ECHO_PREFIX} Account email for BuyPass CA (required)?"
read ACCOUNT_EMAIL
eval "${ACME} --server https://api.buypass.com/acme/directory --register-account --accountemail '${ACCOUNT_EMAIL}'"
fi
fi
# Create directory if it exists, make sure permissions are as strict as possible.
echo "${ECHO_PREFIX} Creating base certificate directory: ${BASE}"
mkdir -p $BASE