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

Doc about server certificate renewal #436

Merged
merged 1 commit into from
Jun 3, 2024
Merged
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
41 changes: 41 additions & 0 deletions docs/guides/renew-mutual-tls-server-certificate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Renew mutual TLS server certificate

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.
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.
The same is true for the client certificate which we generate when we run the `generate.sh` script in our codebase.

When you need to renew the mutual TLS server certificate, you need to:

1. create a new certificate in Cloud Platform's Terraform in the `api-gateway.tf` file.

```terraform
resource "aws_api_gateway_client_certificate" "api_gateway_client" {
description = "Client certificate presented to the backend API expires 30/05/2025"
}
```

2. Then, you need to update the client_certificate_id's value in the aws_api_gateway_stage resource.

```terraform
resource "aws_api_gateway_stage" "main" {
deployment_id = aws_api_gateway_deployment.main.id
rest_api_id = aws_api_gateway_rest_api.api_gateway.id
stage_name = var.namespace
client_certificate_id = aws_api_gateway_client_certificate.api_gateway_client.id
}
```

3. Then, go to the `kubernetes_secrets.tf` file and update the value of the client_certificate_auth secret using the newly generated certificate.

```terraform
resource "kubernetes_secret" "client_certificate_auth" {
metadata {
name = "client-certificate-auth"
namespace = var.namespace
}

data = {
"ca.crt" = aws_api_gateway_client_certificate.api_gateway_client.pem_encoded_certificate
}
}
```
Loading