Secure Websockets Help

Home Forums MongooseIM Secure Websockets Help

This topic contains 0 replies, has 1 voice, and was last updated by  efranford 3 months, 4 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #43613

    efranford
    Member

    Hi everyone,

    I created an issue on the MongooseIM about setting up secure websockets. I figured I would post here to hopefully get more eyes on it. Any help is greatly appreciated! Here’s a link to the actual issue – https://github.com/esl/MongooseIM/issues/308. I’ve pasted an abridged version of the contents below just for reference.
    ————————————————————————————————————————
    I am having issues connecting using wss. I am able to connect with ws:// and my certificates for the other securities seem to be working. I get the following error when I connect with wss.

    
    2014-11-07 19:33:08.510 [error] emulator Error in process <0.528.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,parse_method,[<<0 bytes>>,{state,#Port<0.4389>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...
    
    2014-11-07 19:33:08.510 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.528.0> exit with reason: {function_clause,[{cowboy_protocol,parse_method,[<<>>,{state,#Port<0.4389>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<"localhost">>],[],[{[<<"metrics">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<"metrics">>,<<"m">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<"metrics">>,<<"m">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<"metrics">>,<<"host">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<"metrics">>,<<"host">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<"ws-xmpp">>],[],mod_websockets,[]}]},{'_',[],[{[<<"ws-xmpp">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388793509},<<22,3,1,0,137,1,0,0,133,3,2,192,152,23,167,137,52,42,65,108,178,100,202,128,250,159,99,17,111,31,109,67,46,84,67,254,110,172,255,63,204,115,221,0,0,30,86,0,192,10,192,9,192,19,192,20,192,7,192,17,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0,0,62,0,0,0,14,0,12,0,0,9,108,111,99,97,108,104,111,115,116,255,1,0,1,0,0,10,0,8,0,6,0,23,0,24,0,25,0,11,0,2,1,0,0,35,0,0,117,80,0,0,0,5,0,5,1,0,0,0,0,0,18,0,0>>],[{file,"src/cowboy_protocol.erl"},{line,203}]}]}
    
    2014-11-07 19:33:08.813 [error] emulator Error in process <0.529.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,skip_uri_fragment,[<<0 bytes>>,{state,#Port<0.4390>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...
    
    2014-11-07 19:33:08.813 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.529.0> exit with reason: {function_clause,[{cowboy_protocol,skip_uri_fragment,[<<>>,{state,#Port<0.4390>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<"localhost">>],[],[{[<<"metrics">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<"metrics">>,<<"m">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<"metrics">>,<<"m">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<"metrics">>,<<"host">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<"metrics">>,<<"host">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<"ws-xmpp">>],[],mod_websockets,[]}]},{'_',[],[{[<<"ws-xmpp">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388793812},<<22,3,1,0,137,1,0,0,133,3,1,155,133,148,111,243,126>>,<<126,66,126,140,129,113,20,119,243,2,110,101,142,42,233,61,248,228,70,68,74,218,247,234,248,0,0,30,86,0,192,10,192,9,192,19,192,20,192,7,192,17,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0,0,62,0,0,0,14,0,12,0,0,9,108,111,99,97,108,104,111,115,116,255,1,0,1,0,0,10,0,8,0,6,0,23,0,24,0,25,0,11,0,2,1,0,0>>,<<>>],[{file,"src/cowboy_protocol.erl"},{line,245}]}]}
    
    2014-11-07 19:33:09.208 [error] emulator Error in process <0.530.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,parse_method,[<<0 bytes>>,{state,#Port<0.4391>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...
    
    2014-11-07 19:33:09.208 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.530.0> exit with reason: {function_clause,[{cowboy_protocol,parse_method,[<<>>,{state,#Port<0.4391>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<"localhost">>],[],[{[<<"metrics">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<"metrics">>,<<"m">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<"metrics">>,<<"m">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<"metrics">>,<<"host">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<"metrics">>,<<"host">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<"ws-xmpp">>],[],mod_websockets,[]}]},{'_',[],[{[<<"ws-xmpp">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388794115},<<22,3,0,0,63,1,0,0,59,3,0,213,247,216,123,139,209,40,140,122,163,59,119,193,241,187,220,75,159,78,247,241,182,239,17,67,209,56,122,117,185,171,54,0,0,20,0,255,86,0,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0>>],[{file,"src/cowboy_protocol.erl"},{line,203}]}]}
    

    I have created a branch in my fork with my changes. All you have to do is install vagrant, clone off my branch, and run “vagrant up” from the projects directory.

    It’s worth noting that the server is at 192.168.33.77 on your local machine. The connections I am trying with websocket are:
    ws://192.168.33.77:5280/ws-xmpp
    wss://192.168.33.77:5280/ws-xmpp

    Once it’s running do the following in your console:

    vagrant ssh
    cd ../../mongooseim/rel/mongooseim
    bin/mongooseim live

    I have 5 test users:
    elliot1 | password
    elliot2 | password
    elliot3 | password
    elliot4 | password
    elliot5 | password

    I added the users to Pidgin and am using the MongooseIM/examples/websockets/jsjac/simpleclient.html to try to connect. As you can see ws and the secure xmpp works, but when you try wss you will get an error similar to that above.

    I made some changes to my .gitignore so you shouldn’t have to do any fiddling with my code and only a few steps during deployment.

    ————————————————————————————————————————
    I really hope someone can help tell me where I went wrong!

    Thanks in advance,
    Elliot

    PS: Don’t worry about the certificates, keys, and whatnot as they are for development only.

    • This topic was modified 3 months, 4 weeks ago by  efranford. Reason: Adding in links to make it easier to help out
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.