0.4.3: how to connect to a wss URI?

538 views
Skip to first unread message

Iñaki Baz Castillo

unread,
Oct 31, 2011, 3:28:25 PM10/31/11
to Autobahn
Hi, using the new Autobahn 0.4.3 I get this error when setting a
"wsss" URI in the fuzzing_client_spec.json:

2011-10-31 20:04:05+0100 [-] File "/usr/local/lib/python2.7/dist-
packages/autobahn-0.4.3-py2.7.egg/autobahn/websocket.py", line 142, in
connectWS
2011-10-31 20:04:05+0100 [-] raise Exception("Secure WebSocket
connection requested, but no SSL context factory given")
2011-10-31 20:04:05+0100 [-] Exception: Secure WebSocket connection
requested, but no SSL context factory given

There is no connection attempt at all so it seems that the client side
needs "something".

Tobias Oberstein

unread,
Oct 31, 2011, 3:37:39 PM10/31/11
to autob...@googlegroups.com
yeah, 2 reasons:

a) TLS introduces a dependency on OpenSSL .. and I didnt wanted that
for the "base package". docs are lacking. yes.
b) I didn't expect the test suite to be used for TLS;)

the thing it misses is a client SSL config which contains stuff like
what server certs you accept.
in this case what the fuzzing client will accept.

i'll make you a patch for the test suite.

in the meantime, do

easy_install PyOpenSSL

2011/10/31 Iñaki Baz Castillo <i...@aliax.net>:

Iñaki Baz Castillo

unread,
Oct 31, 2011, 3:46:31 PM10/31/11
to autob...@googlegroups.com
2011/10/31 Tobias Oberstein <tobias.o...@gmail.com>:

> yeah, 2 reasons:
>
> a) TLS introduces a dependency on OpenSSL .. and I didnt wanted that
> for the "base package". docs are lacking. yes.
> b) I didn't expect the test suite to be used for TLS;)
>
> the thing it misses is a client SSL config which contains stuff like
> what server certs you accept.
> in this case what the fuzzing client will accept.
>
> i'll make you a patch for the test suite.

Thanks :)


> in the meantime, do
>
> easy_install PyOpenSSL

It seems I do not need it as I already have the python-openssl
installed. In fact easy_install does nothing:

~# easy_install PyOpenSSL
Searching for PyOpenSSL
Best match: pyOpenSSL 0.12
Adding pyOpenSSL 0.12 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Processing dependencies for PyOpenSSL
Finished processing dependencies for PyOpenSSL

--
Iñaki Baz Castillo
<i...@aliax.net>

tgo

unread,
Oct 31, 2011, 3:59:19 PM10/31/11
to Autobahn
ok, its on master branch. fetch that and build.

you will need to enable it in the spec

"enable-ssl": false,

=> true

this way, with default setting, still no dependency on openssl.

example AB server serving via WSS to test is:

Autobahn / testsuite / websockets / servers / test_autobahn_wss.py

instead of the normal one.

try your server ..

On Oct 31, 8:46 pm, Iñaki Baz Castillo <i...@aliax.net> wrote:
> 2011/10/31 Tobias Oberstein <tobias.oberst...@gmail.com>:

Iñaki Baz Castillo

unread,
Oct 31, 2011, 11:45:45 PM10/31/11
to autob...@googlegroups.com
2011/10/31 tgo <tobias.o...@gmail.com>:

> ok, its on master branch. fetch that and build.
>
> you will need to enable it in the spec
>
>   "enable-ssl": false,
>
> => true
>
> this way, with default setting, still no dependency on openssl.

Hi, I've upgraded autobahn WS to master branch but when adding
"enable-ssl": true into fuzzing_client_spec.json (in global "options"
or in per-server "options") I get an error:

2011-11-01 04:43:34+0100 [-] Traceback (most recent call last):
2011-11-01 04:43:34+0100 [-] File "fuzzing_client.py", line 29, in <module>
2011-11-01 04:43:34+0100 [-] fuzzer = FuzzingClientFactory(spec)
2011-11-01 04:43:34+0100 [-] File
"/usr/local/lib/python2.7/dist-packages/autobahn-0.4.3-py2.7.egg/autobahn/fuzzing.py",
line 1052, in __init__
2011-11-01 04:43:34+0100 [-] if self.nextServer():
2011-11-01 04:43:34+0100 [-] File
"/usr/local/lib/python2.7/dist-packages/autobahn-0.4.3-py2.7.egg/autobahn/fuzzing.py",
line 1082, in nextServer
2011-11-01 04:43:34+0100 [-]
self.setProtocolOptions(**server.get("options", {})) # set server
specific options
2011-11-01 04:43:34+0100 [-] TypeError: setProtocolOptions() got an
unexpected keyword argument 'enable-ssl'


