How to implement an HTTPS web server using esp8266 with nodemcu? - ssl

I'm implementing a web server for access control and I need it to be encrypted (https).
I am using the LUA language with the nodemcu version 2.1.0 firmware and the modules file, gpio, http, mdns, net, node, struct, tmr, uart, wifi, tls
I have searched in many web pages but most use it in client mode, but I can not find or understand how to do this with an https page.
I have seen tls.createserver but it is in node.js.
Please if anyone can help me.
Thank you very much.

Related

Issues encountered on a fresh installation of RocketChat (1524) on Ubuntu

I have just downloaded and installed latest Rocket.chat using SNAP tool on Ubuntu (16.04 LTS). Overall, I had a smooth experience of installing and getting started with Rocket.chat. However, I did find a few serious issues.
I try to get auto SSL running by following the instructions at: https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/autossl/. But after configuring the Caddy file, the Caddy service failed to start, with the message:
Activating privacy features… 2018/04/24 17:58:09 open /root/snap/rocketchat-server/1254/.caddy/acme/acme-v02.api.letsencrypt.org/sites//.crt: no such file or directory
The second issue is with start video chat using webRTC. When I clicked on it, nothing happened. I am using Chrome browser and tried to start video chat on several devices. All the Chrome browsers have passed the webRTC tests. I don’t know why video screen is not shown.
I signed in with open.rocket.chat and compared the differences between my installation and the official site. When my browser points to open.rocket.chat site, the videochat does not work either. It does show the video window, but only displays only myself, not the remote member. Note to experiment, I signed up with 2 accounts to simulate 2 members chatting.
Also I downloaded the Android Rocketchat client. However, I couldn’t find the start video chat option. Is it true that video chat is unavailable yet on the Android client?
To summarise, we have the issue of setting up auto SSL with Caddy, and using video chat (webRTC). It could be that I missed a few basic configurations on my environment. Other functions like text messaging works fine.
We are deciding whether we should use Slack/CometChat for our instant messaging solution. It seems RocketChat has all the features we want, but it is a pity we couldn’t get it to work completely.
Appreciate someone can guide me in this.
I did some investigations on these issues, and have made some progress. I'd like to share my findings, which I hope could be of some help in future to newbies of RocketChat like me.
However, I still have a few issues unresolved, and hope someone could help.
Caddy service failed to start
Using self-signed certificate and defining the domain name in /etc/hosts, I can get Caddy service to start and https to work. My guess is that the domain name I used, even it is registered with a DNS provider, has no CNAME record, and is not mapped to any IP address. Letsencrypt, which is used by Caddy to do on-demand SSL, therefore is unable to create a SSL certificate for my domain name. It would be nice if the RocketChat documentation could make it clearer.
open.rocket.chat WebRTC-based video chat not working
after I used another Windows machine, the video chat is working. Presumably my previous computer does not have the latest Windows update. But I am glad with open.rocket.chat site, every feature I tested is working.
On my self-hosted Rocket-chat (i.e. a Linux server at home), however, the video chat is still not working. When I clicked on the "start video chat" button, no video screen is launched on my browser window. On the remote browser (which was used for simulating the conversation partner), there is a notification "xxx invites you to video chat, do you accept?". I clicked on "Yes". After that, nothing happens on the remote browser. The only issue I can think of is that I didn't use https to connect to the self-hosted Rocket-chat. Because I am using several computers in my home wireless network. I only use http://192.168.0.3:3000 to point to the chat server. I am wondering if secure connection is required in order to use video chat?
On the Android Rocket Chat app, I couldn't find any links to start a video chat, nor can I receive any video chat invite. Is it by design or a defect?
Hope someone can enlighten me on these issues.
I made further investigation as to why webRTC does not work on my self-hosted Rocket-chat instance. It is related to secured connection. There is a related discussion in the RocketChat forum:
https://github.com/RocketChat/Rocket.Chat/issues/1813
Basically, the connection to the Rocket.chat server must be secure for WebRtc to work. After I configure Caddy to support HTTPS listening on Rocket.Chat (currently using self-signed certificate), WebRTC works. It would really help users if the documentation can make this clear.
Now the remaining issue for me is to figure out if Android Rocket Chat app supports Web RTC.

Recommended WebRTC Server Configuration for Native app (iOS/Android)?

