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

chore(plugins/acme) sync upstream features including Vault K8S auth an… #7647

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion kong/plugins/acme/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ local function new(conf)
" seconds for ACME challenges to propogate")
ngx.sleep(wait)
return true
end or nil
end or nil,
preferred_chain = conf.preferred_chain,
})
end

Expand Down
16 changes: 8 additions & 8 deletions kong/plugins/acme/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ local acme_challenge_path = [[^/\.well-known/acme-challenge/(.+)]]
-- cache for dummy cert kong generated (it's a table)
local default_cert_key

local LetsencryptHandler = {}
local ACMEHandler = {}

-- this has to be higher than auth plugins,
-- otherwise acme-challenges endpoints may be blocked by auth plugins
-- causing validation failures
LetsencryptHandler.PRIORITY = 1007
LetsencryptHandler.VERSION = "0.2.14"
ACMEHandler.PRIORITY = 1007
ACMEHandler.VERSION = "0.3.0"

local function build_domain_matcher(domains)
local domains_plain = {}
Expand Down Expand Up @@ -49,15 +49,15 @@ local function build_domain_matcher(domains)
end

-- expose it for use in api.lua
LetsencryptHandler.build_domain_matcher = build_domain_matcher
ACMEHandler.build_domain_matcher = build_domain_matcher

function LetsencryptHandler:init_worker()
function ACMEHandler:init_worker()
local worker_id = ngx.worker.id()
kong.log.info("acme renew timer started on worker ", worker_id)
ngx.timer.every(86400, client.renew_certificate)
end

function LetsencryptHandler:certificate(conf)
function ACMEHandler:certificate(conf)
-- we can't check for Host header in this phase
local host, err = ngx_ssl.server_name()
if err then
Expand Down Expand Up @@ -147,7 +147,7 @@ function LetsencryptHandler:certificate(conf)
end

-- access phase is to terminate the http-01 challenge request if necessary
function LetsencryptHandler:access(conf)
function ACMEHandler:access(conf)

local protocol = kong.client.get_protocol()

Expand Down Expand Up @@ -191,4 +191,4 @@ function LetsencryptHandler:access(conf)
end


return LetsencryptHandler
return ACMEHandler
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package = "kong-plugin-acme"
version = "0.2.14-1"
version = "0.3.0-1"
source = {
url = "git+https://github.com/Kong/kong-plugin-acme.git",
tag = "0.2.14",
tag = "0.3.0",
}
description = {
homepage = "https://github.com/Kong/kong-plugin-acme",
Expand All @@ -24,5 +24,5 @@ build = {
}
dependencies = {
--"kong >= 1.2.0",
"lua-resty-acme ~> 0.6"
"lua-resty-acme ~> 0.7"
}
8 changes: 8 additions & 0 deletions kong/plugins/acme/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ local VAULT_STORAGE_SCHEMA = {
{ token = { type = "string", }, },
{ tls_verify = { type = "boolean", default = true, }, },
{ tls_server_name = { type = "string" }, },
-- TODO: add default = "token", one_of = { "token", "kubernetes" } in 2.8 or 3.0
{ auth_method = { type = "string" } },
{ auth_path = { type = "string" }, },
{ auth_role = { type = "string" }, },
{ jwt_path = { type = "string" }, },
}

local schema = {
Expand Down Expand Up @@ -102,6 +107,9 @@ local schema = {
{ vault = { type = "record", fields = VAULT_STORAGE_SCHEMA, } },
},
}, },
{ preferred_chain = {
type = "string",
}, },
},
}, },
},
Expand Down