Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS and WSS support #55

Closed
vtamas00 opened this issue Jun 7, 2019 · 3 comments
Closed

HTTPS and WSS support #55

vtamas00 opened this issue Jun 7, 2019 · 3 comments

Comments

@vtamas00
Copy link

vtamas00 commented Jun 7, 2019

Are you planning to extend the features with secure operation?
How big effort to implement the SSL handsake to this project?

@ghost
Copy link

ghost commented Jun 20, 2019

I added SSL to microWebSrv.py myself and experienced no issues so far.

Basically all that I did, was wrapping client from client, cliAddr = self._server.accept() with ussl.wrap_socket.

Here is my version of microWebSrv.py
Note, that I also use a certificate and a key from separate files.

Here is some output using curl to connect to an esp32 using SSL:

$ curl -v -k https://doorlock004/ -H "Authorization: Token ********************"                                                                                                                                                                                                       
* TCP_NODELAY set
* Connected to doorlock004 port 443 (#0)                                                                                                                                       
* ALPN, offering h2                                                                                                                                                                           
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):                                                                                                                                             
* TLSv1.3 (IN), TLS handshake, Server hello (2):                                                                                                                                              
* TLSv1.2 (IN), TLS handshake, Certificate (11):                                                                                                                                              
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):                                                                                                                                      
* TLSv1.2 (IN), TLS handshake, Server finished (14):                                                                                                                                          
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):                                                                                                                                     
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):                                                                                                                                                
* TLSv1.2 (IN), TLS handshake, Finished (20):                                                                                                                                                 
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=DE; ST=MV; L=Rostock; O=Fraunhofer IGD-R; OU=ITSC; CN=doorlock004
*  start date: Feb  7 14:20:13 2019 GMT
*  expire date: Feb  7 14:20:13 2020 GMT
*  issuer: C=DE; ST=MV; L=Rostock; O=Fraunhofer IGD-R; OU=ITSC; CN=doorlock004
*  SSL certificate verify result: self signed certificate (18), continuing anyway.
> GET / HTTP/1.1
> Host: doorlock004
> User-Agent: curl/7.61.0
> Accept: */*
> Authorization: Token ********************
> 
< HTTP/1.1 200 OK                                                                                                                                                                             
< Content-Type: text/html; charset=UTF-8                                                                                                                                                      
< Content-Length: 230
< Server: MicroWebSrv by JC`zic                                                                                                                                                               
< Connection: close                                                                                                                                                                           
< 
        <!DOCTYPE html>
        <html lang=en>
        <head>
                <meta charset="UTF-8" />
            <title>I am doorlook004</title>
        </head>
        <body>
        <h1> I am doorlook004</h1>
        </body>
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):                                                                                                                                                 
        </html></body>

@vtamas00
Copy link
Author

vtamas00 commented Jul 1, 2019

Thanks, very nice, I will try it out!

@jczic
Copy link
Owner

jczic commented Oct 20, 2019 via email

@jczic jczic closed this as completed Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants