-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report bugs for Synology DSM deploy hook #2727
Comments
@tresni thank's for your work! This doesn't support automatically renewing the cert, does it? |
@lippertmarkus If you mean will the Synology automatically renew the certs, no. However, renewed certificates will be updated on the synology. If you want to do renewals on your synology, I do this using a cronjob. Control Panel -> Task Scheduler -> Create -> Scheduled Task -> User-defined Script. Under General, set User to root. Under Schedule, set a schedule you feel is appropriate (I do monthly.) Under Task Settings, put the following in the Run Command box (assuming you installed to /usr/local/share/acme.sh/acme.sh --cron --home /usr/local/share/acme.sh/ |
@tresni Thanks for the quick response. I do basically the same, see https://github.com/lippertmarkus/synology-le-dns-auto-renew When I saw that you use the web API in your deployment hook, I wondered if we could use the this API also for the renewing process? |
This does both issuance and renewal. No weird directory handling, it just uses the API for everything. Maybe an example is better then trying to explain :)
|
@tresni sorry for hijacking this issue for discussing. Please tell me if you want to discuss elsewhere :) While implementing #2782 I found that there is a binary which allows executing API requests without requiring authentication:
Maybe this could be used to implement a second way for importing the certificates? This wouldn't require any access information, so no scheme, host, port, username, password or device id environment variables. On the other hand this can only be used with a locally installed version of I just briefly looked into that but couldn't figure out how to prepare a request for sending the binary certificate data with this method, but I think it should work somehow. |
This module is designed where it can be run from any system, not just the Synology device itself, in line with what I believe acme.sh is attempting to accomplish. So using the WebApi allows for that, using the binary would not. Definitely a good find though! |
Nice work with the hook, much cleaner than looping over folders and certs. 👍 🙂 I was trying it today, but I ran into two separate issues: Password Changing the password to an alphanumeric one fixed the issue, as the script proceeded further. Certificate upload In short, uploading fails (after quite some time) and the response has an error code of 119. I'd welcome any suggestions here... 🤔 (EDIT: trying to upload the same files through the DSM Web UI works perfectly) DSM: 6.2.2-24922 Update 4
|
Actually, according to the manual, Wget does not currently support multipart/form-data for transmitting POST data... 😖 I tried this again using cURL and it works. So I guess the options are either doing the upload in a way that works with Wget, or bail out with a message if that's not possible and Wget is being used. |
Exit code 4 is a network error which I don't think is related to the form data itself. Also, the documentation for wget is just saying that it cannot create multipart uploads itself. We construct the payload ourself and send it as data, I don't think this has any impact on wget, but I'll double check. |
I'm using default cURL for transferring the certificates, but receiving error code 119 too. As the default synology certificate is not verified, I first got cURL error 60 with the combination of "SSL certificate problem: unable to get local issuer certificate". After resolving this problem with setting Apart from that after not getting any further, I tried importing the certificates with a different reload script which was linked here, but this broke my DSM certificate system completely (no certificates were shown and even after regenerating the nginx certificate folder all the services which use the certificates are gone and I am not able to restore them). So I will now restore the DSM system to factory settings to see if that somehow helps getting rid of the 119er. Device: DS216j Error 119 debug log using cURL (cleared of private data):
|
I've fixed the URL encoding issue for passwords, I'll open a PR for that shortly. I have confirmed there appears to be an issue using wget. Comparing differences between wget and curl now. |
@JoJota and @tatablack both of your issues should be fixed by #2935 . Thank you for the reports. @JoJota I'm not entirely sure but I believe this is actually the same issue that is causing wget to fail all the time. |
The Synology DSM deploy hook feature is broken - on master and dev branches. The script does not detect or read exported SYNO_Create variable/data. Only when it is added to the synology_dsm.sh script are you able to progress up to the deployment function which after authentication and reading of cert data fails to add and apply the Let's Encrypt cert.
Note: xxx.xxxxxxx.xxx replaces actual cert domain There's also the issue of the missing sudo command which is not mentioned in the wiki - https://github.com/acmesh-official/acme.sh/wiki/Synology-NAS-Guide No issues to report with the issuance of Let's Encrypt certs, acme.sh itself or other exported variables ie. CERT_DOMAIN |
@atam1 Please give some additional information. Are you attempting to run this on Synology NAS device or from a remote computer? If on a Synology NAS, what device and what version of DSM? I've just tested from my personal machine to a virtualized DS3615xs running DSM 6.1.7 with no issues (only the domain has been changed.) With latest dev:
With master:
Additionally, the hook does not use sudo, so I'm not sure what you mean by "missing sudo command" at all. |
I just tested master on the same virtual machine (DS3615sx running DSM 6.1.7) and had no issues:
|
@tresni Hi Brian. Yes, I am connected to the synology box via ssh from my computer (mac pro). On sudo - if I run the command without sudo:
The same goes for script installation. Once you execute 'sudo -i' and after entering password you are logged in as root. I did not try to install the script under an administrator account as 'sudo -i' was used in the instructions. As for SYNO_Create, I just tried executing the same command line you used but with sudo and after exporting SYNO_Unsername, SYNO_Password, CERT_DOMAIN, SYNO_Certificate and the result:
acme.sh created and installed the cert and its files to /root/.acme.sh/xxx.xxxxxxx.xxx_ecc/ Also, another issue I had with the master branch was SYNO_Scheme, SYNO_Hostname, SYNO_Port were not being picked up by the deployment script so I manually saved them in /root/.acme.sh/xxx.xxxxxxx.xxx_ecc/xxx.xxxxxxx.xxx.conf ... haven't tested dev yet. |
A shell started with
The command is incorrect. By doing If you are going to use sudo, the appropriate command would be Just an additional note that I've update the Synology NAS guide to give steps that work with no workarounds necessary. Please let me know if you have problems after following the steps exactly as outlined there. |
@tresni Alright. I'm going to start fresh and install after executing Appreciate your help! Thanks |
@tresni Hello again Brian. I gave this another try and had followed the updated wiki. While acme.sh can now be executed without sudo and the deployment script is detecting/reading the data for SYNO_xxxxxx, it's still complaining and failing when deploying the cert to DSM.
What else can be causing this? Thank you! |
Adding debug output:
Tested with synology_dsm.sh from both master and dev branches |
What Synology device are you using? What version of DSM are you using? I can't find error code 5529 defined. The surrounding defined errors that I could find are:
I've been able to successfully deploy an ECC certificate as follows (DS3615sx and DSM 6.1.7):
With the information you've provided, I can't replicate what you are seeing. |
918+ with DSM 6.2.3 rel 25426 (latest release)
Could the form fields/options have changed between versions as it is failing when uploading the new cert? The error code 5529 is very near to the error codes you posted so I am guessing it has something to do with the cert or its fields. |
Unfortunately I am not home to test with my DSM running latest and having trouble getting xpenology to run DSM 6.2 or later on VirtualBox.
You could check the synoSDSjslib/sds.js file to see if it contains the the string '5529' similar to the ones I posted. Should be available at http://[synology_host]:[synology_port]/synoSDSjslib/sds.js . |
I checked and it's 5529:_T("certificate","not_support_ecc") How does it not support ecc when with the previous acme/synology method (prior to the dsm deployhook) I was able to create and install ec-256 and ec-384 certs. |
I can't answer that as I don't work for Synology. That's a response from their API. Can you add the certificates manually via the DSM webui? I was able to get something setup to access my DS1515+ at home, it's running DSM 6.2.2 and supports ECC certificates. So either it's something new in 6.2.3 or something specific to the DS918. Reviewing the DS918+ Release Notes, the closest I see is "Added support for Let's Encrypt wildcard certificates for Synology DDNS." |
@LordDarkneo Thank you for your help. The IP 172.17.0.1 is private and internal to the NAS (docker). It can't be resolve in a browser. Replacing the IP by the NAS IP can be resolved but does not provide relevant info: {"data":{"SYNO.API.Auth":{"maxVersion":7,"minVersion":1,"path":"entry.cgi"}},"success":true} Cache-Control: max-age=0, no-cache, no-store, must-revalidate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8 @scruel I have search all over the NAS with WinSCP in root. Can't locate any log related to the deployment except those already given. My certs are valid till 22/05 for the 220+ and beginning of july for the 718+ so I have little time left. I am quite busy these days but I should be able to provide more information later on. At the moment : |
@Mic13710 in fact in does. It confirms that the query has been sent properly and that login should be made through entry.cgi. Now we still need to find which version is used dfor the authentication (i'd say the 7 but not sure...)did you try to set a value in the Syno Token and execute the script to see how it goes (just add a variable in the flat file). |
@LordDarkneo I have tried to add values for Session ID and SynoToken in ndd.conf like this:
Without any result. Still empty in the log. Values are those from the previous successful deployment. |
Just fill syno token, not session id.
If logs do not refresh, there's probably a problem elsewhere ....
Le sam. 27 avr. 2024, 03:41, Mic13710 ***@***.***> a écrit :
… @LordDarkneo <https://github.com/LordDarkneo> I have tried to add values
for Session ID and SynoToken in ndd.conf like this:
SAVED_SYNO_Session_ID='27_e3kXp9lHXGnNhIXmeqdTS33P5aa8LHZBt6581WwYx-VrBtWYRDJ2u0FFPSVFm80KYN0qu_Jci0eHsXglE8U'
SAVED_SYNO_SynoToken='yU5LMGVAgdCro'
Without any result. Still empty in the log. Values are those from the
previous successful deployment.
Maybe I should force the values somewhere else or differently but I have
no idea where and how.
—
Reply to this email directly, view it on GitHub
<#2727 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJXSJIRFBAHBX6YJ3H7RCKTY7NJCRAVCNFSM4KSAYNYKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGA2DAMRXGI2A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Well, what can do more, can do less. |
Hello @scruel , @LordDarkneo , |
synology webapi 6.1 don't support auth api, soo, when call first api to get token, only return $sid, error exit. may be use scp is sample method |
DSM 6.x is officially EOL at Synology, hence no support from this script either. |
Hi, Do we have any idea why a SAVED_SYNO_LOCAL_HOSTNAME='1' would be replaced with the domain that is stored in SAVED_SYNO_HOSTNAME='hostname' after a successful deployment? Is it not enough to edit the domain/domain.conf and set it to 1, but actively export SYNO_LOCAL_HOSTNAME='1' before the next successful domain certificate renewal? (to keep it set to 1 permanently) So, instead of the task of running just '/path/.acme.sh/acme.sh --cron --home /path/.acme.sh' I would need to prepend a 'export SYNO_LOCAL_HOSTNAME=1' in the script? Or would it be better (or best practice) to create a custom script (maybe even per domain) to export/unset variables, renew, deploy, and so forth with explicit acme.sh commands instead of the generic built-in cron job? |
I thought there's no cron on Synology's box?! 🤔 |
Yeah, there still isn't, but invoking the command via DSM scheduler does the job also. The temp admin creation, deletion itself works (I did not check for safety checks, e.g. That 2FA is enabled again, but working so far). |
I think its an issue, and I may have some time to check it soon, before I do, can u provide a step-by-step instruction which can reproduce it? This can really save me some time, thanks. |
Not sure which detail would be missing. Installed acme.sh within For this i just run Since i probably did get the documentation wrong i formerly had edited I now edited the config again to read |
Hi, I think this may be the right thread for the issue I'm having with deploying certificates in acme.sh. I can get a certificate with no issue but deploying it is where I run into the error "Unable to find certificate: mydomain.tld and is not set". I upgraded acme.sh and was considering reinstalling it but I am not sure if that will really do anything to help this situation. I'm bad with shell commands and not sure how to export the certificate files off of the Synology, otherwise I would feel comfortable with deleting all of them and starting over. I also copied the certificate from the folder where they were created (/usr/local/share/acme.sh/mydomain.tld) into the working directory of (/usr/local/share/acme.sh) just in case it couldn't 'find' the files for some reason. Steps to reproduce Debug log If anyone could point me in the right direction I'd really appreciate it. I was able to renew certificates on all of my other Synologies except this specific one. Today, I am going to delete the acme.sh directories and start over to see if that helps. Thanks. |
mydomain.tld is not set as description for any existing certificate or SYNO_CREATE is not set to 1? |
我的在dsm6.2.3中使用docker运行acme.sh证书申请成功了。便是最后一步 部署时总是报错,错误提示如下: |
Try to use a private RSA-key and not ECC. https://kb.synology.com/en-nz/DSM/help/DSM/AdminCenter/connection_certificate?version=6 |
Thank you very, very much. This incident has been bothering me for several days, and the result is due to an issue with the ECC certificate. Adding -- keylength 2048 really succeeded. Thanks again |
你好,目前证书是添加进去了,但是我看了下日志,重启http服务失败了,想请问下是哪里的问题吗 |
No other certificates have the description of mydomain.tld and SYNO_CREATE is set to 1. I tried it again and unfortunately I am still getting the "Unable to find certificate: and is not set" error Thanks. |
Can you try SYNO_LOCAL_HOSTNAME set to 1? Maybe deploy with --insecure? Also there might be something Not sure if that is an issue when you run the certificate issue with explicitly setting the letsencrypt server and the deploy without. Since I am directly setting my config to letsencrypt when installing acme.sh I have no clue if there could be any issue with directory structure or something. Which DSM are you running? |
Setting SYNO_LOCAL_HOSTNAME to 1 worked, I was able to deploy the certificate and no longer receive the "Unable to find certificate: and is not set" error. I set this on both synology_dsm.sh files in the directories /root/acme.sh-master/deploy and /usr/local/share/acme.sh/deploy Certificate was successfully deployed and is now in use: You were so helpful and I am glad that I learned something new. I will update my other thread and include this as a solution. Many thanks! |
我看到你的日志也是 Restart HTTP services failed. 证书更替换了,但是http服务没有重启,你的新证书可以正常使用吗 |
Yes, usually it works normally. |
还有一个问题。使用acme.sh部署成功了。发证人:R11,但是在使用时报错了VERIFY ERROR: depth=1, error=unable to get local issuer certificate: C=US, O=Let's Encrypt, CN=R11 |
Got this error (because I forgot to set SYNO_CREATE variable): |
ash-4.4# cd /usr/local/share/acme.sh |
Is that the end of the log or is there more afterwards? |
Recently, I've been attempting to synchronize SSL certificates and keys from the router to Synology, and stumbled upon this project. After reviewing and modifying the code, I encountered an issue with the response Through experimentation, I identified the following patterns:
Therefore, the proper sequence should be: Subsequently, I received a successful response. I hope to help people who are facing the same problem. |
Please report bugs for the Synology DSM hook here. Remember to include debug logs
The text was updated successfully, but these errors were encountered: