@@ -20,6 +20,9 @@ function obtain_or_renew_certificate {
20
20
local acme_url=" ${5} "
21
21
local mail=" ${6} "
22
22
local letsencrypt_ssh_port=" ${7} "
23
+ local eab=" ${8} "
24
+ local hmac=" ${9} "
25
+ local key_id=" ${10} "
23
26
24
27
certificate_domain_opts=$( echo ${certificate_fqdns} | sed -r -e ' s/^/,/g' -e ' s/,/--domains=/g' -e ' s/--/ --/g' )
25
28
certificate_fqdn=$( echo ${certificate_fqdns} | awk -F ' ,' ' {print $1}' )
@@ -54,6 +57,10 @@ function obtain_or_renew_certificate {
54
57
55
58
[ ! -e " /etc/letsencrypt/lego/${certificate_type} /certificates/${certificate_fqdn} .pem" ] && local lego_action=" run" || local lego_action=" renew"
56
59
60
+ if [ ${eab} ]; then
61
+ eab_opts=" --eab --hmac ${hmac} --kid ${key_id} "
62
+ fi
63
+
57
64
log_info " [${certificate_fqdn} - cron] Obtaining certificate for domains ${certificate_fqdns} ."
58
65
mapfile -t cmd_output < <( /opt/lego --email=" ${mail} " \
59
66
${certificate_domain_opts} \
@@ -64,6 +71,7 @@ function obtain_or_renew_certificate {
64
71
--cert.timeout ${valid_days} \
65
72
--accept-tos \
66
73
--http \
74
+ ${eab_opts} \
67
75
--pem ${lego_action} \
68
76
--${lego_action} -hook=" /usr/bin/sync-and-update-certificate --${certificate_type} --fqdn ${certificate_fqdn} --haproxies-ssh ${letsencrypt_ssh_port} " 2>&1 )
69
77
@@ -98,10 +106,11 @@ function obtain_or_renew_certificate {
98
106
99
107
INTERNAL_SET=" false"
100
108
EXTERNAL_SET=" false"
109
+ EXTERNAL_ACCOUNT_BINDING=" false"
101
110
LOG_FILE=" /var/log/kolla/letsencrypt/lesencrypt-lego.log"
102
111
103
112
104
- VALID_ARGS=$( getopt -o ief:p:d:m:a:v:h: --long internal,external,fqdns:,port:,days:,mail:,acme:,vips:,haproxies-ssh: -- " $@ " )
113
+ VALID_ARGS=$( getopt -o ief:p:d:m:a:v:h: --long internal,external,fqdns:,port:,days:,mail:,acme:,vips:,haproxies-ssh:,eab,kid:,hmac: -- " $@ " )
105
114
if [[ $? -ne 0 ]]; then
106
115
exit 1;
107
116
fi
@@ -147,6 +156,18 @@ while [ : ]; do
147
156
LETSENCRYPT_SSH_PORT=" ${2} "
148
157
shift 2
149
158
;;
159
+ --eab)
160
+ EXTERNAL_ACCOUNT_BINDING=" true"
161
+ shift
162
+ ;;
163
+ --hmac)
164
+ HMAC=" ${2} "
165
+ shift 2
166
+ ;;
167
+ --kid)
168
+ KEY_ID=" ${2} "
169
+ shift 2
170
+ ;;
150
171
--) shift ;
151
172
break
152
173
;;
@@ -170,17 +191,22 @@ if [ "${INTERNAL_SET}" = "true" ] || [ "${EXTERNAL_SET}" = "true" ]; then
170
191
LETSENCRYPT_EXTERNAL_FQDNS=" ${FQDNS} "
171
192
fi
172
193
194
+ if [ " ${EXTERNAL_ACCOUNT_BINDING} " = " true" ]; then
195
+ EXTERNAL_ACCOUNT_BINDING_OPTS=" --eab ${HMAC} ${KEY_ID} "
196
+ else
197
+ EXTERNAL_ACCOUNT_BINDING_OPTS=" "
198
+ fi
173
199
174
200
if /usr/sbin/ip a | egrep -q " ${LETSENCRYPT_VIP_ADDRESSES} " ; then
175
201
log_info " [${FQDN} - cron] This Letsencrypt-lego host is active..."
176
202
if [ " ${LETSENCRYPT_INTERNAL_FQDNS} " != " " ]; then
177
203
log_info " [${FQDN} - cron] Processing domains ${LETSENCRYPT_INTERNAL_FQDNS} "
178
- obtain_or_renew_certificate ${LETSENCRYPT_INTERNAL_FQDNS} internal ${PORT} ${DAYS} ${ACME} ${MAIL} ${LETSENCRYPT_SSH_PORT}
204
+ obtain_or_renew_certificate ${LETSENCRYPT_INTERNAL_FQDNS} internal ${PORT} ${DAYS} ${ACME} ${MAIL} ${LETSENCRYPT_SSH_PORT} ${EXTERNAL_ACCOUNT_BINDING_OPTS}
179
205
fi
180
206
181
207
if [ " ${LETSENCRYPT_EXTERNAL_FQDNS} " != " " ]; then
182
208
log_info " [${FQDN} - cron] Processing domains ${LETSENCRYPT_EXTERNAL_FQDNS} "
183
- obtain_or_renew_certificate ${LETSENCRYPT_EXTERNAL_FQDNS} external ${PORT} ${DAYS} ${ACME} ${MAIL} ${LETSENCRYPT_SSH_PORT}
209
+ obtain_or_renew_certificate ${LETSENCRYPT_EXTERNAL_FQDNS} external ${PORT} ${DAYS} ${ACME} ${MAIL} ${LETSENCRYPT_SSH_PORT} ${EXTERNAL_ACCOUNT_BINDING_OPTS}
184
210
fi
185
211
else
186
212
log_info " [${FQDN} - cron] This Letsencrypt-lego host is passive, nothing to do..."
0 commit comments