-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(acme): allow to store account_key in keys and key_sets (#9746)
There is currently no way to configure an existing private key to be used for the acme plugin. If the account does not have a key in storage, then a new one is created. This is a problem when external account binding credentials have already been associated with a key elsewhere (e.g. cert-manager or cert-bot). Some issuers like ZeroSSL allow for EAB credentials to be reused and multiple accounts can be created with different private keys. Others like GCP Public CA only allow for EAB credentials to be associated with one key so when the plugin tries to create a new account with a new key it fails. The current workaround for this has been to manually insert the key in storage so a new key is not created. This PR exposes account_key and will use that if the account was not found in storage and the value of account_key is not nil. Otherwise, it will generate a key on the fly as it does currently.
- Loading branch information
Showing
5 changed files
with
257 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ describe("Plugin: acme (schema)", function() | |
}, | ||
---------------------------------------- | ||
{ | ||
name = "must accpet ToS for Let's Encrypt (unaccpeted,staging)", | ||
name = "must accept ToS for Let's Encrypt (unaccepted,staging)", | ||
input = { | ||
account_email = "[email protected]", | ||
api_uri = "https://acme-staging-v02.api.letsencrypt.org", | ||
|
@@ -43,7 +43,7 @@ describe("Plugin: acme (schema)", function() | |
}, | ||
---------------------------------------- | ||
{ | ||
name = "must accpet ToS for Let's Encrypt (unaccpeted)", | ||
name = "must accept ToS for Let's Encrypt (unaccepted)", | ||
input = { | ||
account_email = "[email protected]", | ||
api_uri = "https://acme-v02.api.letsencrypt.org", | ||
|
@@ -59,14 +59,36 @@ describe("Plugin: acme (schema)", function() | |
}, | ||
---------------------------------------- | ||
{ | ||
name = "must accpet ToS for Let's Encrypt (accepted)", | ||
name = "must accept ToS for Let's Encrypt (accepted)", | ||
input = { | ||
account_email = "[email protected]", | ||
api_uri = "https://acme-v02.api.letsencrypt.org", | ||
tos_accepted = true, | ||
}, | ||
}, | ||
---------------------------------------- | ||
{ | ||
name = "accepts valid account_key with key_set", | ||
input = { | ||
account_email = "[email protected]", | ||
api_uri = "https://api.acme.org", | ||
account_key = { | ||
key_id = "123", | ||
key_set = "my-key-set", | ||
} | ||
}, | ||
}, | ||
---------------------------------------- | ||
{ | ||
name = "accepts valid account_key without key_set", | ||
input = { | ||
account_email = "[email protected]", | ||
api_uri = "https://api.acme.org", | ||
account_key = { | ||
key_id = "123", | ||
} | ||
}, | ||
}, | ||
} | ||
|
||
for _, t in ipairs(tests) do | ||
|
@@ -80,4 +102,4 @@ describe("Plugin: acme (schema)", function() | |
end | ||
end) | ||
end | ||
end) | ||
end) |
f14d68a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:f14d68a9e8c2462cbf3ec830404a4da131d4a706
Artifacts available https://github.com/Kong/kong/actions/runs/4291740004