]> TLD Linux GIT Repositories - packages/dehydrated.git/blob - hook.custom_functions
- make hooks.sh and system functions non-configs so they always get
[packages/dehydrated.git] / hook.custom_functions
1 #!/bin/bash
2
3 # This file contains global custom functions for your dehydrated hook scripts.
4 # Feel free to edit it, but do not delete predefined custom functions for
5 # handling dehydrated actions. They are referenced in hooks.sh.
6
7 custom_deploy_challenge() {
8     # This hook is called once for every domain that needs to be
9     # validated, including any alternative names you may have listed.
10     #
11     # Parameters:
12     # - DOMAIN
13     #   The domain name (CN or subject alternative name) being
14     #   validated.
15     # - TOKEN_FILENAME
16     #   The name of the file containing the token to be served for HTTP
17     #   validation. Should be served by your web server as
18     #   /.well-known/acme-challenge/${TOKEN_FILENAME}.
19     # - TOKEN_VALUE
20     #   The token value that needs to be served for validation. For DNS
21     #   validation, this is what you want to put in the _acme-challenge
22     #   TXT record. For HTTP validation it is the value that is expected
23     #   be found in the $TOKEN_FILENAME file.
24     local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
25 }
26
27 custom_clean_challenge() {
28     # This hook is called after attempting to validate each domain,
29     # whether or not validation was successful. Here you can delete
30     # files or DNS records that are no longer needed.
31     #
32     # The parameters are the same as for deploy_challenge.
33     local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
34 }
35
36 custom_deploy_cert() {
37     local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}"
38     # This hook is called once for each certificate that has been
39     # produced. Here you might, for instance, copy your new certificates
40     # to service-specific locations and reload the service.
41     #
42     # Parameters:
43     # - DOMAIN
44     #   The primary domain name, i.e. the certificate common
45     #   name (CN).
46     # - KEYFILE
47     #   The path of the file containing the private key.
48     # - CERTFILE
49     #   The path of the file containing the signed certificate.
50     # - FULLCHAINFILE
51     #   The path of the file containing the full certificate chain.
52     # - CHAINFILE
53     #   The path of the file containing the intermediate certificate(s).
54     # - TIMESTAMP
55     #   Timestamp when the specified certificate was created.
56     local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}" TIMESTAMP="${6}"
57 }
58
59 custom_unchanged_cert() {
60     # This hook is called once for each certificate that is still
61     # valid and therefore wasn't reissued.
62     #
63     # Parameters:
64     # - DOMAIN
65     #   The primary domain name, i.e. the certificate common
66     #   name (CN).
67     # - KEYFILE
68     #   The path of the file containing the private key.
69     # - CERTFILE
70     #   The path of the file containing the signed certificate.
71     # - FULLCHAINFILE
72     #   The path of the file containing the full certificate chain.
73     # - CHAINFILE
74     #   The path of the file containing the intermediate certificate(s).
75     local DOMAIN="${1}" KEYFILE="${2}" CERTFILE="${3}" FULLCHAINFILE="${4}" CHAINFILE="${5}"
76 }
77
78 custom_invalid_challenge() {
79     # This hook is called if the challenge response has failed, so domain
80     # owners can be aware and act accordingly.
81     #
82     # Parameters:
83     # - DOMAIN
84     #   The primary domain name, i.e. the certificate common
85     #   name (CN).
86     # - RESPONSE
87     #   The response that the verification server returned
88     local DOMAIN="${1}" RESPONSE="${2}"
89 }
90
91 custom_request_failure() {
92     # This hook is called when an HTTP request fails (e.g., when the ACME
93     # server is busy, returns an error, etc). It will be called upon any
94     # response code that does not start with '2'. Useful to alert admins
95     # about problems with requests.
96     #
97     # Parameters:
98     # - STATUSCODE
99     #   The HTML status code that originated the error.
100     # - REASON
101     #   The specified reason for the error.
102     # - REQTYPE
103     #   The kind of request that was made (GET, POST...)
104     local STATUSCODE="${1}" REASON="${2}" REQTYPE="${3}"
105 }
106
107 custom_startup_hook() {
108   # This hook is called before the cron command to do some initial tasks
109   # (e.g. starting a webserver).
110   :
111 }
112
113 custom_exit_hook() {
114   # This hook is called at the end of the cron command and can be used to
115   # do some final (cleanup or other) tasks.
116   :
117 }