Open Snousmoumryk opened 4 years ago
can you please provide log with --debug 2
?
can you please provide log with
--debug 2
?
Here is acme.sh.log.zip Attached log file starts when previous cron job skipped renew task.
Web server is based on the XigmaNAS project software (FreeBSD embedded).
@Neilpang
I did additional tests in Let's Encrypt staging environment.
Original acme.sh
and its two modified versions were run under three different conditions.
Modifications
acme.sh
1st line #!/bin/bash -x
acme.sh
1st line #!/bin/sh
Conditions
su -m acme -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme'
>file
)
su -m acme -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme' > /mnt/dsk/services/acme/debug-acme.log
>file 2>&1
)
su -m acme -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme' > /mnt/dsk/services/acme/debug-acme.log 2>&1
Test results | orig | xtrace | bash->sh | |
---|---|---|---|---|
no redirection | SIGPIPE error | Not executed | No error | |
>file |
No error, but cert in file |
Not executed, empty file |
No error, but cert in file |
|
>file 2>&1 |
No error, but cert in file |
No error, but cert in file |
No error, but cert in file |
Assumptions
It looks as if acme.sh
has an error with the output file descriptors at some point. And SIGPIPE
error appears for the bash
interpreter only, while for native FreeBSD sh
this error does not exist.
@Snousmoumryk
Thanks for your report.
I will take a look soon.
@Neilpang
I did some more tests to further investigate acme.sh
strange behavior in XigmaNAS custom FreeBSD kernel environment. This time I used /dev/null
redirection and two options for calling acme.sh
using su
and sudo
.
Conditions
su
and redirect acme.sh
su -m acme -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme > /dev/null'
su
and redirect su
su -m acme -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme' > /dev/null
sudo
and redirect acme.sh
sudo -u acme sh -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme > /dev/null'
sudo
and redirect sudo
sudo -u acme sh -c '/mnt/dsk/services/acme/acme.sh --cron --test --home /mnt/dsk/services/acme' > /dev/null
Test results | su | sudo | |
---|---|---|---|
no redirection | SIGPIPE error | SIGPIPE error | |
acme.sh > |
No error | No error | |
su/sudo > |
No error | No error |
Notes Additional info about test conditions specific to XigmaNAS FreeBSD instance.
cron
.acme.sh
runs in CLI.cron
restart in CLI and call via cron
.cron
restart in XigmaNAS webUI and call via cron
.@Neilpang After some discussion with XigmaNAS development team, it turns out the root cause of the issue is as follows.
acme.sh
script outputs some data (cert content) to STDOUT, which is not expected with --cron
command line option.cron
tries to send any of STDOUT and STDERR acme.sh
output via mail
, except it's redirected.mail
utility, invoked by cron
, dies while script is still running, which causes broken pipe (SIGPIPE) error.A solid workaround is to redirect acme.sh
script output to >/dev/null 2>&1
.
It seems this issue is specific to XigmaNAS system only, otherwise there would be numerous issue reports in different use cases.
Steps to reproduce
Webroot mode, multiple domains
Command line in script which is called via cron
Debug log
Log file tail
Actually certificates are renewed and could be deployed with no errors. All files in
/<...>/acme/example.tld/
directory have their modification date updated (excludingexample.tld.key
).But variables in
example.tld.conf
fileare not updated and contain old numbers.
How to eliminate SIGPIPE signal during
acme.sh
execution and get variables updated?