Skip to content

Commit 30c605f

Browse files
authored
Merge pull request #420 from ComplianceEnthusiast/feat/nesting
Split `privileged` and `nesting` variables for the incus module
2 parents 7778602 + 414bea8 commit 30c605f

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

docs/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,11 +1152,24 @@ This setting can be enabled on at most one cluster per incus host.
11521152
**default value**: true
11531153
11541154
By default, the LXC containers created by Magic Castle are privileged. It is possible for security reasons
1155-
to turn this off by provider `privileged = false` to the Incus module. However, due to kernel restrictions
1155+
to turn this off by provider `privileged = false` to the Incus module. However, due to kernel restrictions
11561156
designed to prevent unprivileged users from performing privileged operations like initiating mounts,
11571157
the following features have to be disabled when running with `privileged = false`:
11581158
- NFS server and mounts (`profile::nfs`)
11591159
1160+
Also make sure that the line `root:1000000:1000000000` exists in both
1161+
`/etc/subuid` and `/etc/subgid` when running with `privileged = false`.
1162+
1163+
**Post build modification effect**: rebuild of all instances at next `terraform apply`.
1164+
1165+
### nesting (optional)
1166+
1167+
**default value**: true
1168+
1169+
By default, the LXC containers created by Magic Castle have nesting enabled.
1170+
This allows containers to run workloads that require features such as docker or systemd inside the container.
1171+
It is possible, for security or isolation reasons, to disable this by setting `nesting = false` in the Incus module.
1172+
11601173
**Post build modification effect**: rebuild of all instances at next `terraform apply`.
11611174
11621175
### shared_filesystems (optional)

incus/incus.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ variable "privileged" {
1313
default = true
1414
}
1515

16+
variable "nesting" {
17+
description = "When using container, set the config security.nesting to this value"
18+
default = true
19+
}
20+
1621
variable "shared_filesystems" {
1722
description = "Name of filesystems that need to be created and mounted in every instance"
1823
default = []

incus/infrastructure.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ resource "incus_instance" "instances" {
9393
config = {
9494
"cloud-init.user-data" = module.configuration.user_data[each.key]
9595
"security.privileged" = var.privileged
96-
"security.nesting" = var.privileged
96+
"security.nesting" = var.nesting
9797
}
9898

9999
device {

0 commit comments

Comments
 (0)