Skip to content

Commit 7642fad

Browse files
authored
Merge pull request #42 from Keyfactor/release-2.1
Release 2.1
2 parents d0484de + 5869d13 commit 7642fad

File tree

10 files changed

+221
-56
lines changed

10 files changed

+221
-56
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@
4848
## Fixes
4949
- Updated library golang.org/x/crypto to version v0.33.0 to address authorization bypass vulnerability (https://github.com/advisories/GHSA-v778-237x-gjrc)
5050
- Bug fix for Google ambient credentials
51+
52+
# v2.1.1
53+
54+
## Fixes
55+
- Update Helm chart deployment template to resolve Docker image metadata issue.
56+
57+
## Chores
58+
- Update documentation for more clear instructions on deploying workloads to Azure Kubernetes Service and Google Kubernetes Engine, as well as permissions needed on Command Security Roles.

README.md

Lines changed: 105 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,36 @@ Command Issuer enrolls certificates by submitting a POST request to the Command
7171

7272
- If you don't have any suitable Certificate Templates, refer to the [Command documentation](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/Configuring%20Template%20Options.htm?Highlight=Certificate%20Template) or reach out to your Keyfactor support representative to learn more.
7373

74-
The Certificate Template that you shoose must be configured to allow CSR Enrollment.
74+
The Certificate Template that you choose must be configured to allow CSR Enrollment.
7575

7676
You should make careful note of the allowed Key Types and Key Sizes on the Certificate Template. When creating cert-manager [Certificates](https://cert-manager.io/docs/usage/certificate/), you must make sure that the key `algorithm` and `size` are allowed by your Certificate Template in Command.
7777

7878
The same goes for **Enrollment RegExes** and **Policies** defined on your Certificate Template. When creating cert-manager [Certificates](https://cert-manager.io/docs/usage/certificate/), you must make sure that the `subject`, `commonName`, `dnsNames`, etc. are allowed and/or configured correctly by your Certificate Template in Command.
7979

8080
3. **Configure Command Security Roles and Claims**
8181

82-
In Command, Security Roles define groups of users or administrators with specific permissions. Users and subjects are identified by Claims. By adding a Claim to a Security Role, you can define what actions the user or subject can perform and what parts of the system it can interact with.
82+
In Command, Security Roles define groups of users or administrators with specific permissions. Users and subjects are identified by Claims. By adding a Claim to a Security Role, you can define what actions the user or subject can perform and what parts of the system it can interact with.
83+
84+
The security role will need to be added as an Allowed Requester Security Role on the Certificate Authority and Certificate Template configured in the previous two steps.
8385

8486
- If you haven't created Roles and Access rules before, [this guide](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityOverview.htm?Highlight=Security%20Roles) provides a primer on these concepts in Command.
8587

86-
If your security policy requires fine-grain access control, Command Issuer requires the following Access Rules.
88+
If your security policy requires fine-grain access control, Command Issuer requires the following Access Rules:
89+
90+
| Global Permissions | Permission Model (Version Two) | Permission Model (Version One) |
91+
|-----------------------------------------|---|---|
92+
| Metadata > Types > Read | `/metadata/types/read/` | `CertificateMetadataTypes:Read` |
93+
| Certificates > Enrollment > Csr | `/certificates/enrollment/csr/` | `CertificateEnrollment:EnrollCSR` |
94+
95+
> Documentation for [Version Two Permission Model](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityRolePermissions.htm#VersionTwoPermissionModel) and [Version One Permission Model](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityRolePermissions.htm#VersionOnePermissionModel)
96+
97+
![Permission Metadata Read](./docsource/images/security_permission_metadata_read.png)
98+
99+
![Permission Certificate CSR Enrollment](./docsource/images/security_permission_enrollment_csr.png)
100+
101+
![Certificate Authority Allowed Requester](./docsource/images/ca_allowed_requester.png)
87102

88-
| Global Permissions |
89-
|-----------------------------------------|
90-
| `CertificateMetadataTypes:Read` |
91-
| `CertificateEnrollment:EnrollCSR` |
103+
![Certificate Template Allowed Requester](./docsource/images/cert_template_allowed_requester.png)
92104

93105
## Installing Command Issuer
94106

@@ -173,11 +185,18 @@ kubectl -n command-issuer-system create secret generic command-secret \
173185
174186
Azure Entra ID workload identity in Azure Kubernetes Service (AKS) allows Command Issuer to exchange a Kubernetes ServiceAccount Token for an Azure Entra ID access token, which is then used to authenticate to Command.
175187
188+
At this time, Azure Kuberentes Services workload identity federation is best supported by [User Assigned Managed Identities](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp). Other identity solutions such as Azure AD Service Principals are not supported.
189+
190+
Here is a guide on how to use Azure User Assigned Managed Identities to authenticate your AKS workload with your Keyfactor Command instance.
191+
176192
1. Reconfigure the AKS cluster to enable workload identity federation.
177193
178194
```shell
195+
export CLUSTER_NAME=<cluster-name>
196+
export RESOURCE_GROUP=<resource-group>
179197
az aks update \
180-
--name ${CLUSTER} \
198+
--name ${CLUSTER_NAME} \
199+
--resource-group ${RESOURCE_GROUP} \
181200
--enable-oidc-issuer \
182201
--enable-workload-identity
183202
```
@@ -186,16 +205,28 @@ Azure Entra ID workload identity in Azure Kubernetes Service (AKS) allows Comman
186205
>
187206
> Refer to the [AKS documentation](https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster) for more information on the `--enable-workload-identity` feature.
188207

189-
2. Reconfigure or deploy Command Issuer with extra labels for the Azure Workload Identity webhook, which will result in the Command Issuer controller Pod having an extra volume containing a Kubernetes ServiceAccount token which it will exchange for a token from Azure.
208+
2. Create a User Assigned Managed Identity in Azure.
209+
210+
```shell
211+
export IDENTITY_NAME=command-issuer
212+
az identity create --name "${IDENTITY_NAME}" --resource-group "${RESOURCE_GROUP}"
213+
```
214+
> Read more about [the `az identity` command](https://learn.microsoft.com/en-us/cli/azure/identity?view=azure-cli-latest).
215+
216+
3. Reconfigure or deploy Command Issuer with extra labels for the Azure Workload Identity webhook, which will result in the Command Issuer controller Pod having an extra volume containing a Kubernetes ServiceAccount token which it will exchange for a token from Azure.
190217

191218
```shell
219+
export UAMI_CLIENT_ID=$(az identity show --name $IDENTITY_NAME --resource-group $RESOURCE_GROUP --query clientId --output tsv)
220+
221+
echo "Identity Client ID: ${UAMI_CLIENT_ID}"
222+
192223
helm install command-cert-manager-issuer command-issuer/command-cert-manager-issuer \
193224
--namespace command-issuer-system \
194225
--create-namespace \
195-
--set "fullnameOverride=$chart_name" \
226+
--set "fullnameOverride=command-cert-manager-issuer" \
196227
--set-string "podLabels.azure\.workload\.identity/use=true" \
197-
--set-string "serviceAccount.labels.azure\.workload\.identity/use=true"
198-
# --set-string "serviceAccount.annotations.azure\.workload\.identity/client-id=<managed identity client ID>" # May be necessary, but is usually not.
228+
--set-string "serviceAccount.labels.azure\.workload\.identity/use=true" \
229+
--set-string "serviceAccount.annotations.azure\.workload\.identity/client-id=${UAMI_CLIENT_ID}"
199230
```
200231

201232
If successful, the Command Issuer Pod will have new environment variables and the Azure WI ServiceAccount token as a projected volume:
@@ -209,7 +240,7 @@ Azure Entra ID workload identity in Azure Kubernetes Service (AKS) allows Comman
209240
command-cert-manager-issuer:
210241
...
211242
Environment:
212-
AZURE_CLIENT_ID: <GUID>
243+
AZURE_CLIENT_ID: <UAMI_CLIENT_ID>
213244
AZURE_TENANT_ID: <GUID>
214245
AZURE_FEDERATED_TOKEN_FILE: /var/run/secrets/azure/tokens/azure-identity-token
215246
AZURE_AUTHORITY_HOST: https://login.microsoftonline.com/
@@ -226,35 +257,83 @@ Azure Entra ID workload identity in Azure Kubernetes Service (AKS) allows Comman
226257

227258
> Refer to [Azure Workload Identity docs](https://azure.github.io/azure-workload-identity/docs/installation/mutating-admission-webhook.html) more information on the role of the Mutating Admission Webhook.
228259

229-
3. Create a User Assigned Managed Identity in Azure.
230-
231-
```shell
232-
export IDENTITY_NAME=command-issuer
233-
az identity create --name "${IDENTITY_NAME}"
234-
```
235-
236-
> Read more about [the `az identity` command](https://learn.microsoft.com/en-us/cli/azure/identity?view=azure-cli-latest).
237-
238260
4. Associate a Federated Identity Credential (FIC) with the User Assigned Managed Identity. The FIC allows Command Issuer to act on behalf of the Managed Identity by telling Azure to expect:
239261
- The `iss` claim of the ServiceAccount token to match the cluster's OIDC Issuer. Azure will also use the Issuer URL to download the JWT signing certificate.
240262
- The `sub` claim of the ServiceAccount token to match the ServiceAccount's name and namespace.
241263

242264
```shell
243265
export SERVICE_ACCOUNT_NAME=command-cert-manager-issuer # This is the default Kubernetes ServiceAccount used by the Command Issuer controller.
244266
export SERVICE_ACCOUNT_NAMESPACE=command-issuer-system # This is the default namespace for Command Issuer used in this doc.
245-
export SERVICE_ACCOUNT_ISSUER=$(az aks show --resource-group $AZURE_DEFAULTS_GROUP --name $CLUSTER --query "oidcIssuerProfile.issuerUrl" -o tsv)
267+
268+
export SERVICE_ACCOUNT_ISSUER=$(az aks show --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --query "oidcIssuerProfile.issuerUrl" -o tsv)
246269
az identity federated-credential create \
247-
--name "command-issuer" \
270+
--name "${IDENTITY_NAME}-federated-credentials" \
248271
--identity-name "${IDENTITY_NAME}" \
272+
--resource-group "${RESOURCE_GROUP}" \
249273
--issuer "${SERVICE_ACCOUNT_ISSUER}" \
250-
--subject "system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}"
274+
--subject "system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}" \
275+
--audiences "api://AzureADTokenExchange"
251276
```
252277

253278
> Read more about [Workload Identity federation](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation) in the Entra ID documentation.
254279
>
255280
> Read more about [the `az identity federated-credential` command](https://learn.microsoft.com/en-us/cli/azure/identity/federated-credential?view=azure-cli-latest).
256281

257-
5. Add Microsoft Entra ID as an [Identity Provider in Command](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/IdentityProviders.htm?Highlight=identity%20provider), and [add the Managed Identity's Client ID as an `oid` claim to the Security Role](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityOverview.htm?Highlight=Security%20Roles) created/identified earlier.
282+
5. Get the Managed Identity's Principal ID and Entra Identity Provider Information
283+
284+
```shell
285+
export UAMI_PRINCIPAL_ID=$(az identity show --name $IDENTITY_NAME --resource-group $RESOURCE_GROUP --query principalId --output tsv)
286+
export CURRENT_TENANT=$(az account show --query tenantId --output tsv)
287+
echo "UAMI Principal ID: ${UAMI_PRINCIPAL_ID}"
288+
289+
echo "View then OIDC configuration for the Entra OIDC token issuer: https://login.microsoftonline.com/$CURRENT_TENANT/v2.0/.well-known/openid-configuration"
290+
291+
echo "Authority: https://login.microsoftonline.com/$CURRENT_TENANT/v2.0"
292+
```
293+
294+
> **IMPORTANT NOTE**: The Microsoft Entra Identity Provider is associated with your Azure tenant ID. Multi-tenant Azure workloads will require a Command Identity Provider for each tenant.
295+
296+
6. Add the Microsoft Entra ID as an [Identity Provider in Command](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/IdentityProviders.htm?Highlight=identity%20provider) using the identity provider information from the previous step, and [add the Managed Identity's Principal ID as an `OAuth Subject` claim to the Security Role](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityOverview.htm?Highlight=Security%20Roles) created/identified earlier.
297+
298+
## Google Kubernetes Engine (GKE) Workload Identity
299+
300+
Google Kuberentes Engine (GKE) supports the ability to authenticate your GKE workloads using workload identity.
301+
302+
By default, GKE clusters are assigned the [default service account](https://cloud.google.com/compute/docs/access/service-accounts#token) for your Google project. This service account is used to generate an ID token for your workload. However, you may opt to use [Workload Identity Federation](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#metadata-server) to your GKE cluster.
303+
304+
1. Get the OAuth Client and Identity Provider for your GKE Cluster
305+
306+
Regardless if you are using the default service account or a custom service account, the following script will help you derive your GKE cluster's OAuth Client:
307+
308+
```shell
309+
export CLUSTER_NAME=<cluster-name>
310+
export GCLOUD_REGION=<region>
311+
export GCLOUD_PROJECT_ID=$(gcloud config get-value project) # populate with the current PROJECT_ID context
312+
export GCLOUD_PROJECT_NUMBER=$(gcloud projects describe $GCLOUD_PROJECT_ID --format="value(projectNumber)")
313+
314+
export GCLOUD_SERVICE_ACCOUNT=$(gcloud container clusters describe $CLUSTER_NAME \
315+
--zone $GCLOUD_REGION \
316+
--format="value(nodeConfig.serviceAccount)")
317+
318+
if [[ "$GCLOUD_SERVICE_ACCOUNT" == "default" ]]; then
319+
# Override service account with default compute service account
320+
GCLOUD_SERVICE_ACCOUNT="[email protected]"
321+
fi
322+
323+
echo "Service account: $GCLOUD_SERVICE_ACCOUNT"
324+
325+
# Get OAuth2 Client ID of service account
326+
export GCLOUD_SERVICE_ACCOUNT_CLIENT_ID=$(gcloud iam service-accounts describe $GCLOUD_SERVICE_ACCOUNT \
327+
--format="value(oauth2ClientId)")
328+
329+
echo "Service account OAuth2 client ID: $GCLOUD_SERVICE_ACCOUNT_CLIENT_ID"
330+
331+
echo "View the OIDC configuration for Google's OIDC token issuer: https://accounts.google.com/.well-known/openid-configuration"
332+
333+
echo "Authority: https://accounts.google.com"
334+
```
335+
336+
2. Add Google as an [Identity Provider in Command](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/IdentityProviders.htm?Highlight=identity%20provider) using the identity provider information from the previous step, and [add the Service Account's OAuth Client ID as an `OAuth Subject` claim to the Security Role](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityOverview.htm?Highlight=Security%20Roles) created/identified earlier.
258337
259338
# CA Bundle
260339

deploy/charts/command-cert-manager-issuer/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
[![Go Report Card](https://goreportcard.com/badge/github.com/Keyfactor/command-cert-manager-issuer)](https://goreportcard.com/report/github.com/Keyfactor/command-cert-manager-issuer)
88
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
9-
![Version: v1.0.3](https://img.shields.io/badge/Version-v1.0.3-informational?style=flat-square)
109
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
11-
![AppVersion: v1.0.3](https://img.shields.io/badge/AppVersion-v1.0.3-informational?style=flat-square)
1210

1311
A Helm chart for the Keyfactor Command External Issuer for cert-manager.
1412

deploy/charts/command-cert-manager-issuer/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
{{- end}}
3939
command:
4040
- /manager
41-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
41+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.Version }}"
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
4343
livenessProbe:
4444
httpGet:

deploy/charts/command-cert-manager-issuer/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ replicaCount: 1
66
image:
77
repository: "keyfactor/command-cert-manager-issuer"
88
pullPolicy: IfNotPresent
9-
# Overrides the image tag whose default is the chart appVersion.
9+
# Overrides the image tag whose default is the chart version.
1010
tag: ""
1111

1212
imagePullSecrets: []

0 commit comments

Comments
 (0)