Skip to content

Commit 32b22c4

Browse files
author
Florian Perucki
committed
docs: add workload authentication method example for conjur
1 parent 36a9ebd commit 32b22c4

File tree

6 files changed

+122
-23
lines changed

6 files changed

+122
-23
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Conjur Cloud with Workload Authentication
2+
3+
This example demonstrates how to configure ggscout to authenticate with Conjur Cloud using Workload authentication.
4+
5+
## Prerequisites
6+
7+
1. Access to a Conjur Cloud instance
8+
2. A Conjur workload with appropriate permissions
9+
3. Workload login ID and API key
10+
11+
## Configuration
12+
13+
### 1. Workload Setup
14+
15+
In your Conjur Cloud instance, ensure you have:
16+
- A workload identity configured
17+
- Appropriate policies granting the workload access to secrets
18+
- The workload login ID and API key
19+
20+
### 2. Update Configuration
21+
22+
Edit the `secret.yaml` file to match your environment:
23+
24+
- `CONJUR_WORKLOAD_LOGIN`: Your Conjur workload login ID (e.g., "host/my-app")
25+
- `CONJUR_WORKLOAD_API_KEY`: Your Conjur workload API key
26+
- `CONJUR_SUBDOMAIN`: Your Conjur Cloud subdomain
27+
- `GITGUARDIAN_API_KEY`: Your GitGuardian API token
28+
29+
Edit the `values.yaml` file:
30+
31+
- Update the GitGuardian endpoint URL if needed
32+
- Adjust the fetch and sync schedules as required
33+
34+
### 3. Deploy with Helm
35+
36+
```bash
37+
# Add the ggscout Helm repository
38+
helm repo add ggscout https://gitguardian.github.io/nhi-scout-helm-charts
39+
helm repo update
40+
41+
# Apply the secret first
42+
kubectl apply -f secret.yaml
43+
44+
# Install ggscout with Conjur Cloud Workload authentication
45+
helm install ggscout-conjur ggscout/ggscout -f values.yaml
46+
```
47+
48+
## Verification
49+
50+
Check that ggscout can authenticate with Conjur Cloud:
51+
52+
```bash
53+
# Check the logs of the ggscout pods
54+
kubectl logs -l app.kubernetes.io/name=ggscout
55+
56+
# Check if the CronJobs are running
57+
kubectl get cronjobs
58+
```
59+
60+
## Troubleshooting
61+
62+
1. **Authentication Issues**: Verify the workload login ID and API key are correct
63+
2. **Permission Issues**: Ensure the workload has proper policies to access the required secrets
64+
3. **Network Connectivity**: Verify ggscout pods can reach your Conjur Cloud instance
65+
66+
For more details on Conjur Cloud workload authentication, refer to the [Conjur Cloud documentation](https://docs.cyberark.com/conjur-cloud/).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: ggscout-secrets
6+
stringData:
7+
# Conjur Workload authentication
8+
CONJUR_WORKLOAD_LOGIN: "your-workload-login"
9+
CONJUR_WORKLOAD_API_KEY: "your-workload-api-key"
10+
11+
# Conjur subdomain
12+
CONJUR_SUBDOMAIN: "your-conjur-subdomain"
13+
14+
# GitGuardian API token
15+
GITGUARDIAN_API_KEY: "your_gitguardian_token"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# yaml-language-server: $schema=../../values.schema.json
3+
4+
inventory:
5+
config:
6+
sources:
7+
conjur_cloud:
8+
type: conjurcloud
9+
auth_mode: "workload"
10+
login: "${CONJUR_WORKLOAD_LOGIN}"
11+
api_key: "${CONJUR_WORKLOAD_API_KEY}"
12+
fetch_all_versions: true
13+
mode: "read/write" # Can be `read`, `write` or `read/write` depending on wether fetch and/or sync are enabled
14+
subdomain: "${CONJUR_SUBDOMAIN}"
15+
16+
gitguardian:
17+
endpoint: "https://api.gitguardian.com/v1"
18+
api_token: "${GITGUARDIAN_API_KEY}"
19+
jobs:
20+
# Job to fetch defined sources
21+
fetch:
22+
# Set to `false` to disable the job
23+
enabled: true
24+
# Run every 15 minutes
25+
schedule: '*/15 * * * *'
26+
send: true
27+
# Job to be able to sync/write secrets from GitGuardian into you vault
28+
sync:
29+
# Set to `false` to disable the job
30+
enabled: true
31+
# Run every minute
32+
schedule: '* * * * *'
33+
34+
envFrom:
35+
- secretRef:
36+
name: ggscout-secrets

charts/ggscout/examples/hashicorpvault-k8s/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ EOF
5555
```bash
5656
# Create Kubernetes auth role
5757
vault write auth/kubernetes/role/ggscout \
58-
bound_service_account_names=ggscout-vault \
59-
bound_service_account_namespaces=default \
58+
bound_service_account_names=ggscout \
6059
policies=ggscout-policy \
6160
ttl=24h
6261
```
@@ -67,8 +66,6 @@ vault write auth/kubernetes/role/ggscout \
6766

6867
Edit the `secret.yaml` file to match your environment:
6968

70-
- `KUBERNETES_SERVICE_ACCOUNT`: Must match the service account name in values.yaml
71-
- `KUBERNETES_NAMESPACE`: The namespace where ggscout will be deployed
7269
- `VAULT_K8S_ROLE`: The Vault role created above
7370
- `GITGUARDIAN_API_KEY`: Your GitGuardian API token
7471

@@ -77,6 +74,8 @@ Edit the `values.yaml` file:
7774
- `vault_address`: Your Vault server URL
7875
- `path`: The Vault path to collect secrets from
7976
- `gitguardian.endpoint`: Your GitGuardian instance URL
77+
- `auth.k8s.service_account`: (Optional) Custom service account name
78+
- `auth.k8s.namespace`: (Optional) Kubernetes namespace for the service account
8079

8180
### 2. Deploy with Helm
8281

@@ -101,7 +100,7 @@ Check that ggscout can authenticate with Vault:
101100
kubectl logs -l app.kubernetes.io/name=ggscout
102101

103102
# Verify the service account was created
104-
kubectl get serviceaccount ggscout-vault
103+
kubectl get serviceaccount ggscout
105104

106105
# Check if the CronJobs are running
107106
kubectl get cronjobs
@@ -114,4 +113,4 @@ kubectl get cronjobs
114113
3. **Network Connectivity**: Ensure ggscout pods can reach your Vault instance
115114
4. **Token Permissions**: Verify the Vault policy grants the necessary permissions
116115

117-
For more detailed troubleshooting, enable debug logging by setting `log_level: debug` in the values.yaml file.
116+
For more detailed troubleshooting, enable debug logging by setting `log_level: debug` in the values.yaml file.

charts/ggscout/examples/hashicorpvault-k8s/secret.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ kind: Secret
44
metadata:
55
name: ggscout-secrets
66
stringData:
7-
# Kubernetes service account name for Vault authentication
8-
KUBERNETES_SERVICE_ACCOUNT: "ggscout-vault"
9-
10-
# Kubernetes namespace where ggscout is deployed
11-
KUBERNETES_NAMESPACE: "default"
12-
137
# Vault Kubernetes authentication role
148
VAULT_K8S_ROLE: "ggscout"
159

charts/ggscout/examples/hashicorpvault-k8s/values.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ inventory:
1010
auth:
1111
auth_mode: "k8s"
1212
k8s:
13-
service_account: "${KUBERNETES_SERVICE_ACCOUNT}"
14-
namespace: "${KUBERNETES_NAMESPACE}"
1513
role: "${VAULT_K8S_ROLE}"
1614
fetch_all_versions: true # Fetch all versions of secrets or not
1715
path: "secret/dev" # Vault path or unspecified
@@ -36,15 +34,6 @@ inventory:
3634
# Run every minute
3735
schedule: '* * * * *'
3836

39-
# Service account configuration for Kubernetes authentication
40-
serviceAccount:
41-
# Create a service account for Vault authentication
42-
create: true
43-
# Annotations can be used for IAM role bindings if needed
44-
annotations: {}
45-
# Use a specific name for the service account
46-
name: "ggscout-vault"
47-
4837
envFrom:
4938
- secretRef:
5039
name: ggscout-secrets

0 commit comments

Comments
 (0)