question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

connaisseur+cosign on eks: add support for aws credentials

See original GitHub issue

k8s version: 1.20 flavor: eks

Goal:

Use connaisseur+cosign on eks to sign/validate images located in private ecr registry.

Problem statement:

At the moment connaisseur provides 2 methods to auth against a private registry: (https://github.com/sse-secure-systems/connaisseur/blob/master/helm/values.yaml#L82-L87)

  1. A secret containing the registry’s credentials (i.e. config.json)
  2. A username/password

Since docker doesn’t natively support ecr auth, in order to auth to ecr, one needs to use an aws helper: (https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html)

$ TOKEN=$(aws ecr get-login-password --region region)

This creates a temporary token valid for 12 hours, which you can then use to authenticate to ecr:

$ echo $TOKEN | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com

Creating a secret with the following information would unfortunately expire within 12h.

{
  "auths": {
    "aws_account_id.dkr.ecr.region.amazonaws.com": {
      "username": "AWS",
      "password": "<TOKEN>"
    }
  }
}

The solution I had to come up with as reported by @diegonicacio in https://github.com/sse-secure-systems/connaisseur/issues/352 was to create a cronjob, whose job is to rotate the ecr credentials inside the secret every x hours.

While this works, it’s a fragile solution, and it would be a more elegant solution if connaisseur was able to natively support AWS credentials:

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
ZacHaquecommented, Nov 10, 2021

I am tackling the situation the same way as @hsuchan doing, Running a job to run for the very first time then cronJob run job every x hours to refresh the token + replace all pods on the deployment. I also tired if irsa could help me out by giving connaisseur serviceaccount ecr permission but no luck. I will look forward if anyone have a better solution.

1reaction
hsuchancommented, Mar 4, 2022

@sf-jmarcou and @marckn0x I really appreciate the effort to add EKS credentials support to connaisseur.

@xopham I was able to test both:

  • the extra configuration in helm chart solution (i.e. refresher sidecar)
  • the “–k8s-keychain” flag feature solution

both solutions work great so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supply Chain Security on Amazon Elastic Kubernetes Service ...
In this post, we outlined how to integrate Cosign with AWS KMS. Then we ensured supply chain security is maintained using Kyverno ImageVerify ......
Read more >
How to secure Kubernetes deployment with signature ... - Sysdig
Cosign and Connaisseur allow us to secure the Kubernetes deployment with signature verification, ensures that our images do not change.
Read more >
تويتر \ التغريدات مع الردود بواسطة Kubernetes Community Days ...
KEDA is a single-purpose and lightweight component that can be added into any ... Today, Amazon Elastic Kubernetes Service (EKS) is one of...
Read more >
Software Supply Chain Security on Amazon EKS clusters ...
Nirmata delivers this blog post describing how to enable image verification capability with Kyverno and Cosign on Amazon EKS, ...
Read more >
Pop Punk to Pods, with David Pait – Kubernetes Podcast from ...
David Pait was a touring musician in pop punk band Sparks The Rescue. Now, he's an SRE working on Kubernetes at an ad-tech...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found