Skip to content

Conversation

@rgacogne
Copy link
Member

This is a copy of the pull request 1 I initially opened in the https://github.com/DawnAngel/lua-nats/ repository. It unfortunately looks like DawnAngel's repository is no longer maintained, so I'm forking it here.

Hi!

This pull request implements TLS support using the luasec library, as an optional dependency.

I tested against the NATS Docker image by first generating a CA then using it to sign a certificate and a key, and starting the NATS server with:

docker run -v /path/to/server.pem:/tmp/server.cert -v /path/to/server.key:/tmp/server.key -v /path/to/ca.pem:/tmp/ca.pem -p 4223:4222 -ti nats:latest --tlscert /tmp/server.cert --tlskey /tmp/server.key --tlscacert /tmp/ca.pem

then connecting with:

local client = nats.connect({
    host = '127.0.0.1',
    port = 4222,
    tls = true,
    tls_ca_file = '/path/to/ca.pem',
})

The generation setup is basically the one used in https://github.com/PowerDNS/pdns/blob/master/regression-tests.dnsdist/Makefile, if that helps.

Please feel free to ask for any kind of changes, as the existing code is very well-structured and while I tried hard to keep it that way, I'm pretty sure it's not perfect!

It closes DawnAngel#4

Best regards,

Remi Gacogne
PowerDNS.com B.V

@rgacogne rgacogne added the enhancement New feature or request label Sep 17, 2024
Copy link
Member

@Habbie Habbie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few nits, one question, easily approved after that

@rgacogne rgacogne requested a review from Habbie September 27, 2024 12:16
@rgacogne rgacogne merged commit 2485b1d into PowerDNS:master Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NATS TLS support

2 participants