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


Groups > comp.lang.python > #78540

Re: SNI support in python 2.7 for Locust load tests

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <reddy@poczta.fm>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'api.': 0.05; 'startup': 0.05; 'error:': 0.07; 'subject:support': 0.07; 'dependency': 0.09; 'enhancements': 0.09; 'implements': 0.09; 'pep': 0.09; 'pyopenssl': 0.09; 'subject:2.7': 0.09; 'url:archive': 0.09; 'url:github': 0.09; 'url:releases': 0.09; 'python': 0.11; 'project,': 0.12; '2.7': 0.14; 'being,': 0.16; 'from:addr:poczta.fm': 0.16; 'hint': 0.16; 'pypi.': 0.16; 'python/c': 0.16; 'received:217.74': 0.16; 'received:217.74.65': 0.16; 'received:interia.pl': 0.16; 'received:poczta.interia.pl': 0.16; 'received:smtpo.poczta.interia.pl': 0.16; 'there...': 0.16; 'tls': 0.16; 'ubuntu.': 0.16; 'url:gz': 0.16; 'url:tar': 0.16; 'weird.': 0.16; 'subject:python': 0.16; 'url:)': 0.16; 'trying': 0.19; "python's": 0.19; 'import': 0.22; 'install': 0.23; 'load': 0.23; '2.x': 0.24; 'finally,': 0.24; 'ssl': 0.24; 'stick': 0.24; "i've": 0.25; 'extension': 0.26; 'skip:" 40': 0.26; 'switch': 0.26; 'post': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'tried': 0.27; 'idea': 0.28; 'skip:p 30': 0.29; "i'm": 0.30; 'gives': 0.31; 'requests': 0.31; "skip:' 10": 0.31; 'too.': 0.31; 'disable': 0.31; 'writes:': 0.31; 'yesterday': 0.31; 'file': 0.32; 'there.': 0.32; 'interface': 0.32; "we're": 0.32; 'run': 0.32; 'url:python': 0.33; 'running': 0.33; 'guess': 0.33; 'implemented': 0.33; 'noticed': 0.34; 'skip:_ 10': 0.34; 'could': 0.34; 'connection': 0.35; 'skip:s 30': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'described': 0.36; 'installing': 0.36; 'module.': 0.36; 'options:': 0.36; 'ubuntu': 0.36; 'done': 0.36; 'doing': 0.36; 'thanks': 0.36; "i'll": 0.36; 'hi,': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'two': 0.37; 'list': 0.37; 'project': 0.37; 'starting': 0.37; 'christian': 0.38; 'branch': 0.38; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'according': 0.40; 'skip:u 10': 0.60; 'most': 0.60; 'new': 0.61; 'simply': 0.61; 'received:217': 0.63; 'header:Message-Id:1': 0.63; 'happen': 0.63; 'skip:n 10': 0.64; 'prompt': 0.68; 'default': 0.69; 'received:pl': 0.69; 'url:a': 0.72; 'verification': 0.83; '...and': 0.84; 'br,': 0.84; 'partial': 0.84; 'url:cpython': 0.84; 'cryptography': 0.91; 'officially': 0.91; 'url:latest': 0.91
Date Wed, 01 Oct 2014 13:30:14 +0200
From Reddy <reddy@poczta.fm>
Subject Re: SNI support in python 2.7 for Locust load tests
To python-list@python.org
X-Mailer interia.pl/pf09
In-Reply-To <fxtgasjjovcazwzucedo@oxbw>
References <ykqkmazzoumucouzwmxa@mfps> <87tx3opc45.fsf@handshake.de> <fxtgasjjovcazwzucedo@oxbw>
X-Originating-IP 192.100.124.156
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 7bit
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1412163014; bh=ZFOcX8UmyGd4jeJ6nNmOwYxjWEymcGnnPsonh9XTePE=; h=Date:From:Subject:To:X-Mailer:In-Reply-To:References: X-Originating-IP:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding; b=jEups2aqojQDZZveNPousEMPopy1CDFczgtvrQv3pEWvvcvYhwkqOLzOsEB4nj3Lv 8+uXai6w1T0ENUKiYs8a2xFimbH8pRrfAFUXH2+B0eBun+XHrFboJ1nObGV5lxqFQ1 vA+fBWr1SZ92cq3iMgkh3f0TCDti7sK4sprXHhzE=
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.14517.1412163016.18130.python-list@python.org> (permalink)
Lines 66
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412163016 news.xs4all.nl 2927 [2001:888:2000:d::a6]:45829
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78540

