Skip to content

Conversation

@themilchenko
Copy link
Contributor

@themilchenko themilchenko commented Nov 5, 2025

This patch allows to set a new ssl_verify_client option. It uses in pair with ssl_ca_file option and needs for client validation. It could have following values:

  • off (default one) means that no client's certs will be verified;
  • on means that server will verify client's certs;
  • optional means that server will verify client's certs only if it exist.

In effect, this option forces the server to work with mutual TLS.

The same parameter was supported for httpd role as well.

Closes #207
Closes #217

By default server checked server and client certificates which should do
with mTLS configuration.

Since it is not expected behaviour, after the patch `ca_file`
configuration won't ask for client certificates authorization

Closes #217
@themilchenko themilchenko force-pushed the themilchenko/support-mtls branch from 7fed070 to b5f1cf3 Compare November 5, 2025 13:45
@themilchenko themilchenko marked this pull request as ready for review November 5, 2025 13:50
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

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

Let's wait for the default option feedback

Comment on lines 1299 to 1303
local VERIFY_CLIENT_OPTS = {
off = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_NONE,
optional = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER,
on = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER + sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_FAIL_IF_NO_PEER,
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's reference NGINX in the commit message as a motivation (if we actually use the same names and defaults)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

http/server.lua Outdated
local VERIFY_CLIENT_OPTS = {
off = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_NONE,
optional = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER,
on = sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_PEER + sslsocket.SET_VERIFY_FLAGS.SSL_VERIFY_FAIL_IF_NO_PEER,
Copy link
Member

Choose a reason for hiding this comment

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

Does some bit operation is actually expected to be here? There is a proper bit library for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used bit lib

},
test_verify_client_optional_with_certs_valid = {
ssl_opts = {
ssl_verify_client = "optional",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ssl_verify_client = "optional",
ssl_verify_client = 'optional',

etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected

CHANGELOG.md Outdated

- Do not recreate server if it's address and port were not changed (#219).
- Server doesn't change after updating parameters on config reload (#216).
- Mutual TLS with `ca_file` option enabled (#217).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Mutual TLS with `ca_file` option enabled (#217).
- **Breaking change**: mutual TLS with `ca_file` option enabled (#217).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

This patch allows to set a new `ssl_verify_client` option. It uses in
pair with `ssl_ca_file` option and needs for client validation. It could
have following values:

* `off` (default one) means that no client's certs will be verified;
* `on` means that server will verify client's certs;
* `optional` means that server will verify client's certs only if it exist.

This set of options was was built on top of the NGINX API
(https://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_verify_client).

In effect, this option forces the server to work with mutual TLS.

Part of #207
Since http server supports a new `ssl_verify_client` option it is
necessary to support it in role api as well.

This patch introduces a new config parameter in httpd role with the same
`ssl_verify_client` name.

Closes #207
@themilchenko themilchenko force-pushed the themilchenko/support-mtls branch from b5f1cf3 to 0736446 Compare November 5, 2025 15:08
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.

ssl_ca_file field enables MTLS by default add support mtls

3 participants