Skip to content

Commit e5baf04

Browse files
Doc about server certificate renewal
1 parent 436d3bc commit e5baf04

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Renew mutual TLS server certificate
2+
3+
As we mention in our document [creating-an-environment.md](./creating-an-environment.md), for mutual TLS authentication, we need to generate our own certificate authority (CA) for each environment.
4+
This means that while the CA itself has a long expiration date of 10 years, the server certificate will expire after **one** year by default.
5+
The same is true for the client certificate which we generate when we run the `generate.sh` script in our codebase.
6+
7+
When you need to renew the mutual TLS server certificate, you need to:
8+
9+
1. create a new certificate in Cloud Platform's Terraform in the `api-gateway.tf` file.
10+
11+
```terraform
12+
resource "aws_api_gateway_client_certificate" "api_gateway_client" {
13+
description = "Client certificate presented to the backend API expires 30/05/2025"
14+
}
15+
```
16+
17+
2. Then, you need to update the client_certificate_id's value in the aws_api_gateway_stage resource.
18+
19+
```terraform
20+
resource "aws_api_gateway_stage" "main" {
21+
deployment_id = aws_api_gateway_deployment.main.id
22+
rest_api_id = aws_api_gateway_rest_api.api_gateway.id
23+
stage_name = var.namespace
24+
client_certificate_id = aws_api_gateway_client_certificate.api_gateway_client.id
25+
}
26+
```
27+
28+
3. Then, go to the `kubernetes_secrets.tf` file and update the value of the client_certificate_auth secret using the newly generated certificate.
29+
30+
```terraform
31+
resource "kubernetes_secret" "client_certificate_auth" {
32+
metadata {
33+
name = "client-certificate-auth"
34+
namespace = var.namespace
35+
}
36+
37+
data = {
38+
"ca.crt" = aws_api_gateway_client_certificate.api_gateway_client.pem_encoded_certificate
39+
}
40+
}
41+
```

0 commit comments

Comments
 (0)