| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | # dehydrated-tools-extra |
| 4 | # Copyright (C) 2014-2026 Daniel Baumann <[email protected]> |
| 5 | # |
| 6 | # SPDX-License-Identifier: GPL-3.0+ |
| 7 | # |
| 8 | # This program is free software: you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation, either version 3 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | |
| 21 | set -e |
| 22 | |
| 23 | HOOKS="/etc/dehydrated/hook.dscip-shell filesystem . . `/etc/dehydrated/hook.d`." |
| 24 | |
| 25 | deploy_challengescip-shell shell dehydrated-tools-extra 20260506-1 deploy_challenge(). () |
| 26 | { |
| 27 | export DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" |
| 28 | |
| 29 | run-partsscip-shell system . . run-parts. --regex '^deploy_challenge.*' "${HOOKS}" |
| 30 | } |
| 31 | |
| 32 | clean_challengescip-shell shell dehydrated-tools-extra 20260506-1 clean_challenge(). () |
| 33 | { |
| 34 | export DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}" |
| 35 | |
| 36 | run-partsscip-shell system . . run-parts. --regex '^clean_challenge.*' "${HOOKS}" |
| 37 | } |
| 38 | |
| 39 | sync_certscip-shell shell dehydrated-tools-extra 20260506-1 sync_cert(). () |
| 40 | { |
| 41 | export KEYFILE="${1}" CERTFILE="${2}" FULLCHAINFILE="${3}" CHAINFILE="${4}" REQUESTFILE="${5}" |
| 42 | |
| 43 | run-partsscip-shell system . . run-parts. --regex '^sync_cert.*' "${HOOKS}" |
| 44 | } |
| 45 | |
| 46 | deploy_certscip-shell shell dehydrated-tools-extra 20260506-1 deploy_cert(). () |
| 47 | { |
| 48 | export DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}" |
| 49 | |
| 50 | run-partsscip-shell system . . run-parts. --regex '^deploy_cert.*' "${HOOKS}" |
| 51 | } |
| 52 | |
| 53 | deploy_ocspscip-shell shell dehydrated-tools-extra 20260506-1 deploy_ocsp(). () |
| 54 | { |
| 55 | export DOMAIN="${1}" OCSPFILE="${2}" TIMESTAMP="${3}" |
| 56 | |
| 57 | run-partsscip-shell system . . run-parts. --regex '^deploy_ocsp.*' "${HOOKS}" |
| 58 | } |
| 59 | |
| 60 | unchanged_certscip-shell shell dehydrated-tools-extra 20260506-1 unchanged_cert(). () |
| 61 | { |
| 62 | export DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" |
| 63 | |
| 64 | run-partsscip-shell system . . run-parts. --regex '^unchanged_cert.*' "${HOOKS}" |
| 65 | } |
| 66 | |
| 67 | invalid_challengescip-shell shell dehydrated-tools-extra 20260506-1 invalid_challenge(). () |
| 68 | { |
| 69 | export DOMAIN="${1}" RESPONSE="${2}" |
| 70 | |
| 71 | run-partsscip-shell system . . run-parts. --regex '^invalid_challenge.*' "${HOOKS}" |
| 72 | } |
| 73 | |
| 74 | request_failurescip-shell shell dehydrated-tools-extra 20260506-1 request_failure(). () |
| 75 | { |
| 76 | export STATUSCODE="${1}" REASON="${2}" REQTYPE="${3}" HEADERS="${4}" |
| 77 | |
| 78 | run-partsscip-shell system . . run-parts. --regex '^request_failure.*' "${HOOKS}" |
| 79 | } |
| 80 | |
| 81 | generate_csrscip-shell shell dehydrated-tools-extra 20260506-1 generate_csr(). () |
| 82 | { |
| 83 | export DOMAIN="${1}" CERTDIR="${2}" ALTNAMES="${3}" |
| 84 | |
| 85 | run-partsscip-shell system . . run-parts. --regex '^generate_csr.*' "${HOOKS}" |
| 86 | } |
| 87 | |
| 88 | startup_hookscip-shell shell dehydrated-tools-extra 20260506-1 startup_hook(). () |
| 89 | { |
| 90 | run-partsscip-shell system . . run-parts. --regex '^startup_hook.*' "${HOOKS}" |
| 91 | } |
| 92 | |
| 93 | exit_hookscip-shell shell dehydrated-tools-extra 20260506-1 exit_hook(). () |
| 94 | { |
| 95 | export ERROR="${1:-}" |
| 96 | |
| 97 | run-partsscip-shell system . . run-parts. --regex '^exit_hook.*' "${HOOKS}" |
| 98 | } |
| 99 | |
| 100 | HANDLER="${1}" |
| 101 | |
| 102 | if [scip-shell system . . `[`. -z "${HANDLER}" ] |
| 103 | then |
| 104 | echoscip-shell system . . echo. "Usage: ${0} HANDLER" >&2 |
| 105 | exit 1 |
| 106 | fi |
| 107 | |
| 108 | shift |
| 109 | |
| 110 | case "${HANDLER}" in |
| 111 | deploy_challenge|clean_challenge|sync_cert|deploy_cert|deploy_ocsp|unchanged_cert|invalid_challenge|request_failure|generate_csr|startup_hook|exit_hook) |
| 112 | "${HANDLER}" "${@}" |
| 113 | ;; |
| 114 | esac |