fix: pull down crt, key and pem in one operation

This commit is contained in:
Ruben Solvang 2025-05-07 14:29:55 +02:00
parent 5edef1fe64
commit 5c706ba5d4

View file

@ -89,7 +89,6 @@ download_and_verify_cert() {
local temp_key="$TEMP_DIR/$domain.key"
local temp_pem="$TEMP_DIR/$domain.pem"
echo -e "${BLUE}Processing certificate for $domain${NC}"
# Download certificate
@ -178,14 +177,14 @@ install_certificate() {
return 1
fi
local files=("$final_pem")
else
if ! cp -f "$temp_cert" "$final_cert" || ! cp -f "$temp_key" "$final_key"; then
echo -e "${RED}Failed to install certificate files for $domain${NC}"
return 1
fi
local files=("$final_cert" "$final_key")
fi
if ! cp -f "$temp_cert" "$final_cert" || ! cp -f "$temp_key" "$final_key"; then
echo -e "${RED}Failed to install certificate files for $domain${NC}"
return 1
fi
local files=("$final_cert" "$final_key")
# Set permissions and ownership
for file in "${files[@]}"; do
if ! chown "$CERT_OWNER:$CERT_GROUP" "$file" || \