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

SPIFFE URI Considerations and options #2226

Closed
havetisyan opened this issue Jul 6, 2023 · 1 comment
Closed

SPIFFE URI Considerations and options #2226

havetisyan opened this issue Jul 6, 2023 · 1 comment

Comments

@havetisyan
Copy link
Collaborator

The Secure Production Identity Framework For Everyone (SPIFFE) Project defines a framework and set of standards for identifying and securing communications between application services.

SPIFFE spec recommends adding a unique identifier in the identity document.

In the case of Athenz, the identity document is a X.509 certificate and SPIFFE id is added in SanURI. Today ZTS adds a SPIFFE URI for service identity certificates and role certificates.

The current document is primarily concentrated on service identity certificates.

According to SPIFFE specification, SPIFFE URI takes a following format - spiffe://{trust_domain}/{path}

But SPIFFE specification does not mandate using a specific convention to represent identities.

Current convention adopted by Athenz:

  • Service identity certificate: spiffe://{athenz-domain}/sa/{athenz-service}
  • Role certificate: spiffe://{athenz-domain}/ra/{athenz-role}

The current SPIFFE naming convention satisfies the secure naming requirements, but the Istio community made a recommendation about the SPIFFE format involving using the trust domain of the SPIFFE URI.

Istio relies on the following format:

  • spiffe://{trust_domain}/ns/{namespace}/sa/{service-account}

Trust Domain Validation implementation in Istio rejects the requests from outside trust domains or if it's not in the TrustDomainAliases specified in the MeshConfig. So with the current convention, Istio service mesh would reject all requests coming from an Athenz service of a different domain than the target service’s Athenz domain, without further configuration.

To make using Istio service mesh simpler and easier, we can consider revising our SPIFFE trust domain convention.

According to the SPIFFE specification about trust domains, a trust domain represents a trust root of the system backed by cryptographic keys.

Recommended full SPIFFE URI format

Treat the company as a single trust domain - with a valid dns entry e.g. athenz.io

Service Certificates:
spiffe://{athenz-trust-domain}/ns/{namespace}/sa/{athenz-domain}.{athenz-service}

For non-k8s workloads (e.g. EC2 instances) use "default" as the namespace name

Some examples:

Domain Service Namespace SPIFFE URI
sports api N/A spiffe://athenz.io/ns/default/sa/sports.api
sports api sports spiffe://athenz.io/ns/sports/sa/sports.api
sports api prod spiffe://athenz.io/ns/prod/sa/sports.api
sports.k8s api N/A spiffe://athenz.io/ns/default/sa/sports.k8s.api
sports.k8s api sports-k8s spiffe://athenz.io/ns/sports-k8s/sa/sports.k8s.api
sports.k8s api prod spiffe://athenz.io/ns/prod/sa/sports.k8s.api
sports.k8s my-api N/A spiffe://athenz.io/ns/default/sa/sports.k8s.my-api
sports.k8s my-api sports-k8s spiffe://athenz.io/ns/sports-k8s/sa/sports.k8s.my-api
sports.k8s my-api prod spiffe://athenz.io/ns/prod/sa/sports.k8s.my-api
fan-sports.k8s my-api N/A spiffe://athenz.io/ns/default/sa/fan-sports.k8s.my-api
fan-sports.k8s my-api fan--sports-k8s spiffe://athenz.io/ns/fan--sports-k8s/fan-sports.k8s.my-api
fan-sports.k8s my-api prod spiffe://athenz.io/ns/prod/sa/fan-sports.k8s.my-api
@havetisyan
Copy link
Collaborator Author

#2228

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

No branches or pull requests

1 participant