whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.18k stars 221 forks source link

aws iot #292

Closed tcpipchip closed 2 years ago

tcpipchip commented 4 years ago

Hi,

I am again Teacher!

Does your Lua-RTOS-ESP32 implements CA certificates to use with AWS IoT for example ? The 3 main certificates. SSL If yes, i want to add Lua-RTOS-ESP32 in my book about Alexa + ESP32, using Amazon AWS IoT imediately or using API rest. Just have to open a mqqt (SSL) and post a topic and have a callback if i subscribe to other topic.

tcpipchip commented 4 years ago

It be a good marketing for your LUA image

tcpipchip commented 4 years ago

Found mqtt doc! Is that MQTT embeeded in the default WHITECAT RTOS LUA or must i compile it on make menuconfig ? Can you instruct me then i get time to write the chapter book about WHITECAT acessing MQTT AWS IOT ? client = mqtt.client("100", "www.inf.furb.br", 1883, false) stdin:1: attempt to index a nil value (global 'mqtt') stack traceback: stdin:1: in main chunk [C]: in ?

tcpipchip commented 4 years ago

Can you help me to use on SSL on LUA RTOS ? (an example), MQTT or HTTPS...

the0ne commented 4 years ago

for MQTTs see https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/MQTT-module:

as documented there:

-- Creates an mqtt instance. Broker domain is xxxx.xx, at port 1883
client = mqtt.client("100", "xxxx.xx", 1883, false)

-- Creates an mqtt instance, secured connection to xxxx.xx
client = mqtt.client(id, "xxxx.xx", 8883, true)

-- Creates an mqtt instance, secured connection to xxxx.xx, and checks if the MQTT Server is the expected one
client = mqtt.client(id, "xxxx.xx", 8883, true, "/path/to/certificate.pem")

-- Creates an mqtt instance, secured connection to xxxx.xx, with persistence in subfolder of the current script
client = mqtt.client(id, "xxxx.xx", 8883, true, nil, true)

-- Creates an mqtt instance, secured connection to xxxx.xx, with persistence in /sdcard
client = mqtt.client(id, "xxxx.xx", 8883, true, nil, true, "/sdcard")
tcpipchip commented 4 years ago

@the0ne

Thomas, thank you!

About

/path/to/certificate.pem is the path to only one certificate ? The CA, correct!

But i will need to add the PRIVATE AND CERTIFICATE too, not only the CA

How can i add them ?

the0ne commented 4 years ago

@tcpipchip please read https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/MQTT-module

tcpipchip commented 4 years ago

Yes i read that! Maybe i am missunderstanding! I cant see how to add the 3 certificates!

the0ne commented 4 years ago

That's for Server cert validation only. Not for login!

tcpipchip commented 4 years ago

Yes! But aws iot is not accepting access only with CA, needs too other 2 cerificates!

the0ne commented 4 years ago

You asked

help me to use on SSL on LUA RTOS ? (an example), MQTT or HTTPS...

and you got the answer on how you can connect to a standard MQTT server via an SSL secured connection.

tcpipchip commented 4 years ago

I am so sorry if i wasn´t clear!

jolivepetrus commented 4 years ago

@tcpipchip,

Hi sir. Sorry for the delay in my answer. Just coming from the vacation period!.

From Whitecat we are working hard to introduce STEAM in high schools, processional schools, and universities. We have amazing experiences in high schools that are adopting Whitecat in their STEAM programs.

Please, contact by private mail (jolive@whitecatboard.org) to explore further collaborations in this area.

Best regards,

Jaume

tcpipchip commented 4 years ago

jaume I sent a pv e-mail

sicrisembay commented 3 years ago

Hi, I want to connect to AWS mqtt broker using the existing MQTT module in Lua-RTOS. I see that the existing mqtt.client(...) only accepts Certificate for server verification. I plan to extend the mqtt.client() so it also accepts device certificate and private key for login by modifying /lua/modules/middleware/mqtt.c.

Has anybody tried and implemented this approach?

tcpipchip commented 3 years ago

i only access using Arduino, micropython and At commands

Looks that still not implemented

sicrisembay commented 3 years ago

while looking at it for the whole afternoon, i can say that support for keyStore and privateKey are not yet ported in mqtt SSLSocket (referring to SSLSocket_createContext() in /components/mqtt/SSLSocket.c).

I have no experience on porting SSL (enabling keyStore and privateKey). It will take me sometime to wrap my head on this.

the0ne commented 2 years ago

No update on this from @sicrisembay, so closing for now.

tcpipchip commented 2 years ago

yes, still not supported

ShivamJoker commented 6 months ago

@the0ne I would also like to know how to use this with AWS IoT core. AWS asks us to put their certs, so that secure connection is maintained.

the0ne commented 6 months ago

As mentioned above, this currently seems to be unsupported. Are you experienced in coding in the "C" language? If yes, you may want to add cert-based client authentication to the existing MQTT module.