Yannik / qnap-letsencrypt

Let's Encrypt on QNAP
318 stars 59 forks source link

ValueError - ordinal not in range(128) #70

Closed gsegatori closed 4 years ago

gsegatori commented 4 years ago

Platform/Firmware Information

Platform = X86_APOLLOLAKE
DISPLAY_NAME = TS-653B
Model = TS-X53B
Internal Model = TS-X53B
Version = 4.4.1
Build Number = 20200214
Rsync Model = QNAP
Build Date = 2020-02-14

Is this the latest firmware for your device? YES Issue Summary (provide relevant error messages and log output): Checking whether to renew certificate on Tue, 03 Mar 2020 20:53:45 +0100 Renewing certificate... Stopping Qthttpd hogging port 80.. Shutting down Qthttpd services: OK. Killing old python processes hogging port 80 Started python HTTP server with pid 16389 Traceback (most recent call last): File "../HTTPServer.py", line 8, in <module> from http.server import SimpleHTTPRequestHandler,HTTPServer ImportError: No module named http.server Parsing account key... Parsing CSR... Found domains: mydomain.private.com Getting directory... Directory found! Registering account... Already registered! Creating new order... Order created! Verifying mydomain.private.com... Traceback (most recent call last): File "acme-tiny/acme_tiny.py", line 198, in <module> main(sys.argv[1:]) File "acme-tiny/acme_tiny.py", line 194, in main signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER, CA=args.ca, disable_check=args.disable_check, directory_url=args.directory_url, contact=args.contact) File "acme-tiny/acme_tiny.py", line 143, in get_crt raise ValueError("Wrote file to {0}, but couldn't download {1}: {2}".format(wellknown_path, wellknown_url, e)) ValueError: Wrote file to tmp-webroot/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8, but couldn't download http://mydomain.private.com/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8: 'ascii' codec can't encode characters in position 2602-2603: ordinal not in range(128) An error occured. Restoring system state. ./renew_certificate.sh: line 8: kill: (16389) - No such process

Yannik commented 4 years ago

Seems like the very first error is No module named http.server. Which python package do you have installed?

gsegatori commented 4 years ago

I installed the 2...changing to the 3 (with entware I got another error): `Checking whether to renew certificate on Tue, 03 Mar 2020 21:50:30 +0100 Renewing certificate... Stopping Qthttpd hogging port 80.. Shutting down Qthttpd services: OK. Killing old python processes hogging port 80 Started python HTTP server with pid 13381 Traceback (most recent call last): File "../HTTPServer.py", line 36, in main() File "../HTTPServer.py", line 16, in main servev6() File "../HTTPServer.py", line 23, in servev6 server = HTTPServerV6(('::', 80), SimpleHTTPRequestHandler) File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/socketserver.py", line 441, in init self.server_activate() File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/socketserver.py", line 463, in server_activate self.socket.listen(self.request_queue_size) OSError: [Errno 98] Address already in use Parsing account key... Parsing CSR... Found domains: mydomain.mydomain.com Getting directory... Directory found! Registering account... Already registered! Creating new order... Order created! Verifying mydomain.mydomain.com... Traceback (most recent call last): File "acme-tiny/acme_tiny.py", line 141, 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.mydomain.com/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8 Data: None Response Code: None Response: <urlopen error [Errno 111] Connection refused>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "acme-tiny/acme_tiny.py", line 198, in main(sys.argv[1:]) File "acme-tiny/acme_tiny.py", line 194, in main signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER, CA=args.ca, disable_check=args.disable_check, directory_url=args.directory_url, contact=args.contact) File "acme-tiny/acme_tiny.py", line 143, in get_crt raise ValueError("Wrote file to {0}, but couldn't download {1}: {2}".format(wellknown_path, wellknown_url, e)) ValueError: Wrote file to tmp-webroot/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8, but couldn't download http://mydomain.mydomain.com/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8: Error: Url: http://mydomain.mydomain.com/.well-known/acme-challenge/6jsd-0wKp6oV-Q93Wjc1qCGFsjxGj13qe7Aw2xn4-u8 Data: None Response Code: None Response: <urlopen error [Errno 111] Connection refused> An error occured. Restoring system state. ./renew_certificate.sh: line 6: 13381 Killed "$PYTHON" ../HTTPServer.py (wd: /share/Public/qnap-letsencrypt/tmp-webroot) Start apache proxy: ps aux |grep HTTPServer.pyOK Recover apache confiugre Starting Qthttpd services: OK `

