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

feat(response-ratelimiting) redis ssl #8595

Merged
Merged
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions kong/plugins/response-ratelimiting/policies/init.lua
Original file line number Diff line number Diff line change
@@ -55,11 +55,19 @@ local function get_redis_connection(conf)
local red = redis:new()
red:set_timeout(conf.redis_timeout)

sock_opts.ssl = conf.redis_ssl
sock_opts.ssl_verify = conf.redis_ssl_verify
sock_opts.server_name = conf.redis_server_name

-- use a special pool name only if redis_database is set to non-zero
-- otherwise use the default pool name host:port
sock_opts.pool = conf.redis_database and
conf.redis_host .. ":" .. conf.redis_port ..
":" .. conf.redis_database
if conf.redis_database ~= 0 then
sock_opts.pool = fmt( "%s:%d;%d",
conf.redis_host,
conf.redis_port,
conf.redis_database)
end

local ok, err = red:connect(conf.redis_host, conf.redis_port,
sock_opts)
if not ok then
3 changes: 3 additions & 0 deletions kong/plugins/response-ratelimiting/schema.lua
Original file line number Diff line number Diff line change
@@ -75,6 +75,9 @@ return {
{ redis_port = typedefs.port({ default = 6379 }), },
{ redis_password = { type = "string", len_min = 0, referenceable = true }, },
{ redis_username = { type = "string", referenceable = true }, },
{ redis_ssl = { type = "boolean", required = true, default = false, }, },
{ redis_ssl_verify = { type = "boolean", required = true, default = false }, },
{ redis_server_name = typedefs.sni },
{ redis_timeout = { type = "number", default = 2000 }, },
{ redis_database = { type = "number", default = 0 }, },
{ block_on_first_violation = { type = "boolean", required = true, default = false }, },
Loading