Show key headers only | View raw


Hi,

> > Reddy  writes:
> > > ...
> > > I'm trying to use locust (http://locust.io/) to run load test of one site we're developing. Everything was running nice and smooth until we switch the servers to use SNI. SNI is not officially supported in python 2.7.5
> 
> > you have two options:
> > 
> > Python 2.7.9 implements PEP 466 "Network Security Enhancements for
> > Python 2.7.x" including TLS 1.1, 1.2 and SNI support. 2.7.9 will be
> > released shortly. You could try the 2.7 branch from hg.python.org.
> > 
> > Use PyOpenSSL instead of Python's ssl module. It supports SNI, too.
> 
> > A recent post in this list regarding missing SNI support in Python 2.x
> > got as a suggestion to use the "backports.ssl" package on PyPI.
> 
> Thanks Christian and Dieter for your prompt responses!
> I tried yesterday with Python built from https://hg.python.org/cpython/archive/9b4673d7b046.tar.gz. I also do use pyOpenSSL as described at http://stackoverflow.com/a/19477363 so I used pip to install pyOpenSSL, ndg-httpsclient and pyasn1 as well as patched locust startup file with the following:
> 
> from urllib3.contrib import pyopenssl
> pyopenssl.inject_into_urllib3()
> 
> I also tried adding the following:
> from functools import partial
> ssl.wrap_socket = partial(ssl.wrap_socket, ssl_version=ssl.PROTOCOL_TLSv1)
> 
> Finally, I've just tried with:
> /usr/local/bin/pip2.7 install backports.ssl
> 
> and patching the lucust file with:
> 
> import backports.ssl as ssl
> import backports.ssl.monkey as monkey
> import requests
> monkey.patch()
> 
> I've also added verify=False to my locust test scripts to disable certificate verification according to http://docs.locust.io/en/latest/api.html
> 
> ...And I still get exactly the same error:
> 
> [2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 977, in sendall
> [2014-09-30 14:19:41,793] ip-x-x-x-x/ERROR/stderr: File "build/bdist.linux-x86_64/egg/OpenSSL/SSL.py", line 849, in _raise_ssl_error
> [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: OpenSSL.SSL
> [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: .
> [2014-09-30 14:19:41,794] ip-x-x-x-x/ERROR/stderr: WantWriteError
> 
> Now I'm starting to think it's something else than SNI, but all those scripts were working nice before and the only change done was turning on the SNI on tested servers... 
> 
> Any idea what my actually cause this WantWriteError?
> -- 

I think I have a clue what's wrong. By default using:
/usr/local/bin/pip2.7 install pyOpenSSL ndg-httpsclient pyasn1
gives me pyOpenSSL version 0.14. When I downgrade it to 0.13 with
/usr/local/bin/pip2.7 install pyOpenSSL==0.13
everything works nice and smooth. Interestingly, on my local Ubuntu I do have 0.14 version of that package and it works well there...
I noticed that dowgrading it to 0.13 buids 'OpenSSL.crypto' extension and that does not happen when installing v. 0.14 so I guess there's simply a connection to openssl missing somehow there in 0.14. According to https://github.com/pyca/pyopenssl/releases there was a big change there:
"Second, pyOpenSSL is no longer implemented in C as a collection of extension modules using the Python/C API. Instead, pyOpenSSL is now a pure-Python project with a dependency on a new project, http://github.com/pyca/cryptography, which provides (among other things) a cffi-based interface to OpenSSL."
but I also have the most recent version of cryptography (0.6) installed there. And again - it works on local Ubuntu. Weird.

I guess I'll just stick to pyOpenSSL==0.13 for the time being, unless somebody gives me a hint what I'm doing wrong with 0.14 :)

Br,
Reddy

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


Thread

Re: SNI support in python 2.7 for Locust load tests Reddy <reddy@poczta.fm> - 2014-10-01 13:30 +0200

csiph-web