C0D3D3V / Moodle-DL

Moodle-DL downloads course content fast from Moodle (eg. lecture pdfs)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignored --skip-cert-verify --allow-insecure-ssl

pablotoribio-beta opened this issue · comments

Description of the bug

When using the parameters --skip-cert-verify --allow-insecure-ssl is still verifing the certificate.

Steps to reproduce the issue

When using the command moodle-dl --skip-cert-verify --allow-insecure-ssl -v i get the following error:
2023-03-24 17:56:40 DEBUG {main} moodle-dl version: 2.3.1.5
2023-03-24 17:56:40 DEBUG {main} python version: 3.8.12
2023-03-24 17:56:40 DEBUG {main} Is ffmpeg available: True
2023-03-24 17:56:40 DEBUG {main} Checking for changes for the configured Moodle-Account....
2023-03-24 17:56:40 DEBUG {database} Database Version: 5
2023-03-24 17:56:40 DEBUG {selector_events} Using selector: EpollSelector
2023-03-24 17:56:40 DEBUG {moodle_service} Fetching current Moodle state...
2023-03-24 17:56:40 DEBUG {connectionpool} Starting new HTTPS connection (1): fpadistancia.educantabria.es:443
2023-03-24 17:56:41 DEBUG {request_helper} The 1th Connection Error occurred, retrying. HTTPSConnectionPool(host='fpadistancia.educantabria.es', port=443): Max retries exceeded with url: /webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_users_courses (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
2023-03-24 17:56:42 DEBUG {connectionpool} Starting new HTTPS connection (2): fpadistancia.educantabria.es:443
2023-03-24 17:56:42 DEBUG {request_helper} The 2th Connection Error occurred, retrying. HTTPSConnectionPool(host='fpadistancia.educantabria.es', port=443): Max retries exceeded with url: /webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_users_courses (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
2023-03-24 17:56:43 DEBUG {connectionpool} Starting new HTTPS connection (3): fpadistancia.educantabria.es:443
2023-03-24 17:56:43 DEBUG {request_helper} The 3th Connection Error occurred, retrying. HTTPSConnectionPool(host='fpadistancia.educantabria.es', port=443): Max retries exceeded with url: /webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_users_courses (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
2023-03-24 17:56:44 DEBUG {connectionpool} Starting new HTTPS connection (4): fpadistancia.educantabria.es:443
2023-03-24 17:56:44 DEBUG {request_helper} The 4th Connection Error occurred, retrying. HTTPSConnectionPool(host='fpadistancia.educantabria.es', port=443): Max retries exceeded with url: /webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_users_courses (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
2023-03-24 17:56:45 DEBUG {connectionpool} Starting new HTTPS connection (5): fpadistancia.educantabria.es:443
The following error occurred during execution:
Connection error: HTTPSConnectionPool(host='fpadistancia.educantabria.es', port=443): Max retries exceeded with url: /webservice/rest/server.php?moodlewsrestformat=json&wsfunction=core_enrol_get_users_courses (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))

Expected behavior

In case of an invalid certificate continue anyway.

use only one of the options not both

I triyed individually with each option and didn't solve my problem, but thanks you for the suggestion.

I looked in the code, it should not even matter if you use both options (even tho it makes no sense)

I will investigate on Sunday what is going wrong...

Are you on MacOs?

Thanks you very much, is not running in MacOs, i use a docker container based in a ubuntu image on a linux machine.

Have you tried the docker container I publish here on github?

Yes, same result.

Funny is that the cert your moodle server is using is valid, but the server sends an incomplete chain: https://www.ssllabs.com/ssltest/analyze.html?d=fpadistancia.educantabria.es&latest
thats why certifi does not find the root certificate, web browsers are less strict about it and try to figure out the chain themselves.

Please try the new release and open a new issue if the error persists