|
| 1 | +# Akeyless Secret Store |
| 2 | + |
| 3 | +This component provides a Dapr secret store implementation for [Akeyless](https://www.akeyless.io/), a cloud-native secrets management platform. |
| 4 | + |
| 5 | +## Configuration |
| 6 | + |
| 7 | +The Akeyless Dapr Secret Store component only supports the following [Authentication Methods](https://docs.akeyless.io/docs/access-and-authentication-methods): |
| 8 | + |
| 9 | +- [API Key](https://docs.akeyless.io/docs/api-key) |
| 10 | +- [OAuth2.0/JWT](https://docs.akeyless.io/docs/oauth20jwt) |
| 11 | +- [AWS IAM](https://docs.akeyless.io/docs/aws-iam) |
| 12 | +- [Kubernetes](https://docs.akeyless.io/docs/kubernetes-auth) |
| 13 | + |
| 14 | +### Authentication |
| 15 | + |
| 16 | +The Akeyless secret store component supports the following configuration options: |
| 17 | + |
| 18 | +| Field | Required | Description | Example | |
| 19 | +|-------|----------|-------------|---------| |
| 20 | +| `gatewayUrl` | No | The Akeyless Gateway URL. Default is https://api.akeyless.io. | `https://your-gateway.akeyless.io` | |
| 21 | +| `accessId` | Yes | The Akeyless authentication access ID. | `p-123456780wm` | |
| 22 | +| `jwt` | No | If using an OAuth2.0/JWT access ID, specify the JSON Web Token | `eyJ...` | |
| 23 | +| `accessKey` | No | If using an API Key access ID, specify the API key | `ABCD123...=` | |
| 24 | +| `k8sAuthConfigName` | No | If using the k8s auth method, specify the name of the k8s auth config. | `k8s-auth-config` | |
| 25 | +| `k8sGatewayUrl` | No | The gateway URL that where the k8s auth config is located. | `http://gw.akeyless.svc.cluster.local:8000` | |
| 26 | +| `k8sServiceAccountToken` | No | If using the k8s auth method, specify the service account token. If not specified, |
| 27 | + we will try to read it from the default service account token file. | `eyJ...` | |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +## Examples |
| 32 | + |
| 33 | +We currently support the following [Authentication Methods](https://docs.akeyless.io/docs/access-and-authentication-methods): |
| 34 | + |
| 35 | + |
| 36 | +## Examples |
| 37 | + |
| 38 | +## Example Configuration: API Key |
| 39 | + |
| 40 | +```yaml |
| 41 | +apiVersion: dapr.io/v1alpha1 |
| 42 | +kind: Component |
| 43 | +metadata: |
| 44 | + name: akeyless-secretstore |
| 45 | +spec: |
| 46 | + type: secretstores.akeyless |
| 47 | + version: v1 |
| 48 | + metadata: |
| 49 | + - name: gatewayUrl |
| 50 | + value: "https://your-gateway.akeyless.io" |
| 51 | + - name: accessId |
| 52 | + value: "p-1234Abcdam" |
| 53 | + - name: accessKey |
| 54 | + value: "ABCD1233...=" |
| 55 | +``` |
| 56 | +
|
| 57 | +
|
| 58 | +## Example Configuration: JWT |
| 59 | +
|
| 60 | +```yaml |
| 61 | +apiVersion: dapr.io/v1alpha1 |
| 62 | +kind: Component |
| 63 | +metadata: |
| 64 | + name: akeyless-secretstore |
| 65 | +spec: |
| 66 | + type: secretstores.akeyless |
| 67 | + version: v1 |
| 68 | + metadata: |
| 69 | + - name: gatewayUrl |
| 70 | + value: "https://your-gateway.akeyless.io" |
| 71 | + - name: accessId |
| 72 | + value: "p-1234Abcdom" |
| 73 | + - name: jwt |
| 74 | + value: "eyJ....." |
| 75 | +``` |
| 76 | +
|
| 77 | +## Example Configuration: AWS IAM |
| 78 | +
|
| 79 | +```yaml |
| 80 | +apiVersion: dapr.io/v1alpha1 |
| 81 | +kind: Component |
| 82 | +metadata: |
| 83 | + name: akeyless |
| 84 | +spec: |
| 85 | + type: secretstores.akeyless |
| 86 | + version: v1 |
| 87 | + metadata: |
| 88 | + - name: gatewayUrl |
| 89 | + value: "https://your-gateway.akeyless.io" |
| 90 | + - name: accessId |
| 91 | + value: "p-1234Abcdwm" |
| 92 | +``` |
| 93 | +
|
| 94 | +## Example Configuration: Kubernetes |
| 95 | +
|
| 96 | +```yaml |
| 97 | +apiVersion: dapr.io/v1alpha1 |
| 98 | +kind: Component |
| 99 | +metadata: |
| 100 | + name: akeyless |
| 101 | +spec: |
| 102 | + type: secretstores.akeyless |
| 103 | + version: v1 |
| 104 | + metadata: |
| 105 | + - name: gatewayUrl |
| 106 | + value: "https://gw.akeyless.svc.cluster.local" |
| 107 | + - name: accessId |
| 108 | + value: "p-1234Abcdwm" |
| 109 | + - name: k8sAuthConfigName |
| 110 | + value: "us-east-1-prod-akeyless-k8s-conf" |
| 111 | + - name: k8sGatewayUrl |
| 112 | + value: https://gw.akeyless.svc.cluster.local |
| 113 | +``` |
| 114 | +
|
| 115 | +## Usage |
| 116 | +
|
| 117 | +Once configured, you can retrieve secrets using the Dapr secrets API: |
| 118 | +
|
| 119 | +```bash |
| 120 | +# Get a single secret |
| 121 | +curl http://localhost:3500/v1.0/secrets/akeyless/my-secret |
| 122 | + |
| 123 | +# Get all secrets (static, dynamic, rotated) from root (/) path |
| 124 | +curl http://localhost:3500/v1.0/secrets/akeyless/bulk |
| 125 | + |
| 126 | +# Get all secrets static secrets |
| 127 | +curl http://localhost:3500/v1.0/secrets/akeyless/bulk?metadata.secrets_type=static |
| 128 | + |
| 129 | +# Get all static and dynamic secrets from a specific path (/my/org) |
| 130 | +curl http://localhost:3500/v1.0/secrets/akeyless/bulk?metadata.secrets_type=static,dynamic&metadata.path=/my/org |
| 131 | +``` |
| 132 | + |
| 133 | +Or using the Dapr SDK. The example below retrieves all static secrets from path `/path/to/department`. |
| 134 | +```go |
| 135 | +log.Println("Starting test application") |
| 136 | + client, err := dapr.NewClient() |
| 137 | + if err != nil { |
| 138 | + log.Printf("Error creating Dapr client: %v\n", err) |
| 139 | + panic(err) |
| 140 | + } |
| 141 | + log.Println("Dapr client created successfully") |
| 142 | + const daprSecretStore = "akeyless" |
| 143 | + |
| 144 | + defer client.Close() |
| 145 | + ctx := context.Background() |
| 146 | + akeylessBulkMetadata := map[string]string{ |
| 147 | + "path": "/path/to/department", |
| 148 | + "secrets_type": "static", |
| 149 | + } |
| 150 | + secrets, err := client.GetBulkSecret(ctx, daprSecretStore, akeylessBulkMetadata) |
| 151 | + if err != nil { |
| 152 | + log.Printf("Error fetching secrets: %v\n", err) |
| 153 | + panic(err) |
| 154 | + } |
| 155 | + log.Printf("Found %d secrets: ", len(secrets)) |
| 156 | + for secretName, secretValue := range secrets { |
| 157 | + log.Printf("Secret: %s, Value: %s", secretName, secretValue) |
| 158 | + } |
| 159 | +``` |
| 160 | + |
| 161 | +## Features |
| 162 | + |
| 163 | +- Supports static, dynamic and rotated secrets. |
| 164 | +- **GetSecret**: Retrieve an individual value secret by path. |
| 165 | +- **BulkGetSecret**: Retrieve all secrets from a specified path (or `/` by default) recursively. |
| 166 | + |
| 167 | +## Response Formats |
| 168 | + |
| 169 | +The Akeyless secret store returns different response formats depending on the secret type: |
| 170 | + |
| 171 | +### Static Secrets |
| 172 | +Static secrets return their value directly as a string: |
| 173 | + |
| 174 | +```json |
| 175 | +{ |
| 176 | + "my-static-secret": "secret-value" |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +### Dynamic Secrets |
| 181 | +Dynamic secrets return a JSON string containing the credentials. The exact structure depends on the target system: |
| 182 | + |
| 183 | +**MySQL Dynamic Secret:** |
| 184 | +```json |
| 185 | +{ |
| 186 | + "my-mysql-secret": "{\"user\":\"generated_username\",\"password\":\"generated_password\",\"ttl_in_minutes\":\"60\",\"id\":\"username\"}" |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +**Azure AD Dynamic Secret:** |
| 191 | +```json |
| 192 | +{ |
| 193 | + "my-azure-secret": "{\"user\":{\"id\":\"user_id\",\"displayName\":\"user_name\",\"mail\":\"email@domain.com\"},\"secret\":{\"keyId\":\"secret_key_id\",\"displayName\":\"secret_name\",\"tenantId\":\"tenant_id\"},\"ttl_in_minutes\":\"60\",\"id\":\"user_id\",\"msg\":\"User has been added successfully...\"}" |
| 194 | +} |
| 195 | +``` |
| 196 | + |
| 197 | +**GCP Dynamic Secret:** |
| 198 | +```json |
| 199 | +{ |
| 200 | + "my-gcp-secret": "{\"encoded_key\":\"base64_encoded_service_account_key\",\"ttl_in_minutes\":\"60\",\"id\":\"service_account_name\"}" |
| 201 | +} |
| 202 | +``` |
| 203 | + |
| 204 | +### Rotated Secrets |
| 205 | +Rotated secrets return a JSON object containing all available fields: |
| 206 | + |
| 207 | +```json |
| 208 | +{ |
| 209 | + "my-rotated-secret": "{\"value\":{\"username\":\"rotated_user\",\"password\":\"rotated_password\",\"application_id\":\"1234567890\"}}" |
| 210 | +} |
| 211 | +``` |
| 212 | + |
| 213 | +**Note:** The exact fields in dynamic and rotated secret responses vary by target system and configuration. Applications should parse the JSON string to extract the specific credentials they need. |
0 commit comments