[Libwebsockets] error when ssl enabled

Andy Green andy at warmcat.com
Mon Dec 5 09:50:47 CET 2016


On Mon, 2016-12-05 at 13:57 +0530, satya gowtham kudupudi wrote:
> when I try to visit with SSL HTTPS protocol, nothing happens. Page
> doesn't load at browser and server prints nothing on the screen.

Mmm

> lwsts[27731]:  Listening on port 80

Are you telling it to listen on 443?  If you are still listening on
port 80, just with SSL, you must visit https://ubuntu.local:80

> When I try to visit with non-SSL HTTP protocol, I expect to redirect
to HTTPS.

Yeah.

Well you need to set that up if that's what you want.  You tell lws to
listen on one port or another and it does that.  That's it.  Apache is
the same.

You need to add a second vhost listening on 80 to do that, and mount a
redirect to https://whatever there.  Your main SSL vhost should be
listening on 443.

-Andy


> On Mon, Dec 5, 2016 at 12:17 PM, Andy Green <andy at warmcat.com> wrote:
> > On Mon, 2016-12-05 at 12:05 +0530, satya gowtham kudupudi wrote:
> > > Hi,
> > >
> > > I have enabled ssl using -ssl option on my server that inherits
> > test-
> > > server. server is running at ubuntu.local. https://ubuntu.local
> > don't
> > > generate any kind of log at the server but http://ubuntu.local
> > has
> > > generates below log
> > 
> > Ehhh if I understand it, you have started an SSL server and then
> > visit
> > it using non-SSL http protocol?
> > 
> > What exactly were you expecting to happen?
> > 
> > -Andy
> > 
> > 
> > > lwsts[27731]: libwebsockets test server - license LGPL2.1+SLE
> > > lwsts[27731]: (C) Copyright 2010-2016 Andy Green <andy at warmcat.co
> > m>
> > > lwsts[27731]: Running in server mode
> > > lwsts[27731]: Initial logging level 65535
> > > lwsts[27731]: Libwebsockets version: 2.1.0 gowtham at ubuntu-v2.0.0-
> > 170-
> > > g7355750
> > > lwsts[27731]: IPV6 not compiled in
> > > lwsts[27731]: libev support not compiled in
> > > lwsts[27731]: libuv support not compiled in
> > > lwsts[27731]:  LWS_DEF_HEADER_LEN    : 4096
> > > lwsts[27731]:  LWS_MAX_PROTOCOLS     : 5
> > > lwsts[27731]:  LWS_MAX_SMP           : 32
> > > lwsts[27731]:  SPEC_LATEST_SUPPORTED : 13
> > > lwsts[27731]:  sizeof (*info)        : 320
> > > lwsts[27731]:  SYSTEM_RANDOM_FILEPATH: '/dev/urandom'
> > > lwsts[27731]:  default timeout (secs): 5
> > > lwsts[27731]:  Threads: 1 each 1024 fds
> > > lwsts[27731]:  mem: context:          9272 bytes (5176 ctx + (1
> > thr x
> > > 4096))
> > > lwsts[27731]:  mem: http hdr rsvd:   122880 bytes (1 thr x (4096
> > +
> > > 3584) x 16))
> > > lwsts[27731]:  mem: pollfd map:       8192
> > > lwsts[27731]:  mem: platform fd map:  8192 bytes
> > > lwsts[27731]:  Compiled with OpenSSL support
> > > lwsts[27731]: Creating Vhost 'default' port 80, 2 protocols, IPv6
> > off
> > 
> > 
> > 
> > > lwsts[27731]:  SSL ciphers: 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-
> > RSA-
> > > AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-
> > >
> > SHA384:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:!HMAC_SHA1:!S
> > HA
> > > 1:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES128-SHA256:!AES128-GCM-
> > SHA25
> > > lwsts[27731]:  Using SSL mode
> > > lwsts[27731]:  SSL ECDH curve 'prime256v1'
> > > lwsts[27731]:  SSL options 0x35A0004
> > > lwsts[27731]: insert_wsi_socket_into_fds: 0x7f33500451b0: tsi=0,
> > > sock=9, pos-in-fds=1
> > > lwsts[27731]:  Listening on port 80
> > > lwsts[27731]:  LWS_MAX_EXTENSIONS_ACTIVE: 2
> > > lwsts[27731]:  mem: per-conn:          512 bytes + protocol rx
> > buf
> > > lwsts[27731]:  canonical_hostname = ubuntu
> > > lwsts[27731]: lws_protocol_init
> > > lwsts[27731]: fd=9, revents=1
> > > lwsts[27731]: accepted new conn  port 55677 on fd=10
> > > lwsts[27731]: Accepted 0x7f3350047030 to tsi 0
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: insert_wsi_socket_into_fds: 0x7f3350047030: tsi=0,
> > > sock=10, pos-in-fds=2
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: inserted SSL accept into fds, trying SSL_accept
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > >
> > routines:SSL23_GET_CLIENT_HELLO:httproutines:SSL23_GET_CLIENT_HELLO
> > :h
> > > ttp request
> > > lwsts[27731]: lws_adopt_socket_vhost: fail ssl negotiation
> > > lwsts[27731]: lws_close_free_wsi: shutting down connection:
> > > 0x7f3350047030 (sock 10, state 0)
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: fd=10, revents=17
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > > routines:SSL23_GET_CLIENT_HELLO:http request
> > > lwsts[27731]: lws_close_free_wsi: real just_kill_connection:
> > > 0x7f3350047030 (sockfd 10)
> > > lwsts[27731]: remove_wsi_socket_from_fds: removing same prot wsi
> > > 0x7f3350047030
> > > lwsts[27731]: remove_wsi_socket_from_fds: wsi=0x7f3350047030,
> > > sock=10, fds pos=2, end guy pos=3, endfd=0
> > > lwsts[27731]: not calling back closed mode=6 state=0
> > > lwsts[27731]: ah det due to close
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > (nil)
> > > (tsi=0, count = 0)
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > (nil)
> > > (tsi=0, count = 0)
> > > lwsts[27731]: lws_free_wsi: 0x7f3350047030, remaining wsi 1
> > > lwsts[27731]: fd=9, revents=1
> > > lwsts[27731]: accepted new conn  port 55680 on fd=10
> > > lwsts[27731]: Accepted 0x7f3350047030 to tsi 0
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: insert_wsi_socket_into_fds: 0x7f3350047030: tsi=0,
> > > sock=10, pos-in-fds=2
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: inserted SSL accept into fds, trying SSL_accept
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > > routines:SSL23_GET_CLIENT_HELLO:http request
> > > lwsts[27731]: lws_adopt_socket_vhost: fail ssl negotiation
> > > lwsts[27731]: lws_close_free_wsi: shutting down connection:
> > > 0x7f3350047030 (sock 10, state 0)
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: fd=10, revents=17
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > > routines:SSL23_GET_CLIENT_HELLO:http request
> > > lwsts[27731]: lws_close_free_wsi: real just_kill_connection:
> > > 0x7f3350047030 (sockfd 10)
> > > lwsts[27731]: remove_wsi_socket_from_fds: removing same prot wsi
> > > 0x7f3350047030
> > > lwsts[27731]: remove_wsi_socket_from_fds: wsi=0x7f3350047030,
> > > sock=10, fds pos=2, end guy pos=3, endfd=0
> > > lwsts[27731]: not calling back closed mode=6 state=0
> > > lwsts[27731]: ah det due to close
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > (nil)
> > > (tsi=0, count = 0)
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > (nil)
> > > (tsi=0, count = 0)
> > > lwsts[27731]: lws_free_wsi: 0x7f3350047030, remaining wsi 1
> > > lwsts[27731]: fd=9, revents=1
> > > lwsts[27731]: accepted new conn  port 55683 on fd=10
> > > lwsts[27731]: Accepted 0x7f3350047030 to tsi 0
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: insert_wsi_socket_into_fds: 0x7f3350047030: tsi=0,
> > > sock=10, pos-in-fds=2
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: inserted SSL accept into fds, trying SSL_accept
> > > lwsts[27731]: SSL_accept failed 2 /
> > > error:00000002:lib(0):func(0):system lib
> > > lwsts[27731]: SSL_ERROR_WANT_READ
> > > lwsts[27731]: lws_header_table_attach: wsi 0x7f3350047030: ah
> > (nil)
> > > (tsi 0, count = 0) in
> > > lwsts[27731]: lws_header_table_attach: wsi 0x7f3350047030: ah
> > > 0x7f3350012d20: count 1 (on exit)
> > > lwsts[27731]: Attached ah immediately
> > > lwsts[27731]: fd=10, revents=1
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > > routines:SSL23_GET_CLIENT_HELLO:http request
> > > lwsts[27731]: lws_close_free_wsi: shutting down connection:
> > > 0x7f3350047030 (sock 10, state 0)
> > > lwsts[27731]: lws_set_timeout: 0x7f3350047030: 5 secs
> > > lwsts[27731]: fd=10, revents=1
> > > lwsts[27731]: SSL_accept failed 1 /
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: SSL_accept failed skt 10:
> > > error:00000001:lib(0):func(0):reason(1)
> > > lwsts[27731]: *** error:1407609C:SSL
> > > routines:SSL23_GET_CLIENT_HELLO:http request
> > > lwsts[27731]: lws_close_free_wsi: real just_kill_connection:
> > > 0x7f3350047030 (sockfd 10)
> > > lwsts[27731]: remove_wsi_socket_from_fds: removing same prot wsi
> > > 0x7f3350047030
> > > lwsts[27731]: remove_wsi_socket_from_fds: wsi=0x7f3350047030,
> > > sock=10, fds pos=2, end guy pos=3, endfd=0
> > > lwsts[27731]: not calling back closed mode=6 state=0
> > > lwsts[27731]: ah det due to close
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > > 0x7f3350012d20 (tsi=0, count = 1)
> > > lwsts[27731]: lws_header_table_detach: wsi 0x7f3350047030: ah
> > > 0x7f3350012d20 (tsi=0, count = 0)
> > > lwsts[27731]: lws_free_wsi: 0x7f3350047030, remaining wsi 1
> > >
> > > I have no clue whats going on. Any hint is very much helpful.
> > >
> > > Thank you.
> > >
> > > --
> > > Gowtham
> > > _______________________________________________
> > > Libwebsockets mailing list
> > > Libwebsockets at ml.libwebsockets.org
> > > http://libwebsockets.org/mailman/listinfo/libwebsockets
> > 
> 
> 



More information about the Libwebsockets mailing list