Browse Source

docs: extend bitwarden example and integration to accomodate the ssh key feature (#5414)

Signed-off-by: Luilegeant <nemo@luilegeant.com>
luilegeant 6 months ago
parent
commit
06ab0b534a

+ 3 - 1
docs/examples/bitwarden.md

@@ -84,7 +84,7 @@ bw serve --hostname 0.0.0.0 #--disable-origin-protection
 
 ## Deploy (Cluster)SecretStores
 
-There are four possible (Cluster)SecretStores to deploy, each can access different types of fields from an item in the Bitwarden vault. It is not required to deploy them all.
+There are five possible (Cluster)SecretStores to deploy, each can access different types of fields from an item in the Bitwarden vault. It is not required to deploy them all.
 
 ```yaml
 {% include 'bitwarden-secret-store.yaml' %}
@@ -98,6 +98,7 @@ There are four possible (Cluster)SecretStores to deploy, each can access differe
 * `bitwarden-fields`: Use to get custom fields
 * `bitwarden-notes`: Use to get notes
 * `bitwarden-attachments`: Use to get attachments
+* `bitwarden-ssh`: Use to get ssh key stored in `privateKey` (other possible fields are `publicKey` and `keyFingerprint`)
 
 remoteRef:
 
@@ -109,6 +110,7 @@ remoteRef:
     * `password` for the password of a secret (`bitwarden-login` SecretStore)
     * `name_of_the_custom_field` for any custom field (`bitwarden-fields` SecretStore)
     * `id_or_name_of_the_attachment` for any attachment (`bitwarden-attachment`, SecretStore)
+    * `name_of_the_ssh_field` for any ssh field (`bitwarden-ssh` SecretStore) possible fields are `publicKey`, `privateKey` and `keyFingerprint`
 
 ```yaml
 {% include 'bitwarden-secret.yaml' %}

+ 13 - 0
docs/snippets/bitwarden-secret-store.yaml

@@ -44,4 +44,17 @@ spec:
     webhook:
       url: "http://bitwarden-cli:8087/object/attachment/{{ .remoteRef.property }}?itemid={{ .remoteRef.key }}"
       result: {}
+---
+apiVersion: external-secrets.io/v1
+kind: ClusterSecretStore
+metadata:
+  name: bitwarden-ssh
+spec:
+  provider:
+    webhook:
+      url: "http://bitwarden-cli:8087/object/item/{{ .remoteRef.key }}"
+      headers:
+        Content-Type: application/json
+      result:
+        jsonPath: "$.data.sshKey.{{ .remoteRef.property }}"
 {% endraw %}

+ 21 - 0
docs/snippets/bitwarden-secret.yaml

@@ -73,4 +73,25 @@ spec:
       remoteRef:
         key: aaaabbbb-cccc-dddd-eeee-000011112222
         property: id_rsa.pub
+---
+apiVersion: external-secrets.io/v1
+kind: ExternalSecret
+metadata:
+  name: my-secrets-ssh
+  namespace: default
+spec:
+  target:
+    template:
+      type: kubernetes.io/ssh-auth
+      data:
+        ssh-privatekey: "{{ .privateKey | toString }}"
+  data:
+    - secretKey: privateKey
+      sourceRef:
+        storeRef:
+          name: bitwarden-ssh
+          kind: ClusterSecretStore  # or SecretStore
+      remoteRef:
+        key: aaaabbbb-cccc-dddd-eeee-000011112222
+        property: privateKey
 {% endraw %}