|
| 1 | +Name |
| 2 | +==== |
| 3 | + |
| 4 | +ngx.proxyssl - Lua API for controlling NGINX upstream SSL handshakes |
| 5 | + |
| 6 | +Table of Contents |
| 7 | +================= |
| 8 | + |
| 9 | +* [Name](#name) |
| 10 | +* [Status](#status) |
| 11 | +* [Synopsis](#synopsis) |
| 12 | +* [Description](#description) |
| 13 | +* [Methods](#methods) |
| 14 | + * [get_tls1_version](#get_tls1_version) |
| 15 | + * [get_tls1_version_str](#get_tls1_version_str) |
| 16 | +* [Community](#community) |
| 17 | + * [English Mailing List](#english-mailing-list) |
| 18 | + * [Chinese Mailing List](#chinese-mailing-list) |
| 19 | +* [Bugs and Patches](#bugs-and-patches) |
| 20 | +* [Author](#author) |
| 21 | +* [Copyright and License](#copyright-and-license) |
| 22 | +* [See Also](#see-also) |
| 23 | + |
| 24 | +Status |
| 25 | +====== |
| 26 | + |
| 27 | +This Lua module is production ready. |
| 28 | + |
| 29 | +Synopsis |
| 30 | +======== |
| 31 | + |
| 32 | +```nginx |
| 33 | +server { |
| 34 | + listen 443 ssl; |
| 35 | + server_name test.com; |
| 36 | +
|
| 37 | + proxy_ssl_certificate_by_lua_block { |
| 38 | + local proxy_ssl = require "ngx.proxyssl" |
| 39 | +
|
| 40 | + local ver, err = proxy_ssl.get_tls1_version_str() |
| 41 | + if not ver then |
| 42 | + ngx.log(ngx.ERR, "failed to get TLS1 version: ", err) |
| 43 | + return |
| 44 | + end |
| 45 | + ngx.log(ngx.INFO, "got TLS1 version: ", ver) |
| 46 | + } |
| 47 | +
|
| 48 | + location / { |
| 49 | + root html; |
| 50 | + } |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +Description |
| 55 | +=========== |
| 56 | + |
| 57 | +This Lua module provides API functions to control the SSL handshake process in contexts like [proxy_ssl_certificate_by_lua*](https://github.com/openresty/lua-nginx-module/#proxy_ssl_certificate_by_lua_block) and [proxy_ssl_verify_by_lua*](https://github.com/openresty/lua-nginx-module/#proxy_ssl_verify_by_lua_block) (of the [ngx_lua](https://github.com/openresty/lua-nginx-module#readme) module). |
| 58 | + |
| 59 | +This Lua module only provides API functions that can be used in any upstream SSL context, so here we make it an independent module. |
| 60 | + |
| 61 | +To load the `ngx.proxyssl` module in Lua, just write |
| 62 | + |
| 63 | +```lua |
| 64 | +local proxy_ssl = require "ngx.proxyssl" |
| 65 | +``` |
| 66 | + |
| 67 | +[Back to TOC](#table-of-contents) |
| 68 | + |
| 69 | +Methods |
| 70 | +======= |
| 71 | + |
| 72 | +get_tls1_version |
| 73 | +---------------- |
| 74 | +**syntax:** *ver, err = proxy_ssl.get_tls1_version()* |
| 75 | + |
| 76 | +**context:** *any* |
| 77 | + |
| 78 | +It's the same as [ngx.ssl.get_tls1_version](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md#get_tls1_version), but for the current upstream SSL connection. |
| 79 | + |
| 80 | +This function can be called in any context where upstream https is used. |
| 81 | + |
| 82 | +[Back to TOC](#table-of-contents) |
| 83 | + |
| 84 | +get_tls1_version_str |
| 85 | +-------------------- |
| 86 | +**syntax:** *ver, err = proxy_ssl.get_tls1_version_str()* |
| 87 | + |
| 88 | +**context:** *any* |
| 89 | + |
| 90 | +It's the same as [ngx.ssl.get_tls1_version_str](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/ssl.md#get_tls1_version_str), but for the current upstream SSL connection. |
| 91 | + |
| 92 | +This function can be called in any context where upstream https is used. |
| 93 | + |
| 94 | +[Back to TOC](#table-of-contents) |
| 95 | + |
| 96 | +Community |
| 97 | +========= |
| 98 | + |
| 99 | +[Back to TOC](#table-of-contents) |
| 100 | + |
| 101 | +English Mailing List |
| 102 | +-------------------- |
| 103 | + |
| 104 | +The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. |
| 105 | + |
| 106 | +[Back to TOC](#table-of-contents) |
| 107 | + |
| 108 | +Chinese Mailing List |
| 109 | +-------------------- |
| 110 | + |
| 111 | +The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. |
| 112 | + |
| 113 | +[Back to TOC](#table-of-contents) |
| 114 | + |
| 115 | +Bugs and Patches |
| 116 | +================ |
| 117 | + |
| 118 | +Please report bugs or submit patches by |
| 119 | + |
| 120 | +1. creating a ticket on the [GitHub Issue Tracker](https://github.com/openresty/lua-resty-core/issues), |
| 121 | +2. or posting to the [OpenResty community](#community). |
| 122 | + |
| 123 | +[Back to TOC](#table-of-contents) |
| 124 | + |
| 125 | +Author |
| 126 | +====== |
| 127 | + |
| 128 | +Fuhong Ma <willmafh@hotmail.com> (willmafh) |
| 129 | + |
| 130 | +[Back to TOC](#table-of-contents) |
| 131 | + |
| 132 | +Copyright and License |
| 133 | +===================== |
| 134 | + |
| 135 | +This module is licensed under the BSD license. |
| 136 | + |
| 137 | +Copyright (C) 2015-2017, by Yichun "agentzh" Zhang, OpenResty Inc. |
| 138 | + |
| 139 | +All rights reserved. |
| 140 | + |
| 141 | +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
| 142 | + |
| 143 | +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
| 144 | + |
| 145 | +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. |
| 146 | + |
| 147 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 148 | + |
| 149 | +[Back to TOC](#table-of-contents) |
| 150 | + |
| 151 | +See Also |
| 152 | +======== |
| 153 | +* the ngx_lua module: https://github.com/openresty/lua-nginx-module |
| 154 | +* the [proxy_ssl_certificate_by_lua*](https://github.com/openresty/lua-nginx-module/#proxy_ssl_certificate_by_lua_block) directive. |
| 155 | +* the [proxy_ssl_verify_by_lua*](https://github.com/openresty/lua-nginx-module/#proxy_ssl_verify_by_lua_block) directive. |
| 156 | +* the [lua-resty-core](https://github.com/openresty/lua-resty-core) library. |
| 157 | +* OpenResty: https://openresty.org |
| 158 | + |
| 159 | +[Back to TOC](#table-of-contents) |
0 commit comments