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

fix(mtls) update to use newer mTLS api #89

Closed
wants to merge 1 commit into from
Closed

Conversation

pintsized
Copy link

@pintsized pintsized commented Feb 7, 2022

This revises the mTLS code to use the newer version of that feature (i.e. setclientcert instead of tlshandshake).

The relevant PRs are here and here.

However, the tests in this repo do not touch this code path, which is a little alarming, but also perhaps understandable since the feature isn't available in OpenResty mainline.

Merging this will be harmless to anyone not using mTLS, but will break for anyone using the old patch set. The reason for this PR is to try to unravel this tech debt as we push towards proper cosocket mTLS support in OpenResty.

The code path requires unmerged commits to both lua-nginx-module and
lua-resty-core to work. Previously those commits introduced an
alternative handshake method, `tlshandshake`. They have since been
revised, in the hope that the feature will reach an OpenResty mainline
release soon.
@CLAassistant
Copy link

CLAassistant commented Feb 7, 2022

CLA assistant check
All committers have signed the CLA.

@pintsized
Copy link
Author

This can wait until the mTLS API arrives in mainline OpenResty.

else
session, err = sock:sslhandshake(nil, https_sni,
self.checks.active.https_verify_certificate)
ok, err = sock:setclientcert(self.ssl_cert, self.ssl_key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Idea: what if we used feature detection (some combo of if type(sock.setclientcert) == "function" and if type(sock.tlshandshake) == "function") instead of a hard-coded change? In my mind then we would have the flexibility to merge+release this now rather than having one more transitive dependency to carefully update in lockstep with Kong. Replacing the feature detection with the hard-coded behavior could be left as a TODO once OpenResty+Kong are all on the same page, socket feature-wise.

@flrgh
Copy link
Contributor

flrgh commented Feb 11, 2022

Note: we'll also need to cherry-pick this commit to backport the change to the 1.x tree since Kong is still on 1.x.

@nowNick
Copy link
Contributor

nowNick commented Nov 8, 2023

Hi @pintsized !
Thank you for this contribution! We've merged these changes in another PR: #133. They were merged to 1.6.x branch and the master branch still was missing this change back then - but with the latest cleanup of #144 the master branch caught up to speed and now it has this code.

Thanks again for bringing this up 🏆

@nowNick nowNick closed this Nov 8, 2023
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

Successfully merging this pull request may close these issues.

4 participants