acmesh-official / acme.sh

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

deploy-hook synology_dsm fails because api_path is null #4817

Open sinky opened 9 months ago

sinky commented 9 months ago

Used deploy-hook synology_dsm first time with DSM 7.2-64570 Update 1` and it failed because the API response parsing with sed failed. Fixed it by replacing sed with jq.

Debug log

./acme.sh -d "my.domain.com" --deploy --deploy-hook synology_dsm --home $PWD --debug 3 --insecure
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_exists:534                    readlink exists=0
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_exists:534                    dirname exists=0
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2641                Lets find script dir.
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2642                _SCRIPT_='./acme.sh'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2644                _script='/usr/local/share/acme.sh/acme.sh'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2646                _script_home='/usr/local/share/acme.sh'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2673                Using config home:/usr/local/share/acme.sh
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2687                ACCOUNT_CONF_PATH='/usr/local/share/acme.sh/account.conf'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_process:7838                  LE_WORKING_DIR='/usr/local/share/acme.sh'
https://github.com/acmesh-official/acme.sh
v3.0.7
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_process:7846                  Running cmd: deploy
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2673                Using config home:/usr/local/share/acme.sh
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:__initHome:2687                ACCOUNT_CONF_PATH='/usr/local/share/acme.sh/account.conf'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2803                 default_acme_server
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2812                 ACME_DIRECTORY='https://acme.zerossl.com/v2/DV90'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2814                 _ACME_SERVER_HOST='acme.zerossl.com'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2817                 _ACME_SERVER_PATH='v2/DV90'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2824                 CA_CONF='/usr/local/share/acme.sh/ca/acme.zerossl.com/v2/DV90/ca.conf'
[Tue Oct  3 06:07:06 PM CEST 2023] The domain 'my.domain.com' seems to have a ECC cert already, lets use ecc cert.
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_initpath:2901                 DOMAIN_PATH='/usr/local/share/acme.sh/my.domain.com_ecc'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:deploy:5766                    DOMAIN_CONF='/usr/local/share/acme.sh/my.domain.com_ecc/my.domain.com.conf'
[Tue Oct  3 06:07:06 PM CEST 2023] ./acme.sh:_setopt:2300                   OK
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2324                   16:Le_DeployHook='synology_dsm,'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_deploy:5722                   _deployApi='/usr/local/share/acme.sh/deploy/synology_dsm.sh'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_exists:534                    synology_dsm_deploy exists=0
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:38 _cdomain='my.domain.com'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:56 SYNO_Username='certadmin'
[Tue Oct  3 06:07:07 PM CEST 2023] SYNO_Password='[hidden](please add '--output-insecure' to see this value)'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:58 SYNO_Create='1'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:59 SYNO_Device_Name
[Tue Oct  3 06:07:07 PM CEST 2023] SYNO_Device_ID='[hidden](please add '--output-insecure' to see this value)'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2300                   OK
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2324                   17:SAVED_SYNO_Scheme='https'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2300                   OK
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2324                   18:SAVED_SYNO_Hostname='my.domain.com'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2300                   OK
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_setopt:2324                   19:SAVED_SYNO_Port='443'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:75 SYNO_Scheme='https'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:76 SYNO_Hostname='my.domain.com'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:77 SYNO_Port='443'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:81 SYNO_Certificate='my.domain.com'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:90 _base_url='https://my.domain.com:443'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:92 Getting API version
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_get:2034                      GET
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_get:2038                      url='https://my.domain.com:443/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=SYNO.API.Auth'
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_get:2039                      timeout=
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_exists:534                    curl exists=0
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_exists:534                    mktemp exists=0
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_exists:534                    wget exists=0
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_get:2051                      _CURL='curl --silent --dump-header /usr/local/share/acme.sh/http.header  -L  --trace-ascii /tmp/tmp.AC3q6CSNJ2  -g  --insecure  '
[Tue Oct  3 06:07:07 PM CEST 2023] ./acme.sh:_get:2103                      ret='0'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:96 response='{"data":{"SYNO.API.Auth":{"maxVersion":7,"minVersion":1,"path":"entry.cgi"}},"success":true}'
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:97 api_path
[Tue Oct  3 06:07:07 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:98 api_version='7'
[Tue Oct  3 06:07:08 PM CEST 2023] Logging into my.domain.com:443
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_exists:534                    od exists=0
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_url_encode:678                _url_encode
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_url_encode:679                _hex_str=' 63 65 72 74 61 64 6d 69 6e'
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_exists:534                    od exists=0
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_url_encode:678                _url_encode
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_url_encode:679                _hex_str=' 73 66 68 6a 67 34 21 37 33 39 44'
[Tue Oct  3 06:07:08 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:146 1here
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_get:2034                      GET
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_get:2038                      url='https://my.domain.com:443/webapi/?api=SYNO.API.Auth&version=7&method=login&format=sid&account=certadmin&passwd=[REDACTED]&enable_syno_token=yes&device_name=&device_id=[REDACTED]'
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_get:2039                      timeout=
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_exists:534                    curl exists=0
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_exists:534                    mktemp exists=0
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_exists:534                    wget exists=0
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_get:2051                      _CURL='curl --silent --dump-header /usr/local/share/acme.sh/http.header  -L  --trace-ascii /tmp/tmp.YPK0fC6sRO  -g  --insecure  '
[Tue Oct  3 06:07:08 PM CEST 2023] ./acme.sh:_get:2103                      ret='0'
[Tue Oct  3 06:07:08 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:148 here
[Tue Oct  3 06:07:08 PM CEST 2023] deploy/synology_dsm.sh:synology_dsm_deploy:149 response='<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>body{font-family:Arial,Helvetica,sans-serif;font-size:12px;text-align:center}h1{color:#06C;font-size:25px;line-height:60px;margin-top:56px}img{margin-top:40px}
</style>
</head>
<body>
<img src="data:image/jpg;base64,/9j/4AAQS[...]
"/>
<h1 id="a"></h1>
<hr>
<p>&copy; 2023 <a href="http://www.synology.com">Synology Inc.</a></p>
</body>
<script type ="text/javascript">
/* Copyright (c) 2023 Synology Inc. All rights reserved. */

(function(){var a={en:"Sorry, the page you are looking for is not found."[...]
</script>
</html>'
github-actions[bot] commented 9 months ago

Please upgrade to the latest code and try again first. Maybe it's already fixed. acme.sh --upgrade If it's still not working, please provide the log with --debug 2, otherwise, nobody can help you.

mattjgalloway commented 9 months ago

I think this commit fixes it: https://github.com/acmesh-official/acme.sh/commit/87a7bde61813391e6c8379ae93c921bd68889c53

It's on dev, but not on master yet. And I'm awaiting a new docker image pushed with it in too.

4808 is the issue associated with that commit btw.

rsporsche commented 4 months ago

FYI @sinky Just want to let you know that the log file you posted contains your DSM username and password

sinky commented 4 months ago

FYI @sinky Just want to let you know that the log file you posted contains your DSM username and password

hey @rsporsche thanks for drawing my attention but could you specify where do you see the password? REDACTED is not the password.

rsporsche commented 4 months ago

@sinky

The password is output as a hex string. I've reported the issue but figured I'd search for any instances of _hex_str and let you know.

sinky commented 4 months ago

@rsporsche oh wow thank you acme.sh for hiding I‘ve changed the password, although the Nas is not reachable from outside. Big thanks 🙏 to @rsporsche