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

Implement mTLS resources for CloudWatch Agent client #163

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

musa-asad
Copy link
Collaborator

@musa-asad musa-asad commented Jan 20, 2025

Description of the issue

The Helm charts for the CloudWatch Agent do not include a server-side Certificate Authority, client certificate, and client key when the CloudWatch Agent behaves as a client for mutual TLS (mTLS). Without these mTLS resources, the agent cannot properly connect to the Target Allocator server, as it lacks the required certificates and keys to authenticate the mTLS connection.

Description of changes

  • Created server-side Certificate Authority in certmanager.yaml.
  • Created Secret in the certmanager.yaml containing the CloudWatch Agent client certificate, key, and CA certificate, for mutual TLS authentication.
  • Used genSignedCert to generate the CloudWatch Agent client certificate and key.
  • Created Secret containing the CloudWatch Agent client certificate and key, for use by the agent.
  • Added volume mount for the CloudWatch Agent client certificate and key in the custom resource.
  • Added volume for the CloudWatch Agent client certificate and key in the custom resource.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

  1. Created EKS cluster using custom agent (Add default TLS client cert and key paths for Prometheus input and receiver aws/amazon-cloudwatch-agent#1510), operator, and target allocator images (Implement mTLS resources and configuration for Target Allocator server aws/amazon-cloudwatch-agent-operator#284).
  2. Ran helm upgrade --install --debug amazon-cloudwatch-observability helm-charts/charts/amazon-cloudwatch-observability --set clusterName=<cluster_name> --set region=us-west-2 --namespace amazon-cloudwatch --create-namespace and edited values.yaml with a custom agent and prometheus configuration.

Secrets
Screenshot 2025-01-21 at 12 00 02 AM

Volumes
Screenshot 2025-01-21 at 12 01 53 AM

Volume Mounts
Screenshot 2025-01-21 at 12 02 27 AM

@musa-asad musa-asad changed the title Set up mTLS resources for the Amazon CloudWatch Agent client Implement mTLS for CloudWatch Agent client Jan 20, 2025
@musa-asad musa-asad changed the title Implement mTLS for CloudWatch Agent client Implement mTLS resources for CloudWatch Agent client Jan 20, 2025
metadata:
labels:
{{- include "amazon-cloudwatch-observability.labels" . | nindent 4 }}
name: "amazon-cloudwatch-observability-agent-outbound-cert"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why we can't use "amazon-cloudwatch-observability-agent-cert" ?

I see that we specify the target allocator service as a dns name we can make calls to?

Are we using this outbound cert specifically for target allocator?

Copy link
Collaborator Author

@musa-asad musa-asad Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do use "amazon-cloudwatch-observability-agent-cert" for the server cert and key for the TA server: https://github.com/aws/amazon-cloudwatch-agent-operator/blob/d6c5c6d9aa983222ac3557fe1c3bb2c367fff615/internal/manifests/targetallocator/volume.go#L47.

The "amazon-cloudwatch-observability-agent-outbound-cert" is for the client cert and key for the agent client. We could technically use "amazon-cloudwatch-observability-agent-server-cert", but I avoided doing so due to separation of concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants