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

Bindings to ngx_http_lua_ffi_balancer_set_ssl_ctx #179

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

james-callahan
Copy link
Contributor

@james-callahan james-callahan commented Mar 21, 2018

Depends on openresty/lua-nginx-module#1282

Here is an FFI snippet to create the most basic SSL_CTX* which is useful for testing (do not use for production traffic! it doesn't set expected security parameters):

local ffi = require "ffi"
ffi.cdef [[
	typedef struct ssl_method_st SSL_METHOD;
	typedef struct ssl_ctx_st SSL_CTX;
	const SSL_METHOD *TLS_client_method(void);
	SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
	void SSL_CTX_free(SSL_CTX *);
]]
local openssl = ffi.load "ssl"

local function new_ssl_ctx()
	local ssl_ctx = openssl.SSL_CTX_new(openssl.TLS_client_method())
	if ssl_ctx == ffi.NULL then
		error("no memory")
	end
	return ffi.gc(ssl_ctx, openssl.SSL_CTX_free)
end

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-resty-core project.

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.

1 participant