mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
* feat(acm): add certificate revocation, renewal, options and email resend Adds RevokeCertificate, RenewCertificate, UpdateCertificateOptions and ResendValidationEmail, with a RevocationReason enum modelling the accepted values. Limitations documented in docs/services/acm.md. * test(acm): stop asserting global-empty state in the pagination filter test Other classes sharing the full-suite JVM revoke certificates of their own, so a REVOKED filter is not globally empty. Assert instead that none of this class's own certificates appear, which is what the test is actually about. * feat(acm): add ResendValidationEmail and certificate revocation reasons * fix(acm): validate Domain/ValidationDomain on ResendValidationEmail Domain and ValidationDomain were accepted verbatim after a null/blank check, so any value round-tripped as 200 OK - a client could resend against an unrelated domain and get success back. Domain must now match the certificate's DomainName or one of its SubjectAlternativeNames, and ValidationDomain must equal Domain or be one of its superdomains, matching botocore's InvalidDomainValidationOptionsException semantics for this operation. Also drops the now-unneeded manual UTF-8 byte encoding in the resend test now that RestAssuredJsonUtils configures the AWS content types. * fix(acm): require Options.Export=ENABLED to revoke a certificate revokeCertificate gated on Certificate.canExport(), which returns true for any PRIVATE or IMPORTED certificate regardless of its Export option - so an imported certificate with Export left at the default DISABLED could still be revoked, bypassing the export-enabled guard the operation is meant to enforce. Check Options.Export directly instead. * fix(acm): use ValidationException for a not-export-enabled revoke RevokeCertificate's own modeled Errors list is AccessDeniedException, ConflictException, InvalidArnException, ResourceInUseException, ResourceNotFoundException, ThrottlingException, and ValidationException. InvalidStateException isn't among them - it's modeled on UpdateCertificateOptions instead, which is likely where it got picked up from. ValidationException is the operation's own general "input failed to satisfy constraints" code, and the better fit here.
4.5 KiB
4.5 KiB
ACM
Protocol: JSON 1.1 (X-Amz-Target: CertificateManager.*)
Endpoint: POST http://localhost:4566/
Supported Actions
| Action | Description |
|---|---|
RequestCertificate |
Request a new certificate (auto-issued for emulation) |
DescribeCertificate |
Get certificate details and validation status |
GetCertificate |
Retrieve the certificate and chain in PEM format |
ListCertificates |
List all certificates with optional status filtering |
DeleteCertificate |
Delete a certificate |
ImportCertificate |
- |
ExportCertificate |
Export certificate with encrypted private key (PRIVATE type only) |
AddTagsToCertificate |
Add tags to a certificate |
ListTagsForCertificate |
List tags for a certificate |
RemoveTagsFromCertificate |
Remove tags from a certificate |
GetAccountConfiguration |
Get account-level ACM settings |
PutAccountConfiguration |
Update account-level ACM settings |
UpdateCertificateOptions |
- |
RevokeCertificate |
- |
RenewCertificate |
- |
ResendValidationEmail |
- |
Emulation Behavior
- Auto-Issuance: All requested certificates are immediately issued with status
ISSUED(no DNS/email validation required) - Real Cryptography: Certificates are generated with real RSA/EC keys and valid X.509 structure
- Key Algorithms: Supports
RSA_2048,RSA_3072,RSA_4096,EC_prime256v1,EC_secp384r1,EC_secp521r1 - Certificate Types:
AMAZON_ISSUED(default) andPRIVATE(whenCertificateAuthorityArnis provided) - Export: Only
PRIVATEtype certificates can be exported with their private key
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_ACM_ENABLED |
true |
Enable or disable the service |
FLOCI_SERVICES_ACM_VALIDATION_WAIT_SECONDS |
0 |
Seconds to wait before transitioning a certificate from PENDING_VALIDATION to ISSUED (0 = immediate) |
Examples
export AWS_ENDPOINT_URL=http://localhost:4566
# Request a certificate
CERT_ARN=$(aws acm request-certificate \
--domain-name "example.com" \
--subject-alternative-names "www.example.com" "*.example.com" \
--validation-method DNS \
--query CertificateArn --output text \
--endpoint-url $AWS_ENDPOINT_URL)
# Describe the certificate
aws acm describe-certificate \
--certificate-arn $CERT_ARN \
--endpoint-url $AWS_ENDPOINT_URL
# Get certificate in PEM format
aws acm get-certificate \
--certificate-arn $CERT_ARN \
--endpoint-url $AWS_ENDPOINT_URL
# List all certificates
aws acm list-certificates \
--endpoint-url $AWS_ENDPOINT_URL
# List only issued certificates
aws acm list-certificates \
--certificate-statuses ISSUED \
--endpoint-url $AWS_ENDPOINT_URL
# Add tags
aws acm add-tags-to-certificate \
--certificate-arn $CERT_ARN \
--tags Key=Environment,Value=Production Key=Project,Value=Demo \
--endpoint-url $AWS_ENDPOINT_URL
# List tags
aws acm list-tags-for-certificate \
--certificate-arn $CERT_ARN \
--endpoint-url $AWS_ENDPOINT_URL
# Request a private certificate (exportable)
PRIVATE_ARN=$(aws acm request-certificate \
--domain-name "internal.example.com" \
--certificate-authority-arn "arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012" \
--query CertificateArn --output text \
--endpoint-url $AWS_ENDPOINT_URL)
# Export private certificate (passphrase must be base64-encoded, min 4 chars)
PASSPHRASE=$(echo -n "mypassphrase123" | base64)
aws acm export-certificate \
--certificate-arn $PRIVATE_ARN \
--passphrase $PASSPHRASE \
--endpoint-url $AWS_ENDPOINT_URL
# Delete a certificate
aws acm delete-certificate \
--certificate-arn $CERT_ARN \
--endpoint-url $AWS_ENDPOINT_URL
SDK Example (Java)
AcmClient acm = AcmClient.builder()
.endpointOverride(URI.create("http://localhost:4566"))
.region(Region.US_EAST_1)
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create("test", "test")))
.build();
// Request a certificate
RequestCertificateResponse response = acm.requestCertificate(req -> req
.domainName("example.com")
.subjectAlternativeNames("www.example.com", "*.example.com")
.validationMethod(ValidationMethod.DNS));
String certArn = response.certificateArn();
// Describe the certificate
DescribeCertificateResponse desc = acm.describeCertificate(req -> req
.certificateArn(certArn));
System.out.println("Status: " + desc.certificate().status());