mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 00:28:12 +00:00
Finish infra for sending raw ACME req, add tests for nonce
This commit is contained in:
@@ -4,3 +4,4 @@ Feature: Account
|
||||
Given I have an ACME cert profile as "acme_profile"
|
||||
When I have an ACME client connecting to {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/directory
|
||||
Then I register a new ACME account with email fangpen@infisical.com and EAB key id "{acme_profile.eab_kid}" with secret "{acme_profile.eab_secret}" as acme_account
|
||||
Then the value acme_account.uri with jq "." should match pattern {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/accounts/(.+)
|
||||
|
||||
@@ -3,7 +3,7 @@ Feature: ACME Cert Profile
|
||||
Scenario: Create a cert profile
|
||||
Given I make a random slug as profile_slug
|
||||
Given I use AUTH_TOKEN for authentication
|
||||
When I send a POST request to "/api/v1/pki/certificate-profiles" with JSON payload
|
||||
When I send a "POST" request to "/api/v1/pki/certificate-profiles" with JSON payload
|
||||
"""
|
||||
{
|
||||
"projectId": "{PROJECT_ID}",
|
||||
@@ -25,7 +25,7 @@ Feature: ACME Cert Profile
|
||||
Scenario: Reveal EAB secret
|
||||
Given I make a random slug as profile_slug
|
||||
Given I use AUTH_TOKEN for authentication
|
||||
When I send a POST request to "/api/v1/pki/certificate-profiles" with JSON payload
|
||||
When I send a "POST" request to "/api/v1/pki/certificate-profiles" with JSON payload
|
||||
"""
|
||||
{
|
||||
"projectId": "{PROJECT_ID}",
|
||||
@@ -39,7 +39,7 @@ Feature: ACME Cert Profile
|
||||
"""
|
||||
Then the value response.status_code should be equal to 200
|
||||
And I memorize response with jq ".certificateProfile.id" as profile_id
|
||||
When I send a GET request to "/api/v1/pki/certificate-profiles/{profile_id}/acme/eab-secret/reveal"
|
||||
When I send a "GET" request to "/api/v1/pki/certificate-profiles/{profile_id}/acme/eab-secret/reveal"
|
||||
Then the value response.status_code should be equal to 200
|
||||
Then the value response with jq ".eabKid" should be equal to "{profile_id}"
|
||||
Then the value response with jq ".eabSecret" should be present
|
||||
|
||||
@@ -3,7 +3,6 @@ Feature: Challenge
|
||||
Scenario: Validate challenge
|
||||
Given I have an ACME cert profile as "acme_profile"
|
||||
When I have an ACME client connecting to {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/directory
|
||||
# # TODO: make it I have an account already instead?
|
||||
Then I register a new ACME account with email fangpen@infisical.com and EAB key id "{acme_profile.eab_kid}" with secret "{acme_profile.eab_secret}" as acme_account
|
||||
When I create certificate signing request as csr
|
||||
Then I add names to certificate signing request csr
|
||||
@@ -20,4 +19,3 @@ Feature: Challenge
|
||||
Then I tell ACME server that challenge is ready to be verified
|
||||
Then I poll and finalize the ACME order order as finalized_order
|
||||
Then the value finalized_order.body with jq ".status" should be equal to "valid"
|
||||
# TODO: check the fullchain pem content of the order
|
||||
|
||||
@@ -2,7 +2,7 @@ Feature: Directory
|
||||
|
||||
Scenario: Get the directory of ACME service urls
|
||||
Given I have an ACME cert profile as "acme_profile"
|
||||
When I send a GET request to "/api/v1/pki/acme/profiles/{acme_profile.id}/directory"
|
||||
When I send a "GET" request to "/api/v1/pki/acme/profiles/{acme_profile.id}/directory"
|
||||
Then the response status code should be "200"
|
||||
Then the response body should match JSON value
|
||||
"""
|
||||
|
||||
@@ -2,6 +2,28 @@ Feature: Nonce
|
||||
|
||||
Scenario: Generate a new nonce
|
||||
Given I have an ACME cert profile as "acme_profile"
|
||||
When I send a HEAD request to "/api/v1/pki/acme/profiles/{acme_profile.id}/new-nonce"
|
||||
When I send a "HEAD" request to "/api/v1/pki/acme/profiles/{acme_profile.id}/new-nonce"
|
||||
Then the response status code should be "200"
|
||||
Then the response header "Replay-Nonce" should contains non-empty value
|
||||
|
||||
Scenario: Send bad nonce
|
||||
Given I have an ACME cert profile as "acme_profile"
|
||||
When I have an ACME client connecting to {BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/directory
|
||||
Then I register a new ACME account with email fangpen@infisical.com and EAB key id "{acme_profile.eab_kid}" with secret "{acme_profile.eab_secret}" as acme_account
|
||||
Then I memorize acme_account.uri with jq "capture("/(?<id>[^/]+)$") | .id" as account_id
|
||||
When I send a raw ACME request to "/api/v1/pki/acme/profiles/{acme_profile.id}/accounts/{account_id}/orders"
|
||||
"""
|
||||
{
|
||||
"protected": {
|
||||
"alg": "RS256",
|
||||
"nonce": "oFvnlFP1wIhRlYS2jTaXbA",
|
||||
"url": "{BASE_URL}/api/v1/pki/acme/profiles/{acme_profile.id}/accounts/{account_id}/orders",
|
||||
"kid": "{acme_account.uri}"
|
||||
},
|
||||
"payload": {}
|
||||
}
|
||||
"""
|
||||
Then the value response.status_code should be equal to 400
|
||||
Then the value response with jq ".type" should be equal to "urn:ietf:params:acme:error:badNonce"
|
||||
Then the value response with jq ".status" should be equal to 400
|
||||
Then the value response with jq ".detail" should be equal to "Invalid nonce"
|
||||
|
||||
Reference in New Issue
Block a user