Must I also upgrade autobahn egg?

Thanks a lot.

Tobias Oberstein

unread,
Nov 1, 2011, 4:33:15 AM11/1/11
to autob...@googlegroups.com
its a global-only option .. it says: yes, i've got pyopenssl.

you then can just use wss on individual servers. you dont need to set
anything else on the servers config

2011/11/1 Iñaki Baz Castillo <i...@aliax.net>:

Iñaki Baz Castillo

unread,
Nov 1, 2011, 8:29:26 AM11/1/11
to autob...@googlegroups.com
2011/11/1 Tobias Oberstein <tobias.o...@gmail.com>:

> its a global-only option .. it says: yes, i've got pyopenssl.
>
> you then can just use wss on individual servers. you dont need to set
> anything else on the servers config

Ok, now I've realized that it's not an option within the global
"options" field, but a separate option. So I use this
fuzzing_client_spec.json:

----------------
{
"options": {"failByDrop": false},
"enable-ssl": true,

"servers": [
{"agent": "OverSIP 0.1.0", "url":
"wss://192.168.1.12:9002", "options": {"version": 17}}
],

"cases": ["*"],
"exclude-cases": [],
"exclude-agent-cases": {}
}
----------------


I'm using Autobahn master branch with yesterday's updates, but get the
same error:

--------------
2011-11-01 13:27:40+0100 [-] Servers =
[u'wss://192.168.1.12:9002@OverSIP 0.1.0']
2011-11-01 13:27:40+0100 [-] Traceback (most recent call last):
2011-11-01 13:27:40+0100 [-] File "fuzzing_client.py", line 29, in <module>
2011-11-01 13:27:40+0100 [-] fuzzer = FuzzingClientFactory(spec)
2011-11-01 13:27:40+0100 [-] File
"/usr/local/lib/python2.7/dist-packages/autobahn-0.4.3-py2.7.egg/autobahn/fuzzing.py",
line 1054, in __init__
2011-11-01 13:27:40+0100 [-] connectWS(self)
2011-11-01 13:27:40+0100 [-] File
"/usr/local/lib/python2.7/dist-packages/autobahn-0.4.3-py2.7.egg/autobahn/websocket.py",
line 142, in connectWS
2011-11-01 13:27:40+0100 [-] raise Exception("Secure WebSocket


connection requested, but no SSL context factory given")

2011-11-01 13:27:40+0100 [-] Exception: Secure WebSocket connection


requested, but no SSL context factory given

---------------


/home/ibc/Autobahn$ grep -r enable-ssl *
lib/python/autobahn/fuzzing.py: if spec.get("enable-ssl", False):
testsuite/websockets/fuzzing_client_spec.json: "enable-ssl": true,


Do I miss something? Thanks a lot.

Tobias Oberstein

unread,
Nov 1, 2011, 9:23:14 AM11/1/11
to autob...@googlegroups.com
the fuzzing_client_spec.json is correct.

did you do a "python setup.py install" in "lib/python"?

in other words, do the grep over

/usr/local/lib/python2.7/dist-packages/autobahn-0.4.3-py2.7.egg/

it needs to be there .. and the *.pyc must be in sync with the *.py
there as well (which is done by "python setup.py install"
automatically)


2011/11/1 Iñaki Baz Castillo <i...@aliax.net>:

Iñaki Baz Castillo

unread,
Nov 1, 2011, 9:57:52 AM11/1/11
to autob...@googlegroups.com
2011/11/1 Tobias Oberstein <tobias.o...@gmail.com>:

> the fuzzing_client_spec.json is correct.
>
> did you do a "python setup.py install" in "lib/python"?

No I didn't. I had the version installed doing easy_install.

Thanks, it works now :)

Reply all
Reply to author
Forward
0 new messages