-
Notifications
You must be signed in to change notification settings - Fork 565
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
feat: add ambient credential detection with spiffe/spire #1220
Conversation
4a09ef9
to
7f5bece
Compare
0ab1732
to
913b498
Compare
@dlorenc we got the following error: $ COSIGN_EXPERIMENTAL=1 ./cosign sign devopps/nginx:latest
Generating ephemeral keys...
JWT: eyJhbGciOiJFUzI1NiIsImtpZCI6IlN4R0FidWNaa3dtRFkyODFxRkt0VFFjUmhiWGd0Ylk5IiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5NjAwMTI1LCJpYXQiOjE2Mzk1OTk4MjUsInN1YiI6InNwaWZmZTovL2V4YW1wbGUub3JnL215c2VydmljZTIifQ.wQdHjEAcO6fn1WIv7fPLjRriahfhZx0sNDEW5BKOWj6Vl7CiL9awflFvb_VgHvWDjoTQYHFmnqH2ymC8bHpDgg
Retrieving signed certificate...
Error: signing [devopps/nginx:latest]: getting signer: getting key from Fulcio: retrieving cert: {"code":400,"message":"unsupported issuer: "}
main.go:46: error during command execution: signing [devopps/nginx:latest]: getting signer: getting key from Fulcio: retrieving cert: {"code":400,"message":"unsupported issuer: "}
$ jwt eyJhbGciOiJFUzI1NiIsImtpZCI6IlN4R0FidWNaa3dtRFkyODFxRkt0VFFjUmhiWGd0Ylk5IiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5NjAwMTI1LCJpYXQiOjE2Mzk1OTk4MjUsInN1YiI6InNwaWZmZTovL2V4YW1wbGUub3JnL215c2VydmljZTIifQ.wQdHjEAcO6fn1WIv7fPLjRriahfhZx0sNDEW5BKOWj6Vl7CiL9awflFvb_VgHvWDjoTQYHFmnqH2ymC8bHpDgg
To verify on jwt.io:
https://jwt.io/#id_token=eyJhbGciOiJFUzI1NiIsImtpZCI6IlN4R0FidWNaa3dtRFkyODFxRkt0VFFjUmhiWGd0Ylk5IiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5NjAwMTI1LCJpYXQiOjE2Mzk1OTk4MjUsInN1YiI6InNwaWZmZTovL2V4YW1wbGUub3JnL215c2VydmljZTIifQ.wQdHjEAcO6fn1WIv7fPLjRriahfhZx0sNDEW5BKOWj6Vl7CiL9awflFvb_VgHvWDjoTQYHFmnqH2ymC8bHpDgg
✻ Header
{
"alg": "ES256",
"kid": "SxGAbucZkwmDY281qFKtTQcRhbXgtbY9",
"typ": "JWT"
}
✻ Payload
{
"aud": [
"sigstore"
],
"exp": 1639600125,
"iat": 1639599825,
"sub": "spiffe://example.org/myservice2"
}
Issued At: 1639599825 12/15/2021, 11:23:45 PM
Expiration Time: 1639600125 12/15/2021, 11:28:45 PM
✻ Signature wQdHjEAcO6fn1WIv7fPLjRriahfhZx0sNDEW5BKOWj6Vl7CiL9awflFvb_VgHvWDjoTQYHFmnqH2ymC8bHpDgg
I think the reason why we got this error above is that we do not have an |
Are you saying SPIRE is not setting the ISS claim? It seems like it should. |
I'm wondering about the trust model. Instead of SPIRE->JWT->Fulcio->x.509->Sign Blob->Sig Store |
I followed up the demo: Quickstart for Linux and MacOS X, and couldn't find any |
I'm not sure. It looks like it should get set based on the spire code. @evan2645 |
This will only work if the SPIFFE domain used to grant the IDs is setup in the fulcio federation config. See here for an example: https://github.com/sigstore/fulcio/tree/main/federation/external/oidc.dlorenc.dev |
This will work but the certs expire each day - so going over the fulcio path allows you to get a cert that's setup for timestamping/transparency logging. |
Looks like a lint issue, overall seems correct but we'll need to figure out a testing story too probably at some point. |
The value of the issuer claim is configurable and set via It should be set to a URL that can be used to reach your OIDC discovery provider. |
913b498
to
aa70407
Compare
…igstore#1234) Signed-off-by: Carlos Panato <ctadeu@gmail.com> Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Furkan <furkan.turkal@trendyol.com> Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com>
aa70407
to
39d6cfe
Compare
kindly ping @dlorenc, which URL should I use to test this? I saw the $ COSIGN_EXPERIMENTAL=1 ./cosign sign devopps/nginx:latest
Generating ephemeral keys...
Retrieving signed certificate...
Error: signing [devopps/nginx:latest]: getting signer: getting key from Fulcio: retrieving cert: {"code":400,"message":"unsupported issuer: fulcio.sigstore.dev"}
main.go:46: error during command execution: signing [devopps/nginx:latest]: getting signer: getting key from Fulcio: retrieving cert: {"code":400,"message":"unsupported issuer: fulcio.sigstore.dev"} $ bin/spire-agent api fetch jwt -audience sigstore
token(spiffe://example.org/myservice): eyJhbGciOiJFUzI1NiIsImtpZCI6IkpWRkhsc2o5eUFvR2dVOGxzakJibTJpbks5NmpodExmIiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5OTk1MDE4LCJpYXQiOjE2Mzk5OTQ3MTgsImlzcyI6ImZ1bGNpby5zaWdzdG9yZS5kZXYiLCJzdWIiOiJzcGlmZmU6Ly9leGFtcGxlLm9yZy9teXNlcnZpY2UifQ.q_D8_1qU6v_ReN4pevkZSNi2aijKwmZewdFQI8C7Cdum9Z_8BKdkkhWNLDb-_l3PTvhSXTjP66KAvN11o0JdYw
$ jwt eyJhbGciOiJFUzI1NiIsImtpZCI6IkpWRkhsc2o5eUFvR2dVOGxzakJibTJpbks5NmpodExmIiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5OTk1MDE4LCJpYXQiOjE2Mzk5OTQ3MTgsImlzcyI6ImZ1bGNpby5zaWdzdG9yZS5kZXYiLCJzdWIiOiJzcGlmZmU6Ly9leGFtcGxlLm9yZy9teXNlcnZpY2UifQ.q_D8_1qU6v_ReN4pevkZSNi2aijKwmZewdFQI8C7Cdum9Z_8BKdkkhWNLDb-_l3PTvhSXTjP66KAvN11o0JdYw
To verify on jwt.io:
https://jwt.io/#id_token=eyJhbGciOiJFUzI1NiIsImtpZCI6IkpWRkhsc2o5eUFvR2dVOGxzakJibTJpbks5NmpodExmIiwidHlwIjoiSldUIn0.eyJhdWQiOlsic2lnc3RvcmUiXSwiZXhwIjoxNjM5OTk1MDE4LCJpYXQiOjE2Mzk5OTQ3MTgsImlzcyI6ImZ1bGNpby5zaWdzdG9yZS5kZXYiLCJzdWIiOiJzcGlmZmU6Ly9leGFtcGxlLm9yZy9teXNlcnZpY2UifQ.q_D8_1qU6v_ReN4pevkZSNi2aijKwmZewdFQI8C7Cdum9Z_8BKdkkhWNLDb-_l3PTvhSXTjP66KAvN11o0JdYw
✻ Header
{
"alg": "ES256",
"kid": "JVFHlsj9yAoGgU8lsjBbm2inK96jhtLf",
"typ": "JWT"
}
✻ Payload
{
"aud": [
"sigstore"
],
"exp": 1639995018,
"iat": 1639994718,
"iss": "fulcio.sigstore.dev", # here !
"sub": "spiffe://example.org/myservice"
}
Issued At: 1639994718 12/20/2021, 1:05:18 PM
Expiration Time: 1639995018 12/20/2021, 1:10:18 PM
✻ Signature q_D8_1qU6v_ReN4pevkZSNi2aijKwmZewdFQI8C7Cdum9Z_8BKdkkhWNLDb-_l3PTvhSXTjP66KAvN11o0JdYw |
This LGTM. Not sure if @dlorenc has anything else? |
https://build.opensuse.org/request/show/949015 by user msmeissn + dimstar_suse - updated to 1.5.0 ## Highlights * enable sbom generation when releasing (sigstore/cosign#1261) * feat: log error to stderr (sigstore/cosign#1260) * feat: support attach attestation (sigstore/cosign#1253) * feat: resolve --cert from URL (sigstore/cosign#1245) * feat: generate/upload sbom for cosign projects (sigstore/cosign#1237) * feat: vuln attest support (sigstore/cosign#1168) * feat: add ambient credential detection with spiffe/spire (sigstore/cosign#1220) * feat: generate/upload sbom for cosign projects (sigstore/cosign#1236) * feat: implement cosign download attestation (https
Signed-off-by: Batuhan Apaydın batuhan.apaydin@trendyol.com
Co-authored-by: Furkan Türkal furkan.turkal@trendyol.com
Summary
Support ambient credential detection with SPIFFE/SPIRE by looking at socket path and through SVID (Spiffe Verifiable Identity Document)
Ticket Link
Fixes #645
Release Note