Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78527

Re: Weird SSL problem

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <roland.hedberg@umu.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:169.254.1': 0.05; 'attribute': 0.07; 'pypi': 0.07; 'socket': 0.07; '__init__': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ah,': 0.16; 'httplib': 0.16; 'ioerror:': 0.16; 'libraries.': 0.16; 'self.sock': 0.16; 'simplest': 0.16; 'skip:" 70': 0.16; 'subject:SSL': 0.16; 'underlying': 0.16; 'urllib': 0.16; 'extensions': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'obviously': 0.18; 'trying': 0.19; 'help.': 0.21; 'machine': 0.22; 'import': 0.22; 'reset': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'ssl': 0.24; 'subject:problem': 0.24; 'fine': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'correct': 0.29; 'url:bugs': 0.29; '(which': 0.31; 'requests': 0.31; '"",': 0.31; 'sep': 0.31; 'you\x92re': 0.31; 'anyone': 0.31; 'file': 0.32; 'received:169.254': 0.32; 'option': 0.32; 'open': 0.33; 'url:python': 0.33; '(most': 0.33; 'problem': 0.35; 'connection': 0.35; 'problem.': 0.35; 'skip:s 30': 0.35; 'doing': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:169': 0.37; 'url:microsoft': 0.37; 'being': 0.38; 'server': 0.38; 'skip:- 10': 0.38; 'recent': 0.39; 'skip:u 10': 0.60; 'more': 0.64; 'charset:windows-1252': 0.65; 'believe': 0.68; 'received:130': 0.73; 'article': 0.77; 'client-side': 0.84; 'curl': 0.84; 'it\x92s': 0.84; 'absolutely': 0.87
X-IronPort-AV E=Sophos;i="5.04,630,1406584800"; d="scan'208";a="41286692"
X-IPAS-Result ApsoAHi5K1SC7wH2/2dsb2JhbABgEwEBg0xZoW6oUodLAoEiAQF6hAMBAQEBAgF5BQsCAQgOCi4yJQEBBA4FiDYIBQi+bQEXjhOBYDMHgy6BHQWFFI1fgzaIb41EhkqDZTsvAYJJAQEB
From Roland Hedberg <roland.hedberg@umu.se>
To Ned Deily <nad@acm.org>
Date Wed, 1 Oct 2014 10:22:54 +0200
Subject Re: Weird SSL problem
Thread-Topic Weird SSL problem
Thread-Index Ac/dUOYm8elM+gDCQcSUbf17mxQx7w==
References <CD8F39D9-ACD9-4D6E-9AAC-DBCDF607F242@adm.umu.se> <nad-186249.15555729092014@news.gmane.org>
In-Reply-To <nad-186249.15555729092014@news.gmane.org>
Accept-Language en-US, sv-SE
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
acceptlanguage en-US, sv-SE
Content-Type text/plain; charset="Windows-1252"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14508.1412151831.18130.python-list@python.org> (permalink)
Lines 101
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412151831 news.xs4all.nl 2933 [2001:888:2000:d::a6]:55027
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 6909
X-Received-Body-CRC 4073936103
Xref csiph.com comp.lang.python:78527

Show key headers only | View raw


30 sep 2014 kl. 00:55 skrev Ned Deily <nad@acm.org>:

> In article <CD8F39D9-ACD9-4D6E-9AAC-DBCDF607F242@adm.umu.se>,
> Roland Hedberg <roland.hedberg@adm.umu.se> wrote:
> 
>> Hi!
>> 
>> I¹m trying to access 
>> https://stsadweb.one.microsoft.com/adfs/.well-known/openid-configuration
>> 
>> Doing it the simplest way I get the following:
>> 
>>>>> import urllib
>>>>> f = 
>>>>> urllib.urlopen("https://stsadweb.one.microsoft.com/adfs/.well-known/openid
>>>>> -configuration")
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py",
>>   line 87, in urlopen
>>    return opener.open(url)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py",
>>   line 208, in open
>>    return getattr(self, name)(url)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py",
>>   line 437, in open_https
>>    h.endheaders(data)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py"
>>  , line 969, in endheaders
>>    self._send_output(message_body)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py"
>>  , line 829, in _send_output
>>    self.send(msg)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py"
>>  , line 791, in send
>>    self.connect()
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py"
>>  , line 1176, in connect
>>    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", 
>>  line 387, in wrap_socket
>>    ciphers=ciphers)
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", 
>>  line 143, in __init__
>>    self.do_handshake()
>>  File 
>>  "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", 
>>  line 305, in do_handshake
>>    self._sslobj.do_handshake()
>> IOError: [Errno socket error] [Errno 54] Connection reset by peer
>>>>> import ssl
>>>>> ssl.OPENSSL_VERSION
>> ¹OpenSSL 0.9.8za 5 Jun 2014'
>> 
>> Now, using Safari, or curl for that matter, from the same machine works 
>> without a hitch.
>> 
>> The URL above is also the only URL I¹ve encountered this problem with.
>> 
>> Anyone got an idea ?
> 
> I believe the problem is that the connection is protected by a 
> multi-hostname server certificate and Python 2's urllib (and underlying 
> httplib and ssl modules) do not support SNI extensions to TLS.  The 
> request above works fine with Python 3 (which has supported client-side 
> SNI since Python 3.2).  See http://bugs.python.org/issue5639 for more 
> discussion of the matter.  If Python 3 is not an option for you, the 
> requests package available via PyPI should help.

You’re absolutely correct in that it’s a SNI problem.
Python 3 is not an option and I was already using requests obviously missing something.
Ah, had to install some extra libraries.

— Roland

”Being able to think like a child is an important attribute of being an adult” - Eddie Izzard

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Weird SSL problem Roland Hedberg <roland.hedberg@umu.se> - 2014-10-01 10:22 +0200

csiph-web