Closed Itsme1609 closed 2 years ago
Here the output of an attempt
[/opt/letsencrypt/qnap-letsencrypt] # ./renew_certificate.sh BusyBox v1.01 (2022.06.22-22:54+0000) multi-call binary
Usage: readlink
Displays the value of a symbolic link.
Checking whether to renew certificate on Tue, 16 Aug 2022 12:31:06 +0200
Renewing certificate...
qnap-letsencrypt version: 240d04a
Using python path: /share/MD0_DATA/.qpkg/Python3/python3/bin/python3
Stopping Qthttpd hogging port 80..
Shutting down Qthttpd services: OK.
Started python HTTP server with pid 9189
Serving v4 only
Parsing account key...
Parsing CSR...
Found domains: DNSXXXX..de
Getting directory...
Directory found!
Registering account...
Registered! Account ID: https://acme-v02.api.letsencrypt.org/acme/acct/681100887
Creating new order...
Order created!
Verifying DNSXXXX..de...
Traceback (most recent call last):
File "acme-tiny/acme_tiny.py", line 145, in get_crt
assert (disable_check or _do_request(wellknown_url)[0] == keyauthorization)
File "acme-tiny/acme_tiny.py", line 46, in _do_request
raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: {4}".format(err_msg, url, data, code, resp_data))
ValueError: Error:
Url: http://DNSXXXX..de/.well-known/acme-challenge/ZGCf3TzYGuitCg4UHUGiV9FQkOcpFyNkkTnTM48MqSk
Data: None
Response Code: None
Response:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "acme-tiny/acme_tiny.py", line 199, in
The problem is pretty clear from the log:
ValueError: Wrote file to tmp-webroot/.well-known/acme-challenge/ZGCf3TzYGuitCg4UHUGiV9FQkOcpFyNkkTnTM48MqSk, but couldn't download http://dnsxxxx..de/.well-known/acme-challenge/ZGCf3TzYGuitCg4UHUGiV9FQkOcpFyNkkTnTM48MqSk: Error:
Your NAS is not reachable on port 80 from the internet.
But I can access it over my DNS on port 80. it is the redirected to port 8080...
@Itsme1609 It needs to be port 80, not 8080.
at first: thanks for the quick reply :-)
So I will have to put in here port 80 ?
no, you don't need to change anything on your nas. simply fix the port-forwarding in your router.
you should use https (port 443) to access your nas from the internet anyway..
At the moment I have there port 8080 In my Router port 80 is already forwarded to the nas. I only have ipv6. Could this also be a problem
As long as port 80 of your nas is reachable via your DNSXXX.de domain on port 80 from the internet, ipv6 is not a problem.
I will have to check why even when I try to access the port 80 it redirects me to port 8080. I´ll check this in this evening due to the reason that i have an appointment right now. I´ll give you feedback.
When I understand you right in your opinion Python 3.5.0.2 should be ok
I found the setting to set up port 80. The nas is reachable on port 80. But I still got an error. Here the log output: BusyBox v1.01 (2022.06.22-22:54+0000) multi-call binary
Usage: readlink
Displays the value of a symbolic link.
Checking whether to renew certificate on Tue, 16 Aug 2022 18:30:51 +0200 Renewing certificate... qnap-letsencrypt version: 240d04a Using python path: /share/MD0_DATA/.qpkg/Python3/python3/bin/python3 Stopping Qthttpd hogging port 80.. Shutting down Qthttpd services: OK. Started python HTTP server with pid 31197 Serving v4 only Traceback (most recent call last): File "../HTTPServer.py", line 10, in main serve() File "../HTTPServer.py", line 20, in serve server = HTTPServerV6(('::', 80), SimpleHTTPRequestHandler) File "/share/MD0_DATA/.qpkg/Python3/python3/lib/python3.5/socketserver.py", line 443, in init self.server_bind() File "/share/MD0_DATA/.qpkg/Python3/python3/lib/python3.5/http/server.py", line 138, in server_bind socketserver.TCPServer.server_bind(self) File "/share/MD0_DATA/.qpkg/Python3/python3/lib/python3.5/socketserver.py", line 457, in server_bind self.socket.bind(self.server_address) OSError: getsockaddrarg: bad family
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "../HTTPServer.py", line 28, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "acme-tiny/acme_tiny.py", line 199, in
Any idea ?
Hi Yannik,
I don´t know if you read my message when the topics is marked as closed but I checked with telnet if port 80 is reachable over my domain .
Result port 80 is open.
One thing suprised me. After the command "mv /etc/stunnel/stunnel.pem /etc/stunnel/stunnel.pem.orig" the port was closed.
Is that normal ? I assume not. I renamed the file to the original and the port was open again...
But at the end getting a working certificate failed again....
Do you have any idea why????
here the log:
BusyBox v1.01 (2022.06.22-22:54+0000) multi-call binary
Usage: readlink
Displays the value of a symbolic link.
Checking whether to renew certificate on Wed, 17 Aug 2022 12:15:09 +0200
Renewing certificate...
qnap-letsencrypt version: 240d04a
Using python path: /share/MD0_DATA/.qpkg/Python3/python3/bin/python3
Stopping Qthttpd hogging port 80..
Shutting down Qthttpd services: OK.
Started python HTTP server with pid 29500
Serving v4 only
Parsing account key...
Parsing CSR...
Found domains: MyDomain.de
Getting directory...
Directory found!
Registering account...
Registered! Account ID: https://acme-v02.api.letsencrypt.org/acme/acct/682774807
Creating new order...
Order created!
Verifying MyDomain.de...
Traceback (most recent call last):
File "acme-tiny/acme_tiny.py", line 145, in get_crt
assert (disable_check or _do_request(wellknown_url)[0] == keyauthorization)
File "acme-tiny/acme_tiny.py", line 46, in _do_request
raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: { 4}".format(err_msg, url, data, code, resp_data))
ValueError: Error:
Url: http://MyDomain.de/.well-known/acme-challenge/1FCMdqdqgiL7DVULeM_I 6xIgglTFjQMCxg9BALZfT9Y
Data: None
Response Code: None
Response:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "acme-tiny/acme_tiny.py", line 199, in
acme-tiny tries to download the challenge itself before requesting the certificate.
As your domain is ipv6 only, your nas needs to have working ipv6 to perform this check.
I can see the line Serving v4 only
in the log, which suggests there is some issue with ipv6 on your nas.
to be honest i tried a lot maybe not everything....
The nas is accessible via ipv6 from the internet. With telnet I tested that the port 80 is open (command telnet mydomain.de 80) My DNS Hoster only works with my ipv6 address due to the reason that I have a fibre optic connection with dual stack which supports no external ipv4. The settings in the nas and the router - I assume - should be correct as I can access the nas over mydomain.de
Is there a possibility to force connection via ipv6 ?
Which error occurs when running this python script?
import socket, errno
from http.server import SimpleHTTPRequestHandler,HTTPServer
class HTTPServerV6(HTTPServer):
address_family = socket.AF_INET6
def main():
server = HTTPServerV6(('::', 664), SimpleHTTPRequestHandler)
server.serve_forever()
if __name__ == '__main__':
main()
here is the output:
python, not bash...
sorry I´m not so familiar with linux. the script has to be executed from which folder/path ? The path were phyton is installed ?
copied the script in an file and named it script1.py made it executable (chmod 0755) started it from the terminal with "python script1.py"
Didn´t work....I´m lost. Do you have a workaround for me.
[/opt/letsencrypt/qnap-letsencrypt] # python script1.py
Traceback (most recent call last):
File "script1.py", line 1, in
Run the python detection from renew.sh
in bash:
if python3 -c "import http.server" 2> /dev/null; then
PYTHON=python3
elif "$(/sbin/getcfg QPython3 Install_Path -f /etc/config/qpkg.conf)/bin/python3" -c "import http.server" 2> /dev/null; then
PYTHON="$(/sbin/getcfg QPython3 Install_Path -f /etc/config/qpkg.conf)/bin/python3"
elif "$(/sbin/getcfg Python3 Install_Path -f /etc/config/qpkg.conf)/python3/bin/python3" -c "import http.server" 2> /dev/null; then
PYTHON="$(/sbin/getcfg Python3 Install_Path -f /etc/config/qpkg.conf)/python3/bin/python3"
elif "$(/sbin/getcfg Entware Install_Path -f /etc/config/qpkg.conf)/bin/python3" -c "import http.server" 2> /dev/null; then
PYTHON="$(/sbin/getcfg Entware Install_Path -f /etc/config/qpkg.conf)/bin/python3"
else
echo "Error: You need to install the python 3.5 qpkg!"
exit 1
fi
Then do $PYTHON script1.py
duplicated file renew_certificate.sh deleted everything rather the python detection script shown in your message. stored as renew_certificate1.sh. and executed prompted without error. I assume that python is installed correct as there is no error message. then executed as you deschribed $PYTHON script1.py but did´nt work tried ./script1.py followed by the shown outcome.
Sorry for wasting your time with these basic questions but it´s the first time that I deal with python or even the terminal in this kind of way
You need to execute the code I posted in the terminal, because otherwise the $PYTHON
variable only gets set in the sub-shell execution context of renew_certificate1.sh
, but not in your terminal.
this way ?
Yup
It looks like you have an old python 3.5 qpkg installed. I suggest you uninstall that and try the same commands again.
it is the latest release in the Qnap app store for my server.
I tried to download release 3.8.6.0, but the installation failed. Repo of qnapclub don´t offers any version for me.
any idea ?
First, you should uninstall the python 3.5 from qnap store.
What exactly is the problem with installing frmo qnapclub? Did you try using entware instead?
Python is uninstalled.
You mean this entware ?
Use this guide: https://github.com/Entware/entware/wiki/Install-on-QNAP-NAS
I personally do not trust qnapclub because the source to their packages is not public. For entware this is the case.
the problem installing was that after a few minutes of installlation the system shows an error with a message that the app is incompatible. I tried this one "QPython3_3.8.6.0_x86_64.qpkg"
I will follow your instructions.
Entware from your link is installed. Should I try to install "QPython3_3.8.6.0_x86_64.qpkg" again ?
No. Use opkg on the commandline to install python
opkg install python3
or something like that
incredible...worked...
[/share/MD0_DATA/Download] # opkg install python3 Installing python3 (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3_3.10.5-1_x86-2.6.ipk Installing zlib (1.2.12-1) to root... Downloading http://bin.entware.net/x86-k2.6/zlib_1.2.12-1_x86-2.6.ipk Installing libpython3 (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/libpython3_3.10.5-1_x86-2.6.ipk Installing python3-base (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-base_3.10.5-1_x86-2.6.ipk Installing libffi (3.4.2-2) to root... Downloading http://bin.entware.net/x86-k2.6/libffi_3.4.2-2_x86-2.6.ipk Installing libbz2 (1.0.8-1a) to root... Downloading http://bin.entware.net/x86-k2.6/libbz2_1.0.8-1a_x86-2.6.ipk Installing libtirpc (1.3.2-1) to root... Downloading http://bin.entware.net/x86-k2.6/libtirpc_1.3.2-1_x86-2.6.ipk Installing python3-light (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-light_3.10.5-1_x86-2.6.ipk Installing python3-asyncio (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-asyncio_3.10.5-1_x86-2.6.ipk Installing python3-email (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-email_3.10.5-1_x86-2.6.ipk Installing python3-cgi (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-cgi_3.10.5-1_x86-2.6.ipk Installing python3-pydoc (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-pydoc_3.10.5-1_x86-2.6.ipk Installing python3-cgitb (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-cgitb_3.10.5-1_x86-2.6.ipk Installing python3-codecs (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-codecs_3.10.5-1_x86-2.6.ipk Installing python3-ctypes (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-ctypes_3.10.5-1_x86-2.6.ipk Installing libgdbm (1.21-1) to root... Downloading http://bin.entware.net/x86-k2.6/libgdbm_1.21-1_x86-2.6.ipk Installing python3-dbm (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-dbm_3.10.5-1_x86-2.6.ipk Installing python3-decimal (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-decimal_3.10.5-1_x86-2.6.ipk Installing python3-distutils (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-distutils_3.10.5-1_x86-2.6.ipk Installing python3-logging (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-logging_3.10.5-1_x86-2.6.ipk Installing liblzma (5.2.5-3) to root... Downloading http://bin.entware.net/x86-k2.6/liblzma_5.2.5-3_x86-2.6.ipk Installing python3-lzma (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-lzma_3.10.5-1_x86-2.6.ipk Installing python3-multiprocessing (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-multiprocessing_3.10.5-1_x86-2.6.ipk Installing libncursesw (6.3-1a) to root... Downloading http://bin.entware.net/x86-k2.6/libncursesw_6.3-1a_x86-2.6.ipk Installing python3-ncurses (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-ncurses_3.10.5-1_x86-2.6.ipk Installing libopenssl (1.1.1q-1) to root... Downloading http://bin.entware.net/x86-k2.6/libopenssl_1.1.1q-1_x86-2.6.ipk Installing ca-certificates (20211016-1) to root... Downloading http://bin.entware.net/x86-k2.6/ca-certificates_20211016-1_all.ipk Installing python3-openssl (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-openssl_3.10.5-1_x86-2.6.ipk Installing libreadline (8.1-1) to root... Downloading http://bin.entware.net/x86-k2.6/libreadline_8.1-1_x86-2.6.ipk Installing python3-readline (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-readline_3.10.5-1_x86-2.6.ipk Installing libsqlite3 (3370000-1) to root... Downloading http://bin.entware.net/x86-k2.6/libsqlite3_3370000-1_x86-2.6.ipk Installing python3-sqlite3 (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-sqlite3_3.10.5-1_x86-2.6.ipk Installing python3-unittest (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-unittest_3.10.5-1_x86-2.6.ipk Installing python3-urllib (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-urllib_3.10.5-1_x86-2.6.ipk Installing libuuid (2.38-2) to root... Downloading http://bin.entware.net/x86-k2.6/libuuid_2.38-2_x86-2.6.ipk Installing python3-uuid (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-uuid_3.10.5-1_x86-2.6.ipk Installing libexpat (2.4.7-2) to root... Downloading http://bin.entware.net/x86-k2.6/libexpat_2.4.7-2_x86-2.6.ipk Installing python3-xml (3.10.5-1) to root... Downloading http://bin.entware.net/x86-k2.6/python3-xml_3.10.5-1_x86-2.6.ipk Configuring zlib. Configuring libpython3. Configuring python3-base. Configuring libffi. Configuring libbz2. Configuring libtirpc. Configuring python3-light. Configuring python3-email. Configuring python3-urllib. Configuring python3-pydoc. Configuring liblzma. Configuring python3-cgi. Configuring python3-cgitb. Configuring python3-decimal. Configuring libuuid. Configuring python3-uuid. Configuring libexpat. Configuring python3-xml. Configuring libncursesw. Configuring python3-ncurses. Configuring python3-distutils. Configuring python3-codecs. Configuring python3-multiprocessing. Configuring libreadline. Configuring python3-asyncio. Configuring python3-ctypes. Configuring libgdbm. Configuring python3-dbm. Configuring python3-logging. Configuring python3-lzma. Configuring libopenssl. Configuring ca-certificates. Configuring python3-openssl. Configuring python3-readline. Configuring libsqlite3. Configuring python3-sqlite3. Configuring python3-unittest. Configuring python3.
Thats all ?
Did it install release 3.10 ?
It appears not in the apps list on the Qnap Gui
Yes, that's all. Try the commands from earlier again.
seams like frozen....since 2 min.
is it nessessary to restart the nas after the installation of QPython3 ?
Just press CTRL-C
This looks good
Now try the renew_certificates.sh
script again.
after CTR-C
Will do the workarount for letsencrypt again. I think with deleting and installing Entware the letsencrypt folder was deleted...
it works! Great workaround with you teaching someone who has only little knowledge with programming.
BusyBox v1.01 (2022.06.22-22:54+0000) multi-call binary
Usage: readlink
Displays the value of a symbolic link.
Checking whether to renew certificate on Wed, 17 Aug 2022 21:21:02 +0200 Renewing certificate... qnap-letsencrypt version: 240d04a Using python path: python3 Stopping Qthttpd hogging port 80.. Shutting down Qthttpd services: OK. Started python HTTP server with pid 25345 Parsing account key... Parsing CSR... Found domains: myDomain.de Getting directory... Directory found! Registering account... Registered! Account ID: https://acme-v02.api.letsencrypt.org/acme/acct/683342737 Creating new order... Order created! Verifying myDomain.de... 2a00:6020:b03d::::: - - [17/Aug/2022 21:21:24] "GET /.well-known/acme-challenge/FylMgR9NO-MXRew4bZJ7lUWZ1G6UxlRmTUYPd07Fmzg HTTP/1.1" 200 - 2a05:d014:3ad::::: - - [17/Aug/2022 21:21:26] "GET /.well-known/acme-challenge/FylMgR9NO-MXRew4bZJ7lUWZ1G6UxlRmTUYPd07Fmzg HTTP/1.1" 200 - 2600:1f14:804::::: - - [17/Aug/2022 21:21:26] "GET /.well-known/acme-challenge/FylMgR9NO-MXRew4bZJ7lUWZ1G6UxlRmTUYPd07Fmzg HTTP/1.1" 200 - 2600:3000:1511:::- - [17/Aug/2022 21:21:26] "GET /.well-known/acme-challenge/FylMgR9NO-MXRew4bZJ7lUWZ1G6UxlRmTUYPd07Fmzg HTTP/1.1" 200 - 2600:1f16:269::::: - - [17/Aug/2022 21:21:27] "GET /.well-known/acme-challenge/FylMgR9NO-MXRew4bZJ7lUWZ1G6UxlRmTUYPd07Fmzg HTTP/1.1" 200 - myDomain.de verified! Signing certificate... Certificate signed! Downloading intermediate certificate... 2022-08-17 21:21:36 URL:https://letsencrypt.org/certs/lets-encrypt-r3.pem [1826/1826] -> "-" [1] Stopping stunnel and setting new stunnel certificates... Shutting down apache proxy: OK Restarting FTP Shutting down FTP services: .OK Starting FTP services: OK Done! Service startup and cleanup will follow now... ./renew_certificate.sh: line 11: 25345 Killed "$PYTHON" ../HTTPServer.py (wd: /opt/letsencrypt/qnap-letsencrypt/tmp-webroot) Start apache proxy: OK Starting Qthttpd services: OK
Thank you for your patience !
spent you a coffee 🥇
You are welcome, and thanks for the donation!
Good Morning Yannik,
With your support, we have managed to get the certificates up and running. Unfortunately, an error seems to have occurred in the meantime. In the log of the renew_certificate I get the following error message
Start apache proxy: OK Starting Qthttpd services: OK Checking whether to renew certificate on Wed, 16 Aug 2023 03:30:01 +0200 Renewing certificate... /share/MD0_DATA/.qpkg/Entware/letsencrypt/qnap-letsencrypt/renew_certificate.sh: line 40: git: command not found qnap-letsencrypt version: Using python path: /share/MD0_DATA/.qpkg/Entware/bin/python3 Stopping Qthttpd hogging port 80.. Shutting down Qthttpd services: OK. xargs: invalid option -- I BusyBox v1.01 (2022.06.22-22:54+0000) multi-call binary
Usage: xargs [COMMAND] [OPTIONS] [ARGS...]
Executes COMMAND on every item given by standard input.
Options: -r Do not run command for empty readed lines -x Exit if the size is exceeded -0 Input filenames are terminated by a null character -t Print the command line on stderr before executing it.
An error occured. Restoring system state. Start apache proxy: OK Starting Qthttpd services: OK
Do you have any idea what could be the reason ?
Hi Yannik, is solved. I installed everything again....
Platform/Firmware Information
QNAP TS-239 Pro II Firmware: 4.2.6 (latest Update)