[PYTHON-CRYPTO] Question about start using ZServerSSL on win box...

Michael Vartanyan pycry at DOLI.BIZ
Thu Dec 15 11:39:01 CET 2005


Thomas,

Sorry if I was not clear. Forget the ZServerSSL-HOWTO, it is not valid
for Zope 2.7+. Take the original Ng's 0.13 package (I gave you the link
last time), in demo/Zope27 it has working patches and an INSTALL.txt
file on how to apply them. I will also paste it here for future
M2Crypto+Zope googlers ;)



=========================================
ZServerSSL for Zope 2.7.0b2
=========================================

:Author: Ng Pheng Siong
:Id: $Id$
:Date: $Date$
:Web-Site: http://sandbox.rulemaker.net/ngps/zope/zssl/

.. contents::


Directories
-----------------------

This distribution is contained in ``m2crypto-0.12/demo/Zope27/``. Its
directory structure assumes the following:

- Zope 2.7.0b2 is installed in <install-dir>.
- An instance has been created in <instance-home>.


<install-dir>
-----------------------

The following files are to be copied to the corresponding directories
in your <install-dir>:

- install_dir/lib/python/ZServer/HTTPS_Server.py
- install_dir/lib/python/ZServer/medusa/https_server.py

The following patch files are to be applied to the corresponding
directories in your <install-dir>:

- install_dir/lib/python/ZServer/__init__.py.patch
- install_dir/lib/python/ZServer/component.xml.patch
- install_dir/lib/python/ZServer/datatypes.py.patch


<instance-home>
-----------------------

The following files are to be copied to the corresponding directories
in your <instance-home>:

- instance_home/ssl/ca.pem
- instance_home/ssl/server.pem
- instance_home/ssl/dh1024.pem

These are example files. For more information on them, consult the
ZServerSSL HOWTO for Zope 2.6.

The following patch files are to be applied to the corresponding
directories in your <instance-home>:

- instance_home/README.txt.patch
- instance_home/etc/zope.conf.patch

(Patching README.txt is optional.)

There appears to be a bug in Zope 2.7.0b2, where INSTANCE_HOME in a
running Zope points to <install-dir>, not <instance-home>. Workaround
this with the following:

::

    $ (cd <install-dir>; ln -s <instance-home>/ssl)


Launch ZServerSSL
-------------------

::

    $ <instance-home>/bin/runzope


Testing
---------

Below, we assume your Zope server is running on ``localhost``.


HTTPS
~~~~~~~

This testing is done with Mozilla 1.1 on FreeBSD.

1. With a browser, connect to https://localhost:8443/. Browse
   around. Check out your browser's HTTPS informational screens.

2. Connect to https://localhost:8443/manage. Verify that you can
   access Zope's management functionality.


WebDAV-over-HTTPS
~~~~~~~~~~~~~~~~~~~

This testing is done with Cadaver 0.21.0 on FreeBSD.

::

    $ cadaver https://localhost:8443/
    WARNING: Untrusted server certificate presented:
    Issued to: M2Crypto, SG
    Issued by: M2Crypto, SG
    Do you wish to accept the certificate? (y/n) y
    Authentication required for Zope on server `localhost':
    Username: admin
    Password:
    dav:/> ls
    Listing collection `/': succeeded.
    Coll:   Control_Panel                          0  Sep 28 00:38
    Coll:   temp_folder                            0  Sep 28 17:30
            acl_users                              0  Sep 28 00:38
            browser_id_manager                     0  Sep 28 00:38
            error_log                              0  Sep 28 00:38
            index_html                            28  Sep 28 00:39
            session_data_manager                   0  Sep 28 00:38
            standard_error_message              1189  Sep 28 00:39
            standard_html_footer                  18  Sep 28 00:39
            standard_html_header                  82  Sep 28 00:39
            standard_template.pt                 282  Sep 28 00:39
    dav:/> quit
    Connection to `localhost' closed.
    $


Python with M2Crypto
~~~~~~~~~~~~~~~~~~~~~~

This testing is done with M2Crypto 0.12 and Python 2.2.3 on FreeBSD.

HTTPS
```````

>>> from M2Crypto import Rand, SSL, m2urllib
>>> url = m2urllib.FancyURLopener()
>>> url.addheader('Connection', 'close')
>>> u = url.open('https://127.0.0.1:8443/')
send: 'GET / HTTP/1.1\r\nHost: 127.0.0.1:8443\r\nAccept-Encoding:
identity\r\nUser-agent: Python-urllib/1.15\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: ZServerSSL/0.12
header: Date: Sun, 28 Sep 2003 09:40:14 GMT
header: Content-Length: 3055
header: Etag:
header: Content-Type: text/html
header: Connection: close
>>> while 1:
...     data = u.read()
...     if not data: break
...     print data
...

::

    [blah blah blah]

    <p>
    Go directly to the <a href="/manage" target="_top">
    Zope Management Interface</a> if you'd like to start working with Zope
    right away.  <strong>NOTE:  Some versions of Microsoft Internet
Explorer,
    (specifically IE 5.01 and early versions of IE 5.5) may have problems
    displaying Zope management pages.  If you cannot view the management
pages,
    try upgrading your IE installation to the latest release version, or use
    a different browser.</strong>
    </p>
    </li>

    <li>
    <p>
    Find out about <a href="http://www.zope.com/" target="_new">Zope
    Corporation</a>, the publishers of Zope.
    </p>
    </li>

    </ul>

    </body>
    </html>

>>> u.close()
>>>


XMLRPC-over-HTTPS
```````````````````

>>> from M2Crypto.m2xmlrpclib import Server, SSL_Transport
>>> zs = Server('https://127.0.0.1:8443/', SSL_Transport())
>>> print zs.propertyMap()
[{'type': 'string', 'id': 'title', 'mode': 'w'}]
>>>


Conclusion
------------

Yes, it works! ;-)




Thomas G. Apostolou wrote:

>Hello Michael,
>tahnks for replying.
>
>I heve read the documentation you sudgested, but still it says:
>
>  1.. Copy $ZSSL/z2s.py into $ZOPE.
>
>  2.. Depending on your operating system, modify $ZOPE/start or
>$ZOPE/start.bat to invoke $ZOPE/z2s.py, instead of $ZOPE/z2.py. The files
>$ZSSL/starts and $ZSSL/starts.bat serve as examples.
>
>this is from http://www.zope.org/Members/ngps/ZServerSSL-HOWTO
>whitch is a link from http://sandbox.rulemaker.net/ngps/m2/
>...
>
>and, as i said, I do not have any $ZOPE/start or $ZOPE/start.bat or
>$ZOPE/z2.py, i only have
>a file named PythonService.exe into "C:\Program Files\Plone 2\Zope\bin" and
>i found that all about running
>ZService as service start from "C:\Program Files\Plone
>2\Data\bin\zopeservice.py"
>But still i cannot fully understand where the server is called so that i
>replace it with z2s.py or what ever needed...
>
>Thanks again
>
>"Michael Vartanyan" <pycry at DOLI.BIZ> wrote in message
>news:439F3085.1010409 at doli.biz...
>  
>



More information about the python-crypto mailing list