and if I try (after renew command) the command ps aux |grep HTTPServer.py I have always a process httpserver.py changing pid every second...... ` [/share/Public/qnap-letsencrypt] # ps aux |grep HTTPServer.py 15539 admin 2220 S grep HTTPServer.py [/share/Public/qnap-letsencrypt] # [/share/Public/qnap-letsencrypt] # ps aux |grep HTTPServer.py 16108 admin 2208 S grep HTTPServer.py [/share/Public/qnap-letsencrypt] # ps aux |grep HTTPServer.py 16123 admin 2268 S grep HTTPServer.py [/share/Public/qnap-letsencrypt] # ps aux |grep HTTPServer.py 16148 admin 2256 S grep HTTPServer.py [/share/Public/qnap-letsencrypt] # ps aux |grep HTTPServer.py 16155 admin 2208 S grep HTTPServer.py [/share/Public/qnap-letsencrypt] #

`

Yannik commented 4 years ago

the process you are seeing is your grep command.

gsegatori commented 4 years ago

sorry it was late night.....btw with Python 3 I got OSError: [Errno 98] Address already in use (the nas is new and clean the system port used by the frontend is the 8080 that is redirect from the 80 I think by default) immagine

Yannik commented 4 years ago

what is your output of netstat -tulpn |grep 80 and lsof -i:80

gsegatori commented 4 years ago
netstat -tulpn |grep 80
tcp        0      0 127.0.0.1:10151         0.0.0.0:*               LISTEN      25480/mongod
tcp        0      0 127.0.0.1:10156         0.0.0.0:*               LISTEN      31380/Qmetadatad
tcp        0      0 127.0.0.1:10200         0.0.0.0:*               LISTEN      28030/QbusNotifyMon
tcp        0      0 127.0.0.1:58080         0.0.0.0:*               LISTEN      16398/_thttpd_
tcp        0      0 :::8080                 :::*                    LISTEN      16656/apache_proxy
udp        0      0 0.0.0.0:48040           0.0.0.0:*                           18819/avahi-daemon:
udp        0      0 10.0.3.1:60580          0.0.0.0:*                           24743/Plex Media Se
udp     4608      0 255.255.255.255:8097    0.0.0.0:*                           19530/bcclient
udp     4608      0 255.255.255.255:8097    0.0.0.0:*                           19530/bcclient
udp     6912      0 255.255.255.255:8097    0.0.0.0:*                           19530/bcclient
udp     4608      0 255.255.255.255:8097    0.0.0.0:*                           19530/bcclient
udp        0      0 255.255.255.255:8097    0.0.0.0:*                           19530/bcclient
udp        0      0 0.0.0.0:10380           0.0.0.0:*                           31487/Qjanus
udp        0      0 0.0.0.0:10480           0.0.0.0:*                           31487/Qjanus
udp        0      0 fe80::265e:beff:fe37:a150:546 :::*                                8900/dhclient

and


[~] # lsof -i:80
COMMAND   PID  USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
java    24639 admin   73u  IPv6 7467103      0t0  TCP GinusNas:56296->api.jdownloader.org:www (ESTABLISHED)
Qnvrd   30845 admin   52u  IPv4 7111362      0t0  TCP GinusNas:45784->192.168.0.14:www (ESTABLISHED)
Qnvrd   30845 admin   55u  IPv4 7112105      0t0  TCP GinusNas:56408->192.168.0.10:www (ESTABLISHED)
Qnvrd   30845 admin   57u  IPv4 7113900      0t0  TCP GinusNas:44848->192.168.0.15:www (ESTABLISHED)
Qnvrd   30845 admin   58u  IPv4 7112755      0t0  TCP GinusNas:56378->192.168.0.10:www (ESTABLISHED)
Qnvrd   30845 admin   59u  IPv4 7111961      0t0  TCP GinusNas:34922->192.168.0.12:www (ESTABLISHED)
Qnvrd   30845 admin   60u  IPv4 7111963      0t0  TCP GinusNas:34926->192.168.0.12:www (ESTABLISHED)
Qnvrd   30845 admin   62u  IPv4 7112112      0t0  TCP GinusNas:56414->192.168.0.10:www (ESTABLISHED)
Qnvrd   30845 admin   63u  IPv4 7112757      0t0  TCP GinusNas:56382->192.168.0.10:www (ESTABLISHED)
Qnvrd   30845 admin   67u  IPv4 7110512      0t0  TCP GinusNas:34020->192.168.0.13:www (ESTABLISHED)
Qnvrd   30845 admin   68u  IPv4 7110514      0t0  TCP GinusNas:34024->192.168.0.13:www (ESTABLISHED)
Qnvrd   30845 admin   74u  IPv4 7113904      0t0  TCP GinusNas:44852->192.168.0.15:www (ESTABLISHED)
Qnvrd   30845 admin   75u  IPv4 7115785      0t0  TCP GinusNas:45070->192.168.0.15:www (ESTABLISHED)
Qnvrd   30845 admin   76u  IPv4 7115789      0t0  TCP GinusNas:45076->192.168.0.15:www (ESTABLISHED)
Yannik commented 4 years ago

are you sure there is a redirect from 80->8080? i cannot see a process listening on port 80.

gsegatori commented 4 years ago

I rebooted the nas and now isn't redirecting, I changed the port from 8080 to 80 in the system setting, and script works good, thanks a lot for the support