5 umask 077 # paranoid umask, we're creating private keys
7 # Get the directory in which this script is stored
8 SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
11 # Check for script dependencies
12 check_dependencies() {
13 # just execute some dummy and/or version commands to see if required tools exist and are actually usable
14 openssl version > /dev/null 2>&1 || _exiterr "This script requires an openssl binary."
15 _sed "" < /dev/null > /dev/null 2>&1 || _exiterr "This script requires sed with support for extended (modern) regular expressions."
16 grep -V > /dev/null 2>&1 || _exiterr "This script requires grep."
17 mktemp -u -t XXXXXX > /dev/null 2>&1 || _exiterr "This script requires mktemp."
19 # curl returns with an error code in some ancient versions so we have to catch that
21 curl -V > /dev/null 2>&1
24 if [[ ! "${retcode}" = "0" ]] && [[ ! "${retcode}" = "2" ]]; then
25 _exiterr "This script requires curl."
29 # Setup default config values, search for and load configuration files
31 # Check for config in various locations
32 if [[ -z "${CONFIG:-}" ]]; then
33 for check_config in "/etc/letsencrypt.sh" "/usr/local/etc/letsencrypt.sh" "${PWD}" "${SCRIPTDIR}"; do
34 if [[ -e "${check_config}/config.sh" ]]; then
35 BASEDIR="${check_config}"
36 CONFIG="${check_config}/config.sh"
43 CA="https://acme-v01.api.letsencrypt.org/directory"
44 LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
45 CHALLENGETYPE="http-01"
48 PRIVATE_KEY="${BASEDIR}/private_key.pem"
50 WELLKNOWN="${BASEDIR}/.acme-challenges"
51 PRIVATE_KEY_RENEW="no"
52 OPENSSL_CNF="$(openssl version -d | cut -d'"' -f2)/openssl.cnf"
54 LOCKFILE="${BASEDIR}/lock"
56 if [[ -z "${CONFIG:-}" ]]; then
58 echo "# !! WARNING !! No config file found, using default config!" >&2
60 elif [[ -e "${CONFIG}" ]]; then
61 echo "# INFO: Using config file ${CONFIG}"
62 BASEDIR="$(dirname "${CONFIG}")"
63 # shellcheck disable=SC1090
66 _exiterr "Specified config file doesn't exist."
69 # Remove slash from end of BASEDIR. Mostly for cleaner outputs, doesn't change functionality.
70 BASEDIR="${BASEDIR%%/}"
72 # Check BASEDIR and set default variables
73 [[ -d "${BASEDIR}" ]] || _exiterr "BASEDIR does not exist: ${BASEDIR}"
75 [[ -n "${PARAM_HOOK:-}" ]] && HOOK="${PARAM_HOOK}"
76 [[ -n "${PARAM_CHALLENGETYPE:-}" ]] && CHALLENGETYPE="${PARAM_CHALLENGETYPE}"
78 [[ "${CHALLENGETYPE}" =~ (http-01|dns-01) ]] || _exiterr "Unknown challenge type ${CHALLENGETYPE}... can not continue."
79 if [[ "${CHALLENGETYPE}" = "dns-01" ]] && [[ -z "${HOOK}" ]]; then
80 _exiterr "Challenge type dns-01 needs a hook script for deployment... can not continue."
88 # Lockfile handling (prevents concurrent access)
89 LOCKDIR="$(dirname "${LOCKFILE}")"
90 [[ -w "${LOCKDIR}" ]] || _exiterr "Directory ${LOCKDIR} for LOCKFILE ${LOCKFILE} is not writable, aborting."
91 ( set -C; date > "${LOCKFILE}" ) 2>/dev/null || _exiterr "Lock file '${LOCKFILE}' present, aborting."
92 remove_lock() { rm -f "${LOCKFILE}"; }
93 trap 'remove_lock' EXIT
96 CA_DIRECTORY="$(http_request get "${CA}")"
97 CA_NEW_CERT="$(printf "%s" "${CA_DIRECTORY}" | get_json_string_value new-cert)" &&
98 CA_NEW_AUTHZ="$(printf "%s" "${CA_DIRECTORY}" | get_json_string_value new-authz)" &&
99 CA_NEW_REG="$(printf "%s" "${CA_DIRECTORY}" | get_json_string_value new-reg)" &&
100 # shellcheck disable=SC2015
101 CA_REVOKE_CERT="$(printf "%s" "${CA_DIRECTORY}" | get_json_string_value revoke-cert)" ||
102 _exiterr "Problem retrieving ACME/CA-URLs, check if your configured CA points to the directory entrypoint."
104 # Export some environment variables to be used in hook script
105 export WELLKNOWN BASEDIR CONFIG
107 # Checking for private key ...
108 register_new_key="no"
109 if [[ -n "${PARAM_PRIVATE_KEY:-}" ]]; then
110 # a private key was specified from the command line so use it for this run
111 echo "Using private key ${PARAM_PRIVATE_KEY} instead of account key"
112 PRIVATE_KEY="${PARAM_PRIVATE_KEY}"
114 # Check if private account key exists, if it doesn't exist yet generate a new one (rsa key)
115 if [[ ! -e "${PRIVATE_KEY}" ]]; then
116 echo "+ Generating account key..."
117 _openssl genrsa -out "${PRIVATE_KEY}" "${KEYSIZE}"
118 register_new_key="yes"
121 openssl rsa -in "${PRIVATE_KEY}" -check 2>/dev/null > /dev/null || _exiterr "Private key is not valid, can not continue."
123 # Get public components from private key and calculate thumbprint
124 pubExponent64="$(openssl rsa -in "${PRIVATE_KEY}" -noout -text | grep publicExponent | grep -oE "0x[a-f0-9]+" | cut -d'x' -f2 | hex2bin | urlbase64)"
125 pubMod64="$(openssl rsa -in "${PRIVATE_KEY}" -noout -modulus | cut -d'=' -f2 | hex2bin | urlbase64)"
127 thumbprint="$(printf '{"e":"%s","kty":"RSA","n":"%s"}' "${pubExponent64}" "${pubMod64}" | openssl sha -sha256 -binary | urlbase64)"
129 # If we generated a new private key in the step above we have to register it with the acme-server
130 if [[ "${register_new_key}" = "yes" ]]; then
131 echo "+ Registering account key with letsencrypt..."
132 [[ ! -z "${CA_NEW_REG}" ]] || _exiterr "Certificate authority doesn't allow registrations."
133 # If an email for the contact has been provided then adding it to the registration request
134 if [[ -n "${CONTACT_EMAIL}" ]]; then
135 signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "contact":["mailto:'"${CONTACT_EMAIL}"'"], "agreement": "'"$LICENSE"'"}' > /dev/null
137 signed_request "${CA_NEW_REG}" '{"resource": "new-reg", "agreement": "'"$LICENSE"'"}' > /dev/null
141 if [[ "${CHALLENGETYPE}" = "http-01" && ! -d "${WELLKNOWN}" ]]; then
142 _exiterr "WELLKNOWN directory doesn't exist, please create ${WELLKNOWN} and set appropriate permissions."
146 # Different sed version for different os types...
148 if [ "${OSTYPE}" = "Linux" ]; then
155 # Print error message and exit with error
157 echo "ERROR: ${1}" >&2
161 # Encode data as url-safe formatted base64
163 # urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_'
164 openssl base64 -e | tr -d '\n\r' | _sed -e 's:=*$::g' -e 'y:+/:-_:'
167 # Convert hex string to binary data
169 # Remove spaces, add leading zero, escape as hex string and parse with printf
170 printf -- "$(cat | _sed -e 's/[[:space:]]//g' -e 's/^(.(.{2})*)$/0\1/' -e 's/(.{2})/\\x\1/g')"
173 # Get string value from json dictionary
174 get_json_string_value() {
175 grep -Eo '"'"${1}"'":[[:space:]]*"[^"]*"' | cut -d'"' -f4
178 # OpenSSL writes to stderr/stdout even when there are no errors. So just
179 # display the output if the exit code was != 0 to simplify debugging.
182 out="$(openssl "${@}" 2>&1)"
185 if [[ $res -ne 0 ]]; then
186 echo " + ERROR: failed to run $* (Exitcode: $res)" >&2
194 # Send http(s) request with specified method
196 tempcont="$(mktemp -t XXXXXX)"
198 if [[ "${1}" = "head" ]]; then
199 statuscode="$(curl -s -w "%{http_code}" -o "${tempcont}" "${2}" -I)"
200 elif [[ "${1}" = "get" ]]; then
201 statuscode="$(curl -s -w "%{http_code}" -o "${tempcont}" "${2}")"
202 elif [[ "${1}" = "post" ]]; then
203 statuscode="$(curl -s -w "%{http_code}" -o "${tempcont}" "${2}" -d "${3}")"
205 _exiterr "Unknown request method: ${1}"
208 if [[ ! "${statuscode:0:1}" = "2" ]]; then
209 echo " + ERROR: An error occurred while sending ${1}-request to ${2} (Status ${statuscode})" >&2
212 cat "${tempcont}" >&2
215 # Wait for hook script to clean the challenge if used
216 if [[ -n "${HOOK}" ]] && [[ -n "${challenge_token:+set}" ]]; then
217 ${HOOK} "clean_challenge" '' "${challenge_token}" "${keyauth}"
220 # remove temporary domains.txt file if used
221 [[ -n "${PARAM_DOMAIN:-}" ]] && rm "${DOMAINS_TXT}"
229 # Send signed request
231 # Encode payload as urlbase64
232 payload64="$(printf '%s' "${2}" | urlbase64)"
234 # Retrieve nonce from acme-server
235 nonce="$(http_request head "${CA}" | grep Replay-Nonce: | awk -F ': ' '{print $2}' | tr -d '\n\r')"
237 # Build header with just our public key and algorithm information
238 header='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}}'
240 # Build another header which also contains the previously received nonce and encode it as urlbase64
241 protected='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}, "nonce": "'"${nonce}"'"}'
242 protected64="$(printf '%s' "${protected}" | urlbase64)"
244 # Sign header with nonce and our payload with our private key and encode signature as urlbase64
245 signed64="$(printf '%s' "${protected64}.${payload64}" | openssl dgst -sha256 -sign "${PRIVATE_KEY}" | urlbase64)"
247 # Send header + extended header + payload + signature to the acme-server
248 data='{"header": '"${header}"', "protected": "'"${protected64}"'", "payload": "'"${payload64}"'", "signature": "'"${signed64}"'"}'
250 http_request post "${1}" "${data}"
253 # Create certificate for domain(s)
257 timestamp="$(date +%s)"
259 echo " + Signing domains..."
260 if [[ -z "${CA_NEW_AUTHZ}" ]] || [[ -z "${CA_NEW_CERT}" ]]; then
261 _exiterr "Certificate authority doesn't allow certificate signing"
264 # If there is no existing certificate directory => make it
265 if [[ ! -e "${BASEDIR}/certs/${domain}" ]]; then
266 echo " + Creating new directory ${BASEDIR}/certs/${domain} ..."
267 mkdir -p "${BASEDIR}/certs/${domain}"
270 privkey="privkey.pem"
271 # generate a new private key if we need or want one
272 if [[ ! -f "${BASEDIR}/certs/${domain}/privkey.pem" ]] || [[ "${PRIVATE_KEY_RENEW}" = "yes" ]]; then
273 echo " + Generating private key..."
274 privkey="privkey-${timestamp}.pem"
275 _openssl genrsa -out "${BASEDIR}/certs/${domain}/privkey-${timestamp}.pem" "${KEYSIZE}"
278 # Generate signing request config and the actual signing request
279 echo " + Generating signing request..."
281 for altname in ${altnames}; do
282 SAN+="DNS:${altname}, "
285 local tmp_openssl_cnf
286 tmp_openssl_cnf="$(mktemp -t XXXXXX)"
287 cat "${OPENSSL_CNF}" > "${tmp_openssl_cnf}"
288 printf "[SAN]\nsubjectAltName=%s" "${SAN}" >> "${tmp_openssl_cnf}"
289 openssl req -new -sha256 -key "${BASEDIR}/certs/${domain}/${privkey}" -out "${BASEDIR}/certs/${domain}/cert-${timestamp}.csr" -subj "/CN=${domain}/" -reqexts SAN -config "${tmp_openssl_cnf}"
290 rm -f "${tmp_openssl_cnf}"
292 # Request and respond to challenges
293 for altname in ${altnames}; do
294 # Ask the acme-server for new challenge token and extract them from the resulting json block
295 echo " + Requesting challenge for ${altname}..."
296 response="$(signed_request "${CA_NEW_AUTHZ}" '{"resource": "new-authz", "identifier": {"type": "dns", "value": "'"${altname}"'"}}')"
298 challenges="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]')"
299 repl=$'\n''{' # fix syntax highlighting in Vim
300 challenge="$(printf "%s" "${challenges//\{/${repl}}" | grep \""${CHALLENGETYPE}"\")"
301 challenge_token="$(printf '%s' "${challenge}" | get_json_string_value token | _sed 's/[^A-Za-z0-9_\-]/_/g')"
302 challenge_uri="$(printf '%s' "${challenge}" | get_json_string_value uri)"
304 if [[ -z "${challenge_token}" ]] || [[ -z "${challenge_uri}" ]]; then
305 _exiterr "Can't retrieve challenges (${response})"
308 # Challenge response consists of the challenge token and the thumbprint of our public certificate
309 keyauth="${challenge_token}.${thumbprint}"
311 case "${CHALLENGETYPE}" in
313 # Store challenge response in well-known location and make world-readable (so that a webserver can access it)
314 printf '%s' "${keyauth}" > "${WELLKNOWN}/${challenge_token}"
315 chmod a+r "${WELLKNOWN}/${challenge_token}"
316 keyauth_hook="${keyauth}"
319 # Generate DNS entry content for dns-01 validation
320 keyauth_hook="$(printf '%s' "${keyauth}" | openssl sha -sha256 -binary | urlbase64)"
324 # Wait for hook script to deploy the challenge if used
325 [[ -n "${HOOK}" ]] && ${HOOK} "deploy_challenge" "${altname}" "${challenge_token}" "${keyauth_hook}"
327 # Ask the acme-server to verify our challenge and wait until it is no longer pending
328 echo " + Responding to challenge for ${altname}..."
329 result="$(signed_request "${challenge_uri}" '{"resource": "challenge", "keyAuthorization": "'"${keyauth}"'"}')"
331 status="$(printf '%s\n' "${result}" | get_json_string_value status)"
333 while [[ "${status}" = "pending" ]]; do
335 status="$(http_request get "${challenge_uri}" | get_json_string_value status)"
338 [[ "${CHALLENGETYPE}" = "http-01" ]] && rm -f "${WELLKNOWN}/${challenge_token}"
340 # Wait for hook script to clean the challenge if used
341 if [[ -n "${HOOK}" ]] && [[ -n "${challenge_token}" ]]; then
342 ${HOOK} "clean_challenge" "${altname}" "${challenge_token}" "${keyauth_hook}"
345 if [[ "${status}" = "valid" ]]; then
346 echo " + Challenge is valid!"
348 _exiterr "Challenge is invalid! (returned: ${status})"
352 # Finally request certificate from the acme-server and store it in cert-${timestamp}.pem and link from cert.pem
353 echo " + Requesting certificate..."
354 csr64="$(openssl req -in "${BASEDIR}/certs/${domain}/cert-${timestamp}.csr" -outform DER | urlbase64)"
355 crt64="$(signed_request "${CA_NEW_CERT}" '{"resource": "new-cert", "csr": "'"${csr64}"'"}' | openssl base64 -e)"
356 crt_path="${BASEDIR}/certs/${domain}/cert-${timestamp}.pem"
357 printf -- '-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n' "${crt64}" > "${crt_path}"
359 # Try to load the certificate to detect corruption
360 echo " + Checking certificate..."
361 _openssl x509 -text < "${crt_path}"
363 # Create fullchain.pem
364 echo " + Creating fullchain.pem..."
365 cat "${crt_path}" > "${BASEDIR}/certs/${domain}/fullchain-${timestamp}.pem"
366 http_request get "$(openssl x509 -in "${BASEDIR}/certs/${domain}/cert-${timestamp}.pem" -noout -text | grep 'CA Issuers - URI:' | cut -d':' -f2-)" > "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem"
367 if ! grep -q "BEGIN CERTIFICATE" "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem"; then
368 openssl x509 -in "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem" -inform DER -out "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem" -outform PEM
370 cat "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem" >> "${BASEDIR}/certs/${domain}/fullchain-${timestamp}.pem"
373 [[ "${privkey}" = "privkey.pem" ]] || ln -sf "privkey-${timestamp}.pem" "${BASEDIR}/certs/${domain}/privkey.pem"
375 ln -sf "chain-${timestamp}.pem" "${BASEDIR}/certs/${domain}/chain.pem"
376 ln -sf "fullchain-${timestamp}.pem" "${BASEDIR}/certs/${domain}/fullchain.pem"
377 ln -sf "cert-${timestamp}.csr" "${BASEDIR}/certs/${domain}/cert.csr"
378 ln -sf "cert-${timestamp}.pem" "${BASEDIR}/certs/${domain}/cert.pem"
380 # Wait for hook script to clean the challenge and to deploy cert if used
381 [[ -n "${HOOK}" ]] && ${HOOK} "deploy_cert" "${domain}" "${BASEDIR}/certs/${domain}/privkey.pem" "${BASEDIR}/certs/${domain}/cert.pem" "${BASEDIR}/certs/${domain}/fullchain.pem"
383 unset challenge_token
388 # Description: Sign/renew non-existant/changed/expiring certificates.
389 command_sign_domains() {
392 if [[ -n "${PARAM_DOMAIN:-}" ]]; then
393 DOMAINS_TXT="$(mktemp -t XXXXXX)"
394 printf -- "${PARAM_DOMAIN}" > "${DOMAINS_TXT}"
395 elif [[ -e "${BASEDIR}/domains.txt" ]]; then
396 DOMAINS_TXT="${BASEDIR}/domains.txt"
398 _exiterr "domains.txt not found and --domain not given"
401 # Generate certificates for all domains found in domains.txt. Check if existing certificate are about to expire
402 <"${DOMAINS_TXT}" _sed -e 's/^[[:space:]]*//g' -e 's/[[:space:]]*$//g' -e 's/[[:space:]]+/ /g' | (grep -vE '^(#|$)' || true) | while read -r line; do
403 domain="$(printf '%s\n' "${line}" | cut -d' ' -f1)"
404 morenames="$(printf '%s\n' "${line}" | cut -s -d' ' -f2-)"
405 cert="${BASEDIR}/certs/${domain}/cert.pem"
407 force_renew="${PARAM_FORCE:-no}"
409 if [[ -z "${morenames}" ]];then
410 echo "Processing ${domain}"
412 echo "Processing ${domain} with alternative names: ${morenames}"
415 if [[ -e "${cert}" ]]; then
416 printf " + Checking domain name(s) of existing cert..."
418 certnames="$(openssl x509 -in "${cert}" -text -noout | grep DNS: | _sed 's/DNS://g' | tr -d ' ' | tr ',' '\n' | sort -u | tr '\n' ' ' | _sed 's/ $//')"
419 givennames="$(echo "${domain}" "${morenames}"| tr ' ' '\n' | sort -u | tr '\n' ' ' | _sed 's/ $//' | _sed 's/^ //')"
421 if [[ "${certnames}" = "${givennames}" ]]; then
425 echo " + Domain name(s) are not matching!"
426 echo " + Names in old certificate: ${certnames}"
427 echo " + Configured names: ${givennames}"
428 echo " + Forcing renew."
433 if [[ -e "${cert}" ]]; then
434 echo " + Checking expire date of existing cert..."
435 valid="$(openssl x509 -enddate -noout -in "${cert}" | cut -d= -f2- )"
437 printf " + Valid till %s " "${valid}"
438 if openssl x509 -checkend $((RENEW_DAYS * 86400)) -noout -in "${cert}"; then
439 printf "(Longer than %d days). " "${RENEW_DAYS}"
440 if [[ "${force_renew}" = "yes" ]]; then
441 echo "Ignoring because renew was forced!"
447 echo "(Less than ${RENEW_DAYS} days). Renewing!"
451 # shellcheck disable=SC2086
455 # remove temporary domains.txt file if used
456 [[ -n "${PARAM_DOMAIN:-}" ]] && rm -f "${DOMAINS_TXT}"
461 # Usage: --revoke (-r) path/to/cert.pem
462 # Description: Revoke specified certificate
466 [[ -n "${CA_REVOKE_CERT}" ]] || _exiterr "Certificate authority doesn't allow certificate revocation."
469 if [[ -L "${cert}" ]]; then
470 # follow symlink and use real certificate name (so we move the real file and not the symlink at the end)
472 link_target="$(readlink -n "${cert}")"
473 if [[ "${link_target}" =~ ^/ ]]; then
474 cert="${link_target}"
476 cert="$(dirname "${cert}")/${link_target}"
479 [[ -f "${cert}" ]] || _exiterr "Could not find certificate ${cert}"
481 echo "Revoking ${cert}"
483 cert64="$(openssl x509 -in "${cert}" -inform PEM -outform DER | urlbase64)"
484 response="$(signed_request "${CA_REVOKE_CERT}" '{"resource": "revoke-cert", "certificate": "'"${cert64}"'"}')"
485 # if there is a problem with our revoke request _request (via signed_request) will report this and "exit 1" out
486 # so if we are here, it is safe to assume the request was successful
488 echo " + Renaming certificate to ${cert}-revoked"
489 mv -f "${cert}" "${cert}-revoked"
493 # Description: Show help text
495 printf "Usage: %s [-h] [command [argument]] [parameter [argument]] [parameter [argument]] ...\n\n" "${0}"
496 printf "Default command: help\n\n"
498 grep -e '^[[:space:]]*# Usage:' -e '^[[:space:]]*# Description:' -e '^command_.*()[[:space:]]*{' "${0}" | while read -r usage; read -r description; read -r command; do
499 if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]] || [[ ! "${command}" =~ ^command_ ]]; then
500 _exiterr "Error generating help text."
502 printf " %-32s %s\n" "${usage##"# Usage: "}" "${description##"# Description: "}"
504 printf -- "\nParameters:\n"
505 grep -E -e '^[[:space:]]*# PARAM_Usage:' -e '^[[:space:]]*# PARAM_Description:' "${0}" | while read -r usage; read -r description; do
506 if [[ ! "${usage}" =~ Usage ]] || [[ ! "${description}" =~ Description ]]; then
507 _exiterr "Error generating help text."
509 printf " %-32s %s\n" "${usage##"# PARAM_Usage: "}" "${description##"# PARAM_Description: "}"
514 # Description: Output configuration variables for use in other scripts
516 echo "# letsencrypt.sh configuration"
518 typeset -p CA LICENSE CHALLENGETYPE HOOK RENEW_DAYS PRIVATE_KEY KEYSIZE WELLKNOWN PRIVATE_KEY_RENEW OPENSSL_CNF CONTACT_EMAIL LOCKFILE
521 # Main method (parses script arguments and calls command_* methods)
527 [[ -z "${COMMAND}" ]] || _exiterr "Only one command can be executed at a time. See help (-h) for more information."
532 if [[ -z "${1:-}" ]]; then
533 echo "The specified command requires additional parameters. See help:" >&2
537 elif [[ "${1:0:1}" = "-" ]]; then
538 _exiterr "Invalid argument: ${1}"
542 [[ -z "${@}" ]] && eval set -- "--help"
544 while (( "${#}" )); do
556 set_command sign_domains
562 check_parameters "${1:-}"
563 PARAM_REVOKECERT="${1}"
566 # PARAM_Usage: --domain (-d) domain.tld
567 # PARAM_Description: Use specified domain name(s) instead of domains.txt entry (one certificate!)
570 check_parameters "${1:-}"
571 if [[ -z "${PARAM_DOMAIN:-}" ]]; then
574 PARAM_DOMAIN="${PARAM_DOMAIN} ${1}"
579 # PARAM_Usage: --force (-x)
580 # PARAM_Description: Force renew of certificate even if it is longer valid than value in RENEW_DAYS
585 # PARAM_Usage: --privkey (-p) path/to/key.pem
586 # PARAM_Description: Use specified private key instead of account key (useful for revocation)
589 check_parameters "${1:-}"
590 PARAM_PRIVATE_KEY="${1}"
593 # PARAM_Usage: --config (-f) path/to/config.sh
594 # PARAM_Description: Use specified config file
597 check_parameters "${1:-}"
601 # PARAM_Usage: --hook (-k) path/to/hook.sh
602 # PARAM_Description: Use specified script for hooks
605 check_parameters "${1:-}"
609 # PARAM_Usage: --challenge (-t) http-01|dns-01
610 # PARAM_Description: Which challenge should be used? Currently http-01 and dns-01 are supported
613 check_parameters "${1:-}"
614 PARAM_CHALLENGETYPE="${1}"
618 echo "Unknown parameter detected: ${1}" >&2
630 sign_domains) command_sign_domains;;
631 revoke) command_revoke "${PARAM_REVOKECERT}";;
632 *) command_help; exit 1;;
636 # Check for missing dependencies