Skip to content

Commit

Permalink
Add LUKS encryption support.
Browse files Browse the repository at this point in the history
  • Loading branch information
paravibe committed Jun 23, 2023
1 parent 3892b9c commit 916c067
Show file tree
Hide file tree
Showing 15 changed files with 2,425 additions and 57 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## unreleased

## v4.7.0 - 2023.06.23
* Add LUKS encryption support
[[GH-514]](https://github.com/digitalocean/csi-digitalocean/pull/514)

## v4.6.1 - 2023.05.17
* Update CSI sidecars to latest
[[GH-502]](https://github.com/digitalocean/csi-digitalocean/pull/502)
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,21 @@ $ kubectl exec -ti my-csi-app /bin/sh
hello-world
```

## Volume parameters

This plugin supports the following `StorageClass` parameters:

For LUKS encryption:

* `dobs.csi.digitalocean.com/luks-encrypted`: set to the string `"true"` if the volume should be encrypted
with LUKS
* `dobs.csi.digitalocean.com/luks-cipher`: cipher to use; must be supported by the kernel and luks
* `dobs.csi.digitalocean.com/luks-key-size`: key-size to use

For LUKS encrypted volumes, a secret that contains the LUKS key needs to be referenced through
the `csi.storage.k8s.io/node-stage-secret-name` and `csi.storage.k8s.io/node-stage-secret-namespace`
parameter. See the included `StorageClass` definition.

## Upgrading

When upgrading to a new Kubernetes minor version, you should upgrade the CSI
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.6.1
v4.7.0
1 change: 1 addition & 0 deletions cmd/do-csi-plugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FROM amd64/alpine:3.16
# e2fsprogs-extra is required for resize2fs used for the resize operation
# blkid: block device identification tool from util-linux
RUN apk add --no-cache ca-certificates \
cryptsetup \
e2fsprogs \
findmnt \
xfsprogs \
Expand Down
36 changes: 36 additions & 0 deletions deploy/kubernetes/releases/csi-digitalocean-dev/driver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@ deletionPolicy: Delete

---

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: do-block-storage-luks-global
provisioner: dobs.csi.digitalocean.com
allowVolumeExpansion: true
parameters:
dobs.csi.digitalocean.com/luks-encrypted: "true"
dobs.csi.digitalocean.com/luks-cipher: "aes-xts-plain64"
dobs.csi.digitalocean.com/luks-key-size: "512"
csi.storage.k8s.io/node-stage-secret-namespace: "kube-system"
csi.storage.k8s.io/node-stage-secret-name: "luks-key"

---

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: do-block-storage-luks
provisioner: dobs.csi.digitalocean.com
allowVolumeExpansion: true
parameters:
dobs.csi.digitalocean.com/luks-encrypted: "true"
dobs.csi.digitalocean.com/luks-cipher: "aes-xts-plain64"
dobs.csi.digitalocean.com/luks-key-size: "512"
csi.storage.k8s.io/node-stage-secret-namespace: ${pvc.namespace}
csi.storage.k8s.io/node-stage-secret-name: ${pvc.name}-luks-key

---

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
Expand Down Expand Up @@ -443,6 +473,8 @@ spec:
mountPropagation: "Bidirectional"
- name: device-dir
mountPath: /dev
- name: tmpfs
mountPath: /tmp
volumes:
- name: registration-dir
hostPath:
Expand All @@ -462,6 +494,10 @@ spec:
- name: udev-rules-dir
hostPath:
path: /etc/udev/rules.d/
# to make sure temporary stored luks keys never touch a disk
- name: tmpfs
emptyDir:
medium: Memory
---

apiVersion: v1
Expand Down
Loading

0 comments on commit 916c067

Please sign in to comment.