Welcome! Log In Create A New Profile

Advanced

MQTT TLS client certificates using NJS

Dušan Borovčanin
March 14, 2019 02:12PM
Hi,

I'm working on mutual authentication feature between MQTT client and
broker, and I follow these tutorials:
https://www.nginx.com/blog/nginx-plus-iot-load-balancing-mqtt and
https://www.nginx.com/blog/nginx-plus-iot-security-encrypt-authenticate-mqtt/#mqtt-client-certs.
However, the code examples are extremely out of date and this JavaScript
code does not work with recent versions of njs, so I've tried to write my
own code following your example from here:
https://gist.github.com/nginx-gists/0e93fe7813ec131fed8329d10ead70ea#file-mqtt-js
<https://gist.github.com/nginx-gists/0e93fe7813ec131fed8329d10ead70ea#file-mqtt-js>.
However, I can't figure out what is the possible replacement for the
following snippet:

if ( s.buffer.toString().length == 0 ) { // Initial calls may
> s.log("No buffer yet"); // contain no data, so
> return s.AGAIN; // ask that we get called again

} else if ( client_messages == 1 ) { // CONNECT is first packet from the
> client...

From version 0.2.4, s.(OK, ABORT, AGAIN, DECLINED, ERROR) are replace with
s.(allow(), done(), decline()). In my case, the initial call does not
contain any data. In logs, I can see that I always read only 4 bytes of
data received from the client. So when I send, let say, 50 bytes of data,
an event is triggered, but data passed to `upload` callback is empty. Is
this a bug? Can I somehow trigger this callback again?

Best regards,
Dušan Borovčanin
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

MQTT TLS client certificates using NJS

Dušan Borovčanin 81 March 14, 2019 02:12PM

Re: MQTT TLS client certificates using NJS

Drasko DRASKOVIC 39 March 14, 2019 02:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 62
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready