You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.markdown
+51-23Lines changed: 51 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -927,7 +927,6 @@ TODO
927
927
* add `ignore_resp_headers`, `ignore_resp_body`, and `ignore_resp` options to [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) methods, to allow micro performance tuning on the user side.
928
928
* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks.
929
929
* add `stat` mode similar to [mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html).
930
-
* cosocket: add client SSL certificate support.
931
930
932
931
[Back to TOC](#table-of-contents)
933
932
@@ -2952,7 +2951,7 @@ lua_ssl_ciphers
2952
2951
2953
2952
**context:***http, server, location*
2954
2953
2955
-
Specifies the enabled ciphers for requests to a SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method. The ciphers are specified in the format understood by the OpenSSL library.
2954
+
Specifies the enabled ciphers for requests to a SSL/TLS server in the [tcpsock:tlshandshake](#tcpsocktlshandshake) method. The ciphers are specified in the format understood by the OpenSSL library.
2956
2955
2957
2956
The full list can be viewed using the “openssl ciphers” command.
2958
2957
@@ -2969,7 +2968,7 @@ lua_ssl_crl
2969
2968
2970
2969
**context:***http, server, location*
2971
2970
2972
-
Specifies a file with revoked certificates (CRL) in the PEM format used to verify the certificate of the SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method.
2971
+
Specifies a file with revoked certificates (CRL) in the PEM format used to verify the certificate of the SSL/TLS server in the [tcpsock:tlshandshake](#tcpsocktlshandshake) method.
2973
2972
2974
2973
This directive was first introduced in the `v0.9.11` release.
2975
2974
@@ -2984,7 +2983,7 @@ lua_ssl_protocols
2984
2983
2985
2984
**context:***http, server, location*
2986
2985
2987
-
Enables the specified protocols for requests to a SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method.
2986
+
Enables the specified protocols for requests to a SSL/TLS server in the [tcpsock:tlshandshake](#tcpsocktlshandshake) method.
2988
2987
2989
2988
The support for the `TLSv1.3` parameter requires version `v0.10.12`*and* OpenSSL 1.1.1.
2990
2989
@@ -3001,7 +3000,7 @@ lua_ssl_trusted_certificate
3001
3000
3002
3001
**context:***http, server, location*
3003
3002
3004
-
Specifies a file path with trusted CA certificates in the PEM format used to verify the certificate of the SSL/TLS server in the [tcpsock:sslhandshake](#tcpsocksslhandshake) method.
3003
+
Specifies a file path with trusted CA certificates in the PEM format used to verify the certificate of the SSL/TLS server in the [tcpsock:tlshandshake](#tcpsocktlshandshake) method.
3005
3004
3006
3005
This directive was first introduced in the `v0.9.11` release.
3007
3006
@@ -3292,6 +3291,7 @@ Nginx API for Lua
3292
3291
*[ngx.socket.stream](#ngxsocketstream)
3293
3292
*[ngx.socket.tcp](#ngxsockettcp)
3294
3293
*[tcpsock:connect](#tcpsockconnect)
3294
+
*[tcpsock:tlshandshake](#tcpsocktlshandshake)
3295
3295
*[tcpsock:sslhandshake](#tcpsocksslhandshake)
3296
3296
*[tcpsock:send](#tcpsocksend)
3297
3297
*[tcpsock:receive](#tcpsockreceive)
@@ -7229,6 +7229,7 @@ ngx.socket.tcp
7229
7229
Creates and returns a TCP or stream-oriented unix domain socket object (also known as one type of the "cosocket" objects). The following methods are supported on this object:
7230
7230
7231
7231
*[connect](#tcpsockconnect)
7232
+
*[tlshandshake](#tcpsocktlshandshake)
7232
7233
*[sslhandshake](#tcpsocksslhandshake)
7233
7234
*[send](#tcpsocksend)
7234
7235
*[receive](#tcpsockreceive)
@@ -7388,49 +7389,76 @@ This method was first introduced in the `v0.5.0rc1` release.
Does SSL/TLS handshake on the currently established connection.
7399
7400
7400
-
The optional `reused_session` argument can take a former SSL
7401
-
session userdata returned by a previous `sslhandshake`
7402
-
call for exactly the same target. For short-lived connections, reusing SSL
7401
+
An optional Lua table containing the following keys can be specified to this method as handshake options:
7402
+
7403
+
*`reused_session` take a former TLS
7404
+
session cdata returned by a previous `tlshandshake`
7405
+
call for exactly the same target. For short-lived connections, reusing TLS
7403
7406
sessions can usually speed up the handshake by one order by magnitude but it
7404
7407
is not so useful if the connection pool is enabled. This argument defaults to
7405
-
`nil`. If this argument takes the boolean `false` value, no SSL session
7406
-
userdata would return by this call and only a Lua boolean will be returned as
7407
-
the first return value; otherwise the current SSL session will
7408
+
`nil`. If this argument takes the boolean `false` value, no TLS session
7409
+
cdata would return by this call and only a Lua boolean will be returned as
7410
+
the first return value; otherwise the current TLS session will
7408
7411
always be returned as the first argument in case of successes.
7409
-
7410
-
The optional `server_name` argument is used to specify the server
7412
+
*`server_name` is used to specify the server
7411
7413
name for the new TLS extension Server Name Indication (SNI). Use of SNI can
7412
7414
make different servers share the same IP address on the server side. Also,
7413
-
when SSL verification is enabled, this `server_name` argument is
7415
+
when TLS verification is enabled (`options.verify` is `true`), this `server_name` argument is
7414
7416
also used to validate the server name specified in the server certificate sent from
7415
7417
the remote.
7416
-
7417
-
The optional `ssl_verify` argument takes a Lua boolean value to
7418
-
control whether to perform SSL verification. When set to `true`, the server
7418
+
*`verify` takes a Lua boolean value to
7419
+
control whether to perform TLS handshake verification. When set to `true`, the server
7419
7420
certificate will be verified according to the CA certificates specified by
7420
7421
the [lua_ssl_trusted_certificate](#lua_ssl_trusted_certificate) directive.
7421
7422
You may also need to adjust the [lua_ssl_verify_depth](#lua_ssl_verify_depth)
7422
7423
directive to control how deep we should follow along the certificate chain.
7423
-
Also, when the `ssl_verify` argument is true and the
7424
+
Also, when the `verify` argument is true and the
7424
7425
`server_name` argument is also specified, the latter will be used
7425
7426
to validate the server name in the server certificate.
7426
-
7427
-
The optional `send_status_req` argument takes a boolean that controls whether to send
7427
+
*`ocsp_status_req` takes a Lua boolean value that controls whether to send
7428
7428
the OCSP status request in the SSL handshake request (which is for requesting OCSP stapling).
7429
+
*`client_cert` specify a client certificate chain cdata object that will be used while handshaking with
7430
+
remote server. These objects can be created using [ngx.ssl.parse\_pem\_cert](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md#parse_pem_cert)
7431
+
function provided by lua-resty-core. Note that specifying the `client_cert` option requires
7432
+
corresponding `client_priv_key` be provided too. See below.
7433
+
*`client_priv_key` specify a private key corresponds to the `client_cert` option above.
7434
+
These objects can be created using [ngx.ssl.parse\_pem\_priv\_key](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md#parse_pem_priv_key)
7435
+
function provided by lua-resty-core.
7436
+
7437
+
For code that does frequent calls to `tlshandshake`, the `options` table
7438
+
can be safely shared across requests as a module level variable (even if the call yields).
7429
7439
7430
7440
For connections that have already done SSL/TLS handshake, this method returns
7431
7441
immediately.
7432
7442
7433
-
This method was first introduced in the `v0.9.11` release.
7443
+
This method was first introduced in the `v0.10.16` release.
0 commit comments