[Python-Dev] ssl

2010-06-05 Thread Kristján Valur Jónsson
Hello there.
I wanted to do some work on the ssl module, but I was a bit daunted at the 
prerequisites.  Is there anywhere that I can get at precompiled libs for the 
openssl that we use?
In general, gettin all those "external" projects seem to be complex to build.  
Is there a fast way?

What I want to do, is to implement a separate BIO for OpenSSL, one that calls 
back into python for writes and reads.  This is so that I can use my own 
sockets implementation for the actual IO, in particular, I want to funnel the 
encrypted data through our IOCompletion-based stackless sockets.

If successful, I think this would be a useful addition to ssl.
You would do something like:

class BIO():
  def write(): pass
  def read(): pass

from ssl.import
bio = BIO()
ssl_socket = ssl.wrap_bio(bio, ca_certs=...)


I am new to OpenSSL, I haven't even looked at what a BIO looks like, but I read 
this:  http://marc.info/?l=openssl-users&m=99909952822335&w=2
which indicates that this ought to be possible.  And before I start 
experimenting, I need to get my OpenSSL external ready.

Any thoughts?

Kristján
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] ssl

2010-06-05 Thread exarkun

On 08:34 am, [email protected] wrote:

Hello there.
I wanted to do some work on the ssl module, but I was a bit daunted at 
the prerequisites.  Is there anywhere that I can get at precompiled 
libs for the openssl that we use?
In general, gettin all those "external" projects seem to be complex to 
build.  Is there a fast way?


I take it the challenge is that you want to do development on Windows? 
If so, this might help:


 http://www.slproweb.com/products/Win32OpenSSL.html

It's what I use for any Windows pyOpenSSL development I need to do.


What I want to do, is to implement a separate BIO for OpenSSL, one that 
calls back into python for writes and reads.  This is so that I can use 
my own sockets implementation for the actual IO, in particular, I want 
to funnel the encrypted data through our IOCompletion-based stackless 
sockets.


For what it's worth, Twisted's IOCP SSL support is implemented using 
pyOpenSSL's support of OpenSSL memory BIOs.  This is a little different 
from your idea: memory BIOs are a built-in part of OpenSSL, and just 
give you a buffer from which you can pull whatever bytes OpenSSL wanted 
to write (or a buffer into which to put bytes for OpenSSL to read).


I suspect this would work well enough for your use case.  Being able to 
implement an actual BIO in Python would be pretty cool, though.


If successful, I think this would be a useful addition to ssl.
You would do something like:

class BIO():
 def write(): pass
 def read(): pass

from ssl.import
bio = BIO()
ssl_socket = ssl.wrap_bio(bio, ca_certs=...)


Hopefully this would integrate more nicely with the recent work Antoine 
has done with SSL contexts.  The preferred API for creating an SSL 
connection is now more like this:


   import ssl
   ctx = ssl.SSLContext(...)
   conn = ctx.wrap_socket(...)

So perhaps you want to add a wrap_bio method to SSLContext.  In fact, 
this would be the more general API, and could supercede wrap_socket: 
after all, socket support is just implemented with the socket BIOs. 
wrap_socket would become a simple wrapper around something like 
wrap_bio(SocketBIO(socket)).


I am new to OpenSSL, I haven't even looked at what a BIO looks like, 
but I read this:  http://marc.info/?l=openssl- 
users&m=99909952822335&w=2
which indicates that this ought to be possible.  And before I start 
experimenting, I need to get my OpenSSL external ready.


Any thoughts?


It should be possible.  One thing that's pretty tricky is getting 
threading right, though.  Python doesn't have to deal with this problem 
yet, as far as I know, because it never does something that causes 
OpenSSL to call back into Python code.  Once you have a Python BIO 
implementation, this will clearly be necessary, and you'll have to solve 
this.  It's certainly possible, but quite fiddly.


Jean-Paul
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

2010-06-05 Thread Guido van Rossum
On Fri, Jun 4, 2010 at 4:47 PM, Mark Hammond  wrote:
> On 2/06/2010 11:32 AM, Farshid Lashkari wrote:
>>
>> Hello,
>>
>> I noticed that if Py_IgnoreEnvironmentFlag is enabled, the Windows
>> registry is still used to initialize sys.path during startup. Is this an
>> oversight or intentional?
>
> I guess it falls somewhere in the middle - the flag refers to the
> 'environment' so I believe it hasn't really been considered as applying to
> the registry - IOW, the reference to 'environment' probably refers to the
> specific 'environment variables' rather than the more general 'execution
> environment'.
>
>> I assumed one of the intentions of this flag is to prevent embedded
>> Python interpreters from being affected by other Python installations.
>> Ignoring the Window registry as well as environment variables seems to
>> make sense in this situation.
>
> I agree.
>
>> If this is an oversight, would it be too late to have this fixed in
>> Python 2.7?
>
> Others will have opinions which carry more weight than mine, but I see no
> reason it should not be fixed for *some* Python version.  Assuming no
> objections from anyone else, I suggest the best way to get this to happen in
> the short to medium term would be to open a bug with a patch.  A bug without
> a patch would also be worthwhile but would almost certainly cause it to be
> pushed back to a future 3.x version...

