1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
:orphan:
.. _zserverssl-howto:
ZServerSSL-HOWTO
################
:author: Pheng Siong Ng <ngps@post1.com>
:copyright: © 2000, 2001 by Ng Pheng Siong.
:date: 2003-06-22
.. contents::
:backlinks: entry
.. sectnum::
:suffix: .
Introduction
============
ZServerSSL adds to Zope's ZServer the following:
- HTTPS server
- WebDAV-source-over-HTTPS server
With the HTTPS server, ZServerSSL also provides WebDAV-over-HTTPS and
XMLRPC-over-HTTPS access to Zope.
These instructions apply to both Un\*x and Windows installations of Zope
2.6.1. To avoid cluttering the presentation, Windows pathnames are shown
in Un\*x fashion.
Preparation
===========
#. Download M2Crypto 0.11, contained in the file ``m2crypto-0.11.zip``.
#. Unpack ``m2crypto-0.11.zip``. This will create a directory
``m2crypto-0.11``. Henceforth, we refer to this directory as ``$M2``.
#. Install M2Crypto per the instructions in ``$M2/INSTALL``.
The ZServerSSL distribution is in ``$M2/demo/Zope``. We shall refer to
this directory as ``$ZSSL``.
Installation
============
Below, we refer to your Zope top-level directory as ``$ZOPE``.
#. Copy ``$ZSSL/z2s.py`` into ``$ZOPE``.
#. 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.
#. Copy ``$ZSSL/dh1024.pem`` into ``$ZOPE``. This file contains
Diffie-Hellman parameters for use by the SSL protocol.
#. Copy ``$ZSSL/randpool.dat`` into ``$ZOPE``. This file contains seed
material for the OpenSSL PRNG. Alternatively, create
``$ZOPE/randpool.dat`` thusly::
$ dd if=/dev/urandom of=randpool.dat bs=1024 count=1
#. Copy ``$ZSSL/ca.pem`` to ``$ZOPE``. This file contains an
example Certification Authority (CA) certificate. For
information on operating your own CA, see :ref:`howto-ca` or
one of numerous similar documents available on the web.
#. Copy ``$ZSSL/server.pem`` to ``$ZOPE``. This file contains an RSA key
pair and its X.509v3 certificate issued by the above CA. You may also
create your own key/certificate bundle.
#. Copy ``$ZSSL/ZServer/HTTPS_Server.py`` to ``$ZOPE/ZServer``.
#. Copy ``$ZSSL/ZServer/__init__.py`` to ``$ZOPE/ZServer``. This
overwrites the existing ``$ZOPE/ZServer/__init__.py``. Alternatively,
apply the following patch to ``$ZOPE/ZServer/__init__.py``::
--- __init__.py.org Sat Jun 21 23:20:41 2003
+++ __init__.py Tue Jan 7 23:30:53 2003
@@ -84,6 +84,7 @@
import asyncore
from medusa import resolver, logger
from HTTPServer import zhttp_server, zhttp_handler
+from HTTPS_Server import zhttps_server, zhttps_handler
from PCGIServer import PCGIServer
from FCGIServer import FCGIServer
from FTPServer import FTPServer
#. Copy ``$ZSSL/ZServer/medusa/https_server.py`` to
``$ZOPE/ZServer/medusa``.
#. Stop Zope, if it is running.
#. Start Zope with ZServerSSL thusly::
./starts -X -f 9021 -w 9080 -W 9081 -y 9443 -Y 9444
This starts the following:
- an FTP server on port 9021
- a HTTP server on port 9080
- a WebDAV-source server on port 9081
- a HTTPS server on port 9443
- a WebDAV-source-over-HTTPS server on port 9444
Testing
=======
Below, we assume your Zope server is running on ``localhost``.
HTTPS
=====
This testing is done with Mozilla 1.1 on FreeBSD.
#. With a browser, connect to https://localhost:9443/. Browse around.
Check out your browser's HTTPS informational screens.
#. Connect to https://localhost:9443/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:9443/
WARNING: Untrusted server certificate presented:
Issued to: M2Crypto, SG
Issued by: M2Crypto, SG
Do you wish to accept the certificate? (y/n) y
dav:/> ls
Listing collection `/': succeeded.
Coll: Channels 0 Jun 19 00:04
Coll: Control_Panel 0 Jun 6 00:13
Coll: Examples 0 Jun 6 00:12
Coll: catalog 0 Jun 12 11:53
Coll: ngps 0 Jun 16 15:34
Coll: portal 0 Jun 21 15:21
Coll: skunk 0 Jun 18 21:18
Coll: temp_folder 0 Jun 22 17:57
Coll: zope 0 Jun 20 15:27
acl_users 0 Dec 30 1998
browser_id_manager 0 Jun 6 00:12
default.css 3037 Jun 21 16:38
error_log 0 Jun 6 00:12
index_html 313 Jun 12 13:36
portal0 0 Jun 21 15:21
session_data_manager 0 Jun 6 00:12
standard_error_message 1365 Jan 21 2001
standard_html_footer 50 Jun 12 12:30
standard_html_header 80 Jan 21 2001
standard_template.pt 282 Jun 6 00:12
zsyncer 0 Jun 17 15:28
dav:/> quit
Connection to `localhost' closed.
$
WebDAV-Source-over-HTTPS
========================
This testing is done with Mozilla 1.1 on FreeBSD.
#. Open the Mozilla Composer window.
#. Click "File", "Open Web Location". A dialog box appears.
#. Enter ``https://localhost:9444/index_html`` for the URL.
#. Select "Open in new Composer window."
#. Click "Open". A new Composer window will open with ``index_html``
loaded.
Python with M2Crypto
====================
This testing is done with M2Crypto 0.11 and Python 2.2.2 on FreeBSD.
HTTPS
=====
::
>>> from M2Crypto import Rand, SSL, m2urllib
>>> url = m2urllib.FancyURLopener()
>>> url.addheader('Connection', 'close')
>>> u = url.open('https://127.0.0.1:9443/')
send: 'GET / HTTP/1.1\r\nHost: 127.0.0.1:9443\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.11
header: Date: Sun, 22 Jun 2003 13:42:34 GMT
header: Connection: close
header: Content-Type: text/html
header: Etag:
header: Content-Length: 535
>>> while 1:
... data = u.read()
... if not data: break
... print(data)
...
::
<html><head>
<base href="https://127.0.0.1:9443/" />
<title>Zope</title></head><body bgcolor="#FFFFFF">
<h1>NgPS Desktop Portal</h1>
So many hacks.<br>
So little time.<br>
<h2>Link Farm</h2>
<ul>
<li><a href="http://localhost:8080/portal">Portal</a></li>
<li><a href="http://localhost/">Local Apache Home Page</a></li>
</ul>
<hr><a href="http://www.zope.org/Credits" target="_top"><img src="https://127.0.0.1:9443/p_/ZopeButton" width="115" height="50" border="0" alt="Powered by Zope" /></a></body></html>
::
>>> u.close()
>>>
XMLRPC-over-HTTPS
=================
::
>>> from M2Crypto.m2xmlrpclib import Server, SSL_Transport
>>> zs = Server('https://127.0.0.1:9443/', SSL_Transport())
>>> print(zs.propertyMap())
[{'type': 'string', 'id': 'title', 'mode': 'w'}]
>>>
Conclusion
==========
Well, it works! ;-)
|