From a8733c8dc90e65c7adf08c314df5308a64dae1ca Mon Sep 17 00:00:00 2001 From: Ming Guo Date: Tue, 6 Oct 2026 04:37:35 +0000 Subject: [PATCH 1/2] Document GCP KMS managed keys for signed pipelines The agent has supported --signing-gcp-kms-key on agent start, pipeline upload, and tool sign since v3.121.0 (buildkite/agent#3660), but the signed pipelines page only covered AWS KMS. Add a GCP KMS section mirroring the AWS KMS structure: key creation, agent configuration, signing static steps, IAM permissions, and rotation. Also remove a stale bullet from the AWS KMS "Sign all steps" section that doesn't match the command above it. A-2027 Amp-Thread-ID: https://ampcode.com/threads/T-01a10f73-0a6f-727d-a4f5-1e90dc3404c7 Co-authored-by: Amp --- data/llm_descriptions.yml | 2 +- .../self_hosted/security/signed_pipelines.md | 149 +++++++++++++++++- 2 files changed, 146 insertions(+), 5 deletions(-) diff --git a/data/llm_descriptions.yml b/data/llm_descriptions.yml index ec249d851fe..92590eb775c 100644 --- a/data/llm_descriptions.yml +++ b/data/llm_descriptions.yml @@ -245,7 +245,7 @@ agent/self-hosted/monitoring-and-observability: "Agent health checks, HTTP status endpoints, and Prometheus metrics for monitoring self-hosted agents." agent/self-hosted/monitoring-and-observability/tracing: "Setting up distributed tracing for the Buildkite agent using Datadog APM or OpenTelemetry." agent/self-hosted/security: "Security hardening for self-hosted agents: secrets storage, SSH keyscan, command evaluation, plugin controls." - agent/self-hosted/security/signed-pipelines: "Cryptographically signing pipeline uploads and verifying signatures before job execution using JWKS keys." + agent/self-hosted/security/signed-pipelines: "Cryptographically signing pipeline uploads and verifying signatures before job execution using JWKS keys, AWS KMS, or GCP KMS." agent/self-hosted/security/network-requirements: "Network requirements for self-hosted agents, which only make outbound HTTPS connections with no inbound ports. Lists required hosts (such as agent-edge.buildkite.com and buildkiteartifacts.com), optional hosts including customer-managed artifact storage, hosts your build jobs may need, and Buildkite platform egress IPs." agent/self-hosted/versions-directory: "Complete directory of stable Buildkite agent releases grouped by minor version from 2.x through the 3.120-3.129 range, listing each release with its date and any known issues, to help you identify the right version to install or upgrade to." agent/self-hosted/versions-directory/upgrading-from-3-dot-0-beta-and-v2: "Upgrading agents from 3.0-beta or 2.x to stable 3.x versions, with migration steps and changelog." diff --git a/pages/agent/self_hosted/security/signed_pipelines.md b/pages/agent/self_hosted/security/signed_pipelines.md index 3fd099fe351..ef26088ea21 100644 --- a/pages/agent/self_hosted/security/signed_pipelines.md +++ b/pages/agent/self_hosted/security/signed_pipelines.md @@ -42,10 +42,11 @@ The following fields are included in the signature for each step: You'll need to configure your agents and update pipeline definitions to enable signed pipelines. -Behind the scenes, signed pipelines use [JSON Web Signing (JWS)](https://datatracker.ietf.org/doc/html/rfc7797) to generate signatures. There are two options for creation of keys used with JWS, these are: +Behind the scenes, signed pipelines use [JSON Web Signing (JWS)](https://datatracker.ietf.org/doc/html/rfc7797) to generate signatures. There are three options for creation of keys used with JWS, these are: -- Self managed key pairs -- AWS KMS managed keys +- [Self-managed key pairs](#self-managed-key-creation) +- [AWS KMS managed keys](#aws-kms-managed-key-setup) +- [GCP KMS managed keys](#gcp-kms-managed-key-setup) ## Self-managed key creation @@ -223,7 +224,6 @@ buildkite-agent tool sign \ Replacing the following: - `` with a Buildkite GraphQL token that has the `write_pipelines` scope. -- `` with the path to the private key set you generated earlier. - `` with the AWS KMS key ID or alias created earlier. - `` with the slug of the organization the pipeline is in. - `` with the slug of the pipeline you want to sign. @@ -242,3 +242,144 @@ For agents which only verify pipelines the following IAM Actions are required. - kms:Verify - kms:GetPublicKey + +## GCP KMS managed key setup + +Google Cloud Key Management Service (GCP KMS) securely protects cryptographic keys. When using this service with signed pipelines, the agent never has access to the private key used to sign pipelines. Signing requests are sent to the GCP KMS API, and the agent downloads only the public key to verify signatures locally. + +GCP KMS support for signed pipelines requires Buildkite agent version 3.121.0 or later. + +### Step 1: Create a KMS key + +GCP KMS has many options when creating keys. For pipeline signing, the key must use the following settings: + +1. The key purpose must be asymmetric signing (`ASYMMETRIC_SIGN`). +1. The key algorithm must be one of the supported key algorithms listed below. The `EC_SIGN_P256_SHA256` algorithm is recommended. + +If you're using the Google Cloud CLI, the key ring and key can be created as follows: + +```bash +gcloud kms keyrings create example-keyring --location global + +gcloud kms keys create example-signing-key \ + --keyring example-keyring \ + --location global \ + --purpose asymmetric-signing \ + --default-algorithm ec-sign-p256-sha256 +``` + +Unlike AWS KMS, the agent identifies a GCP KMS key by the full resource name of a specific _key version_, in the format: + +```text +projects//locations//keyRings//cryptoKeys//cryptoKeyVersions/ +``` + +For example, the first version of the key created above has the resource name `projects/example-project/locations/global/keyRings/example-keyring/cryptoKeys/example-signing-key/cryptoKeyVersions/1`. To list the versions of a key and their resource names, run: + +```bash +gcloud kms keys versions list \ + --key example-signing-key \ + --keyring example-keyring \ + --location global +``` + +#### Supported key algorithms + +The agent reads the algorithm from the key version and selects the matching JWS algorithm for signatures. The following GCP KMS algorithms are supported: + +GCP KMS algorithm | JWS algorithm +------------------------------ | ------------- +`EC_SIGN_P256_SHA256` | `ES256` +`EC_SIGN_P384_SHA384` | `ES384` +`RSA_SIGN_PSS_2048_SHA256` | `PS256` +`RSA_SIGN_PSS_3072_SHA256` | `PS256` +`RSA_SIGN_PSS_4096_SHA256` | `PS256` +`RSA_SIGN_PSS_4096_SHA512` | `PS512` +`RSA_SIGN_PKCS1_2048_SHA256` | `RS256` +`RSA_SIGN_PKCS1_3072_SHA256` | `RS256` +`RSA_SIGN_PKCS1_4096_SHA256` | `RS256` +`RSA_SIGN_PKCS1_4096_SHA512` | `RS512` +{: class="two-column"} + +The agent refuses to start if the key version uses any other algorithm. + +### Step 2: Configure the agents + +Next, you need to configure your agents to use the KMS key version you created. On agents that upload pipelines, add the following to the agent's config file: + +```ini +signing-gcp-kms-key= +``` + +Replace `` with the full resource name of the key version from the previous step. You can also set this value using the `BUILDKITE_AGENT_SIGNING_GCP_KMS_KEY` environment variable or the `--signing-gcp-kms-key` flag on `buildkite-agent start`. + +This ensures that whenever those agents upload steps to Buildkite, they'll generate signatures using the private key held in GCP KMS. It also ensures that those agents verify the signatures of any steps they run, using the public key of the same key version. + +The agent authenticates to GCP KMS using [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials). On Compute Engine or GKE, this is usually the service account attached to the instance or workload. Elsewhere, set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of a service account key file. + +```ini +verification-failure-behavior= +``` + +This setting determines the Buildkite agent's response when it receives a job without a proper signature, and also specifies how strictly the agent should enforce signature verification for incoming jobs. The agent will warn about missing or invalid signatures, but will still proceed to execute the job. If not explicitly specified, the default behavior is `block`, which prevents any job without a valid signature from running, ensuring a secure pipeline environment by default. + +On agents that only verify jobs, add the same `signing-gcp-kms-key` setting. These agents only need permission to read the public key, as described in [Step 4](#gcp-kms-managed-key-setup-step-4-assign-iam-permissions-to-your-agents). + +### Step 3: Sign all steps + +To sign steps configured in the Pipeline Settings page, you need to add static signatures to the YAML. To do this, run: + +```sh +buildkite-agent tool sign \ + --graphql-token \ + --signing-gcp-kms-key \ + --organization-slug \ + --pipeline-slug \ + --update +``` + +Replacing the following: + +- `` with a Buildkite GraphQL token that has the `write_pipelines` scope. +- `` with the full resource name of the GCP KMS key version created earlier. +- `` with the slug of the organization the pipeline is in. +- `` with the slug of the pipeline you want to sign. + +The `buildkite-agent tool sign` and `buildkite-agent pipeline upload` commands also read the key version resource name from the `BUILDKITE_AGENT_GCP_KMS_KEY` environment variable. + +### Step 4: Assign IAM permissions to your agents + +There are two common roles for agents when using signed pipelines, these being those that sign and upload pipelines, and those that verify steps. To follow least privilege best practice, grant each group of agents only the IAM permissions it needs on the KMS key. + +For agents which sign and verify pipelines, the following permissions are required: + +- `cloudkms.cryptoKeyVersions.useToSign` +- `cloudkms.cryptoKeyVersions.viewPublicKey` + +The predefined `roles/cloudkms.signerVerifier` role includes both permissions. The `roles/cloudkms.signer` role alone is not enough, because the agent fetches the public key when it starts. + +For agents which only verify pipelines, the following permission is required: + +- `cloudkms.cryptoKeyVersions.viewPublicKey` + +The predefined `roles/cloudkms.publicKeyViewer` role includes this permission. Verification happens locally on the agent using the public key, so verifying agents don't call the GCP KMS sign or verify operations. + +For example, to grant a service account permission to sign and verify using the key created earlier, run: + +```bash +gcloud kms keys add-iam-policy-binding example-signing-key \ + --keyring example-keyring \ + --location global \ + --member serviceAccount:buildkite-uploader@example-project.iam.gserviceaccount.com \ + --role roles/cloudkms.signerVerifier +``` + +### Rotating GCP KMS keys + +Because the agent is configured with a specific key version, creating a new key version in GCP KMS does not change which key the agents use. To rotate to a new key version: + +1. Create a new key version in GCP KMS. +1. Update `signing-gcp-kms-key` on your signing and verifying agents to the new key version resource name, and restart them. +1. Re-sign any static steps configured in the Pipeline Settings page using the new key version, as described in [Step 3](#gcp-kms-managed-key-setup-step-3-sign-all-steps). + +Each agent trusts only the public key of the key version it is configured with. Until every agent has been updated, jobs signed with one key version are rejected by agents configured with the other. To avoid failed jobs, rotate keys during a maintenance window, or temporarily set `verification-failure-behavior=warn` on verifying agents while the rollout completes. From 4dd8c35480717b84b628f6edd4a8d13737fb9ab4 Mon Sep 17 00:00:00 2001 From: Ming Guo Date: Tue, 6 Oct 2026 04:44:19 +0000 Subject: [PATCH 2/2] Add agent version caveat for non-P256 GCP KMS algorithms and fix verification-failure-behavior placeholder Agent versions before 3.136.0 (go-pipeline < 0.18.0) verify KMS signatures as ES256 regardless of the key's algorithm, so only EC_SIGN_P256_SHA256 keys work there. Also replace the literal placeholder, which the config parser keeps as-is and the job runner rejects, with warn in all three sections. Amp-Thread-ID: https://ampcode.com/threads/T-01a10f73-0a6f-727d-a4f5-1e90dc3404c7 Co-authored-by: Amp --- pages/agent/self_hosted/security/signed_pipelines.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pages/agent/self_hosted/security/signed_pipelines.md b/pages/agent/self_hosted/security/signed_pipelines.md index ef26088ea21..3e16b6a41ea 100644 --- a/pages/agent/self_hosted/security/signed_pipelines.md +++ b/pages/agent/self_hosted/security/signed_pipelines.md @@ -113,7 +113,7 @@ verification-jwks-file= This ensures that whenever those agents upload steps to Buildkite, they'll generate signatures using the private key you generated earlier. It also ensures that those agents verify the signatures of any steps they run, using the public key. ```ini -verification-failure-behavior= +verification-failure-behavior=warn ``` This setting determines the Buildkite agent's response when it receives a job without a proper signature, and also specifies how strictly the agent should enforce signature verification for incoming jobs. The agent will warn about missing or invalid signatures, but will still proceed to execute the job. If not explicitly specified, the default behavior is `block`, which prevents any job without a valid signature from running, ensuring a secure pipeline environment by default. @@ -203,7 +203,7 @@ signing-aws-kms-key= This ensures that whenever those agents upload steps to Buildkite, they'll generate signatures using the private key you generated earlier. It also ensures that those agents verify the signatures of any steps they run, using the public key. ```ini -verification-failure-behavior= +verification-failure-behavior=warn ``` This setting determines the Buildkite agent's response when it receives a job without a proper signature, and also specifies how strictly the agent should enforce signature verification for incoming jobs. The agent will warn about missing or invalid signatures, but will still proceed to execute the job. If not explicitly specified, the default behavior is `block`, which prevents any job without a valid signature from running, ensuring a secure pipeline environment by default. @@ -254,7 +254,7 @@ GCP KMS support for signed pipelines requires Buildkite agent version 3.121.0 or GCP KMS has many options when creating keys. For pipeline signing, the key must use the following settings: 1. The key purpose must be asymmetric signing (`ASYMMETRIC_SIGN`). -1. The key algorithm must be one of the supported key algorithms listed below. The `EC_SIGN_P256_SHA256` algorithm is recommended. +1. The key algorithm must be one of the supported key algorithms listed below. The `EC_SIGN_P256_SHA256` algorithm is recommended, and is the only algorithm that works on agent versions earlier than 3.136.0. If you're using the Google Cloud CLI, the key ring and key can be created as follows: @@ -303,6 +303,9 @@ GCP KMS algorithm | JWS algorithm The agent refuses to start if the key version uses any other algorithm. +> 🚧 Algorithms other than EC_SIGN_P256_SHA256 require agent version 3.136.0 or later +> Agent versions 3.121.0 to 3.135.0 always verify GCP KMS signatures as `ES256`, regardless of the key's algorithm. On these versions, jobs signed with any key other than `EC_SIGN_P256_SHA256` fail verification and are blocked by default. If any of your agents run a version earlier than 3.136.0, use an `EC_SIGN_P256_SHA256` key. + ### Step 2: Configure the agents Next, you need to configure your agents to use the KMS key version you created. On agents that upload pipelines, add the following to the agent's config file: @@ -318,7 +321,7 @@ This ensures that whenever those agents upload steps to Buildkite, they'll gener The agent authenticates to GCP KMS using [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials). On Compute Engine or GKE, this is usually the service account attached to the instance or workload. Elsewhere, set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of a service account key file. ```ini -verification-failure-behavior= +verification-failure-behavior=warn ``` This setting determines the Buildkite agent's response when it receives a job without a proper signature, and also specifies how strictly the agent should enforce signature verification for incoming jobs. The agent will warn about missing or invalid signatures, but will still proceed to execute the job. If not explicitly specified, the default behavior is `block`, which prevents any job without a valid signature from running, ensuring a secure pipeline environment by default.