Skip to content

Commit

Permalink
redis - add REDIS_SSL_VERIFY setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0ppy-d1sk committed Jan 16, 2024
1 parent 5545094 commit f38f775
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bw/lua/bunkerweb/clusterstore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function clusterstore:initialize(pool)
["REDIS_PORT"] = "",
["REDIS_DATABASE"] = "",
["REDIS_SSL"] = "",
["REDIS_SSL_VERIFY"] = "",
["REDIS_TIMEOUT"] = "",
["REDIS_KEEPALIVE_IDLE"] = "",
["REDIS_KEEPALIVE_POOL"] = "",
Expand Down Expand Up @@ -57,6 +58,7 @@ function clusterstore:initialize(pool)
keepalive_poolsize = tonumber(self.variables["REDIS_KEEPALIVE_POOL"]),
connection_options = {
ssl = self.variables["REDIS_SSL"] == "yes",
ssl_verify = self.variables["REDIS_SSL_VERIFY"] == "yes",
},
host = self.variables["REDIS_HOST"],
port = tonumber(self.variables["REDIS_PORT"]),
Expand Down
9 changes: 9 additions & 0 deletions src/common/core/redis/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@
"regex": "^(yes|no)$",
"type": "check"
},
"REDIS_SSL_VERIFY": {
"context": "global",
"default": "no",
"help": "Verify the certificate of Redis server.",
"id": "redis-ssl-verify",
"label": "Redis SSL/TLS verify",
"regex": "^(yes|no)$",
"type": "check"
},
"REDIS_TIMEOUT": {
"context": "global",
"default": "1000",
Expand Down
2 changes: 2 additions & 0 deletions src/common/core/sessions/sessions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function sessions:init()
["REDIS_PORT"] = "",
["REDIS_DATABASE"] = "",
["REDIS_SSL"] = "",
["REDIS_SSL_VERIFY"] = "",
["REDIS_TIMEOUT"] = "",
["REDIS_KEEPALIVE_IDLE"] = "",
["REDIS_KEEPALIVE_POOL"] = "",
Expand Down Expand Up @@ -124,6 +125,7 @@ function sessions:init()
pool = "bw-redis",
pool_size = tonumber(redis_vars["REDIS_KEEPALIVE_POOL"]),
ssl = redis_vars["REDIS_SSL"] == "yes",
ssl_verify = redis_vars["REDIS_SSL_VERIFY"] == "yes",
database = tonumber(redis_vars["REDIS_DATABASE"]),
}
if redis_vars["REDIS_SENTINEL_HOSTS"] ~= nil then
Expand Down

0 comments on commit f38f775

Please sign in to comment.