File tree Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -2581,7 +2581,7 @@ ssl_psk_by_lua_block
25812581This directive runs user Lua code when NGINX is about to start the SSL handshake for the downstream
25822582SSL (https) connections using TLS-PSK and is meant for setting the TLS pre-shared key on a per-request basis.
25832583
2584- The [ ngx.ssl] ( https://github.com/openresty /lua-resty-core/blob/master /lib/ngx/ssl.md )
2584+ The [ ngx.ssl] ( https://github.com/vartiait /lua-resty-core/blob/ssl-psk /lib/ngx/ssl.md )
25852585 Lua module provided by the [ lua-resty-core] ( https://github.com/openresty/lua-resty-core/#readme )
25862586library is particularly useful in this context. You can use the Lua API offered by this Lua module
25872587to set the TLS pre-shared key for the current SSL connection being initiated.
@@ -2603,7 +2603,25 @@ at the same time:
26032603 ssl_psk_identity_hint Test_TLS-PSK_Identity_Hint;
26042604
26052605 ssl_psk_by_lua_block {
2606- print("About to initiate a new TLS-PSK handshake!")
2606+ local ssl = require "ngx.ssl"
2607+
2608+ local psk_identity, err = ssl.get_psk_identity()
2609+ if not psk_identity then
2610+ ngx.log(ngx.ERR, "Failed to get TLS-PSK Identity: ", err)
2611+ return ngx.ERROR
2612+ end
2613+
2614+ print("Client TLS-PSK Identity: ", psk_identity)
2615+
2616+ local psk_key = "psk_test_key"
2617+
2618+ local ok, err = ssl.set_psk_key(psk_key)
2619+ if not ok then
2620+ ngx.log(ngx.ERR, "Failed to set TLS-PSK key: ", err)
2621+ return ngx.ERROR
2622+ end
2623+
2624+ return ngx.OK
26072625 }
26082626
26092627 location / {
Original file line number Diff line number Diff line change @@ -2170,7 +2170,7 @@ This directive was first introduced in the <code>v0.10.0</code> release.
21702170This directive runs user Lua code when NGINX is about to start the SSL handshake for the downstream
21712171SSL (https) connections using TLS-PSK and is meant for setting the TLS pre-shared key on a per-request basis.
21722172
2173- The [https://github.com/openresty /lua-resty-core/blob/master /lib/ngx/ssl.md ngx.ssl ]
2173+ The [https://github.com/vartiait /lua-resty-core/blob/ssl-psk /lib/ngx/ssl.md ngx.ssl ]
21742174 Lua module provided by the [https://github.com/openresty/lua-resty-core/#readme lua-resty-core ]
21752175library is particularly useful in this context. You can use the Lua API offered by this Lua module
21762176to set the TLS pre-shared key for the current SSL connection being initiated.
@@ -2191,7 +2191,25 @@ at the same time:
21912191 ssl_psk_identity_hint Test_TLS-PSK_Identity_Hint;
21922192
21932193 ssl_psk_by_lua_block {
2194- print("About to initiate a new TLS-PSK handshake!")
2194+ local ssl = require "ngx.ssl"
2195+
2196+ local psk_identity, err = ssl.get_psk_identity()
2197+ if not psk_identity then
2198+ ngx.log(ngx.ERR, "Failed to get TLS-PSK Identity: ", err)
2199+ return ngx.ERROR
2200+ end
2201+
2202+ print("Client TLS-PSK Identity: ", psk_identity)
2203+
2204+ local psk_key = "psk_test_key"
2205+
2206+ local ok, err = ssl.set_psk_key(psk_key)
2207+ if not ok then
2208+ ngx.log(ngx.ERR, "Failed to set TLS-PSK key: ", err)
2209+ return ngx.ERROR
2210+ end
2211+
2212+ return ngx.OK
21952213 }
21962214
21972215 location / {
You can’t perform that action at this time.
0 commit comments