I tried to build a server for integrating the webrtc native APIs in an native app, but I am not sure about how the server should be configured, like the ICE/STUN/TURN, signaling, media server etc..
So far as I know is the open source project: https://github.com/priologic/easyrtc
Can anybody give some recommendations?
Thanks
In a WebRTC infrastructure, there are several things involved. The client part is written in JavaScript and runs on the browser.
But as you said it is a server side part. First there is a ICE/STUN/TURN server that it's used for a client to discover its public IP address if it is located behind a NAT. Depending on your requirements could not be necessary to build/deploy your own server, but use an already public (and free) existing one - here's a list. You can also deploy an open source one like Stuntman.
Then it comes the signaling part, used by two clients to negotiate and start a webrtc session. There is no standard here and you have a few options.
You can use an XMPP server with a Jingle extension. You can deploy an existing XMPP server, like OpenFire or Tigase
You can also use SIP, a protocol much more encountered for VoIP. You can use JAIN-SIP or SIP Servlets.
Or you can develop your own signaling protocol using something like websockets.
The server side options that I was giving you were Java based ones, but you can find similar for other infrastructures too.
STUN/TURN is required. Use public ones (not absolutely stable) or get a Ubuntu machine ans install from the source: https://code.google.com/p/rfc5766-turn-server/
Signaling is trivial. You just forward messages between peers. Just build a simple chat server.
Media server is whole different story and require sophisticated client-server configuration.

Web developement software that connects using TLS V1.0 not SSL3.0

My web host has made my server more secure and is now requiring connection via FTP over SSL/TLS but they will not accept SSL3.0, only TLS1.0 or higher.
This rules out Dreamweaver CS6, Komposer, Microsoft Web Expressions 4.0.
Filezilla works, so all is not lost, but it makes it a two program process (develop in Dreamweaver, cross to Filezilla to upload)
Does anyone know of a Windows 7 program that can connect via FTP using TLS v1.0 or higher instead of SSL3.0
Any suggestions greatly appreciated
Cheers, Al.
I have found a program called CoffeeCup HTML Editor.
It connects using TLSv1.0
I'm sure there are others, but this is the first one I found that I got to work and I am using it now.

Is there a way to securely transmit data from Windows Mobile 6.5 over the Internet?

I have an application in C++ that needs to transmit data securely via web services to our web server.
VPN was the first choice, but out network administrator informs us that we will not support the IPSEC protocols available on Windows Mobile.
Currently we have tried implementing a SSL connection, but found we don't have the libraries for that.
Alternatively, we have been trying PocketPutty to create a SSH tunnel, but that only has a GUI interface, and we're not sure how to get that to work via programming code.
Thank you
OpenSSL supports Windows CE.
SSL 2.0 has been supported since at least CE 5.0.
SecureBlackBox is also supported.

How to implement websockets on an embedded device server?

I am working with an electronics appliance manufacturer to embed LAN based control systems into the products. The idea is to serve up a system configuration/control interface through a web browser so clients never need to install software. We can communicate with the appliance by sending and receiving serial data through the embedded module. Since the appliance can also be controlled from a front panel UI, it creates a challenge to keep a remote web interface in sync with very low latency. It seems like websockets or some sort of Push is what we need for handling real time events from the server to clients.
I am using a Lantronix Mathport AR embedded device server. Out of the box the unit will serve up any custom HTML and java servlets/applets. We have the option to install a lightweight Linux distro if we need more flexibility. I am not sure how to implement any server side apps since the device is not running standard Apache. I believe it is using Boa.
Can anyone guide me in the right direction of how to do this?
Some general info...The WebSocket protocol (draft spec here) is a simple layer on top of TCP. What this means is that, if you already have a TCP server for your platform, implementing the WebSocket is just a matter of hours. The protocol specifies a handshake and two ways of sending data frames.
I strongly suggest you start by reading the 39 pages spec.
As Tihauan already mentioned, start by reading the spec, and also note that there are still some changes ongoing, although websockets is now more stable than it was 1 year ago.
Key point for me was the requirement that websocket data is entirely UTF-8 text, which lends itself nicely to JSON based message definitions.
Our system uses a form of embedded linux, so we then added and made use of the following libraries:
"libwebsockets" from:
http://git.warmcat.com/cgi-bin/cgit/libwebsockets/
"jansson" from:
http://www.digip.org/jansson/
Using the above as support libraries, we created an internal lightweight "client/server" that allowed our other software modules to register for certain, applicable, websocket messages, and respond as needed. Worked great.
Good luck and best regards,
I'm a bit late, but Mozilla posted a guide entitled "Writing WebSocket servers", which literally guides you through writing a websocket server.
You will need to already know how HTTP works and have medium programming experience. Depending on language support, knowledge of TCP sockets may be required. The scope of this guide is to present the minimum knowledge you need to write a WebSocket server.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers