acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
38.54k stars 4.9k forks source link

$Le_Domain not availbe for reloadcmd when using firstime --issue #982

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi Neil, thank you for the great piece of shell code.

When issueing the first time a domain with the "--reloadcmd" switch, the Le_Domain isn't exported / empty. If running acme.sh with ex: the "renew" switch all is working fine.

acme.sh --issue -d example.com --reloadcmd 'myscript.sh'

content of 'myscript.sh'

#!/usr/bin/env sh
cat ${CERT_FULLCHAIN_PATH} ${CERT_KEY_PATH} > ${Le_Domain}_haproxy.cer
echo ${CERT_FULLCHAIN_PATH}
echo ${CERT_KEY_PATH}
echo ${Le_Domain}_haproxy.cer

Would be nice -if possible- to know the $Le_Domain or another varaible with the same content on the first "--issue" run.

Neilpang commented 7 years ago

Le_Domain is already exported as env variable. https://github.com/Neilpang/acme.sh/blob/master/acme.sh#L4409

ghost commented 7 years ago

Yes thats true. It works fine on a renew but if i use it like this: acme.sh --issue -d example.com --reload-cmd 'myscript.sh' and in myscript.sh is an echo $Le_Domain this will be empty while running the above command.

Takios commented 7 years ago

Affects me, too.

First time with acme.sh --issue -d example.com --post-hook 'touch /tmp/bla_${Le_Domain}' you'll get /tmp/bla_. If you then do acme.sh --renew --force -d example.com, you'll get /tmp/bla_example.com.

DrChai commented 5 years ago

I guess just ignore this error since your reload command is already invoked or manually export Le_Domain when you directly execute installcert() or issue() with --reloadcmd option