I don't object (this had never occurred to me), but is Python on
Windows fully functioning when the registry is entirely ignored?

-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

2010-06-05 Thread Farshid Lashkari
On Sat, Jun 5, 2010 at 7:55 AM, Guido van Rossum  wrote:
>
> I don't object (this had never occurred to me), but is Python on
> Windows fully functioning when the registry is entirely ignored?


I believe so. The path of executable and Python DLL are used to initialize
sys.path, which should be enough to find the necessary files.
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

2010-06-05 Thread Kristján Valur Jónsson
Tangengially relevant is the following:  When embedding python, it is currently 
impossible (well, in 2.x anyway) to completely override pythons magic 
path-guessing algorithm.  This is annoying.  Last pycon, the talk on embedding 
python, showed how applications that do that often get started through 
bootstrapping batch scripts that set up the environment for python, to guide 
the path-setting algorithm along.

At CCP, we have patched python so that we can specify an initial sys.path, and 
completely disable the path guessing algorithm.  This is necessary because 
python is _embedded_ and it is the embedding application that knows where it is 
allowed to look for libraries.  This is in addition to telling it to ignore the 
environment.

In fact, it is my opinion that the path init stuff, as well as command line 
parsing and so on, really belongs in python.exe and not in python25.lib, 
although one can argue for the convenience of keeping it in the .lib.  But 
IMHO, it should not be part of Py_Initialize.

Perhaps I'll submit this particular patch to the tracker one day.

K

> -Original Message-
> From: [email protected]
> [mailto:[email protected]] On Behalf
> Of Guido van Rossum
> Sent: 5. júní 2010 14:55
> To: Mark Hammond
> Cc: Python-Dev
> Subject: Re: [Python-Dev] Windows registry path not ignored with
> Py_IgnoreEnvironmentFlag set
> 
> I don't object (this had never occurred to me), but is Python on
> Windows fully functioning when the registry is entirely ignored?
> 
> --
> --Guido van Rossum (python.org/~guido)

___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

2010-06-05 Thread Michael Foord

On 05/06/2010 19:03, Farshid Lashkari wrote:


On Sat, Jun 5, 2010 at 7:55 AM, Guido van Rossum > wrote:


I don't object (this had never occurred to me), but is Python on
Windows fully functioning when the registry is entirely ignored?




Yes, it works fine. This is one of the things py2exe does to create 
'standalone' Python programs for Windows.


Michael

I believe so. The path of executable and Python DLL are used to 
initialize sys.path, which should be enough to find the necessary files.



___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
   



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Windows registry path not ignored with Py_IgnoreEnvironmentFlag set

2010-06-05 Thread Terry Reedy

On 6/5/2010 10:55 AM, Guido van Rossum wrote:


I don't object (this had never occurred to me), but is Python on
Windows fully functioning when the registry is entirely ignored?


There have been a couple of portable CPython-on-a-CD or memory stick 
that supposedly run on any machine without 'installation' (writing to 
the registry), so they must run without reading anything Python specific.



___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] ssl

2010-06-05 Thread Martin v. Löwis

In general, gettin all those „external“ projects seem to be complex to
build.  Is there a fast way?


Run Tools\buildbot\external.bat.

Regards,
Martin
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] [RELEASE] Python 2.7 release candidate 1 released

2010-06-05 Thread Benjamin Peterson
On behalf of the Python development team, I'm effusive to announce the first
release candidate of Python 2.7.

Python 2.7 is scheduled (by Guido and Python-dev) to be the last major version
in the 2.x series. However, 2.7 will have an extended period of bugfix
maintenance.

2.7 includes many features that were first released in Python 3.1. The faster io
module, the new nested with statement syntax, improved float repr, set literals,
dictionary views, and the memoryview object have been backported from 3.1. Other
features include an ordered dictionary implementation, unittests improvements, a
new sysconfig module, and support for ttk Tile in Tkinter.  For a more extensive
list of changes in 2.7, see http://doc.python.org/dev/whatsnew/2.7.html or
Misc/NEWS in the Python distribution.

To download Python 2.7 visit:

 http://www.python.org/download/releases/2.7/

While this is a preview release and is thus not suitable for production use, we
strongly encourage Python application and library developers to test the release
with their code and report any bugs they encounter to:

 http://bugs.python.org/

This helps ensure that those upgrading to Python 2.7 will encounter as few bumps
as possible.

2.7 documentation can be found at:

 http://docs.python.org/2.7/


Enjoy!

--
Benjamin Peterson
Release Manager
benjamin at python.org
(on behalf of the entire python-dev team and 2.7's contributors)
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com