BoboTiG/pombo

Problem with https website

InfoLibre opened this issue · 10 comments

I've got this error when I test Pombo and nothing else seems to occur :

sudo -H /usr/local/bin/pombo.py
Pombo 1.0.3
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)

Perhaps it is because of the automatic redirection from http to https made by Apache ?

Yes, and the certificate maybe not official perhaps?

I'm not sure but the certificate seems to be official :
server_url=https://infolib.re/pombo/david/index.php

You are right. Maybe a Python 2 issue 🤔
Can you try with Python 3 instead?

I installed python3 :
sudo apt-get install python3-minimal python3-ipy python3-requests net-tools iw traceroute scrot streamer gpg
And replaced #!/usr/bin/env python by #!/usr/bin/env python3 in /usr/local/bin/pombo.py and I've still the same https error :

$ sudo -H /usr/local/bin/pombo.py
Pombo 1.0.3
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:860: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)

Hm I cannot reproduce on Python 2.7.16 nor 3.7.4.

For Python 2 and 3, what is the output of that command?

import sys
import requests

print(sys.version)
print(requests.get("https://infolib.re/pombo/david/index.php").text)
$ python
Python 2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import requests
>>> print(sys.version)
2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0]
>>> print(requests.get("https://infolib.re/pombo/david/index.php").text)
Nothing to do ...
>>> 

$ python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import requests
>>> print(sys.version)
3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0]
>>> print(requests.get("https://infolib.re/pombo/david/index.php").text)
Nothing to do ...
>>>

And what about the same commands using sudo -H?

$ sudo -H python
[sudo] Mot de passe de  :
Python 2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import requests
>>> print(sys.version)
2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0]
>>> print(requests.get("https://infolib.re/pombo/david/index.php").text)
Nothing to do ...
>>> 

$ sudo -H python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import requests
>>> print(sys.version)
3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0]
>>> print(requests.get("https://infolib.re/pombo/david/index.php").text)
Nothing to do ...
>>> 

I think I found the error:

pombo/pombo.py

Line 401 in 7ab3ddb

ssl_cert_verif = url.split(':') == 'https'

>>> "https://infolib.re/pombo/david/index.php".split(":")
['https', '//infolib.re/pombo/david/index.php']
>>> "https://infolib.re/pombo/david/index.php".split(":") == "https"
False

This is a long-time bug then ... 😨

But this is just a warning, the sofwate should work with it too. I will fix it quickly though.