I am using POSIX access control lists in a container on a zfs storage volume. I’ve exported the container and restored it on another host system, and on the restored container, the ACL doesn’t work as expected.
I cannot chdir into a directory as a specific user, www-data.
The zfs filesystem has acltype=posixacl on both host systems, and I’ve updated the kernel so that it is identical.
After restoring the container, the access control list for an affected file looked like this:
# file: repo/
# owner: admin
# group: users
user::rwx
user:4294967295:r-x
group::rwx
mask::rwx
other::r-x
That was obvious nonsense. On the original container, it looks like this:
$ getfacl repo/
# file: repo/
# owner: admin
# group: users
user::rwx
user:www-data:r-x
group::rwx
mask::rwx
other::r-x
So it looks like uid/gid confusion of the kind described in this zfs bug report from 2016: https://github.com/openzfs/zfs/issues/4177
Except that bug is supposed to be fixed and I’m using zfs 0.8.3, which already includes the patch.
I deleted the defective ACL entry (setfacl -x user:4294967295 repo
) and recreated it with the correct uid (setfacl -m user:www-data:r-x repo
), and it now looks like this:
$ getfacl repo/
# file: repo/
# owner: admin
# group: users
user::rwx
user:www-data:r-x
group::rwx
mask::rwx
other::r-x
But the error persists:
$ sudo su - www-data -s /bin/bash -c "cd /home/admin/repo"
-bash: line 1: cd: /home/admin/repo: Permission denied
$
On the source container, it works as expected:
$ sudo su - www-data -s /bin/bash -c "cd /home/admin/repo"
$
The zfs volume has posixacl support:
$ mount | grep acl
default/containers/c1-target on / type zfs (rw,relatime,xattr,posixacl)
On the source container, it looks like this:
$ mount | grep acl
main/containers/c1-source on / type zfs (rw,relatime,xattr,posixacl)
Here is the extended config for the source container:
$ lxc config show -e c1-source
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 22.04 LTS amd64 (release) (20231026)
image.label: release
image.os: ubuntu
image.release: jammy
image.serial: "20231026"
image.type: squashfs
image.version: "22.04"
limits.cpu: "2"
limits.memory: 2GB
volatile.base_image: 187a9674b77056a0d466f5058ea72660cb52430dcdf06974ca8cd6c5a47fb6b3
volatile.eth0.host_name: veth0b0807bf
volatile.eth0.hwaddr: 00:16:3e:73:6d:b2
volatile.eth0.name: eth0
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: RUNNING
volatile.uuid: 23c9e221-15bd-448d-8388-afbe65fe0629
volatile.uuid.generation: 23c9e221-15bd-448d-8388-afbe65fe0629
devices:
<network devices omitted>
root:
path: /
pool: main
type: disk
ephemeral: false
profiles:
- custom
stateful: false
description: ""
Here is the extended config for the target container:
$ lxc config show -e c1-target
architecture: x86_64
config:
image.architecture: amd64
image.description: ubuntu 22.04 LTS amd64 (release) (20231026)
image.label: release
image.os: ubuntu
image.release: jammy
image.serial: "20231026"
image.type: squashfs
image.version: "22.04"
limits.cpu: "2"
limits.memory: 2GB
volatile.base_image: 187a9674b77056a0d466f5058ea72660cb52430dcdf06974ca8cd6c5a47fb6b3
volatile.cloud-init.instance-id: e583dc84-7e19-4089-bbb2-e7f04326adab
volatile.eth0.host_name: veth5b719c1a
volatile.eth0.hwaddr: 00:16:3e:73:6d:b2
volatile.eth0.name: eth0
volatile.idmap.base: "0"
volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1000000000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":1000000000}]'
volatile.last_state.power: RUNNING
volatile.uuid: 23c9e221-15bd-448d-8388-afbe65fe0629
volatile.uuid.generation: 23c9e221-15bd-448d-8388-afbe65fe0629
devices:
<network devices omitted>
root:
path: /
pool: default
type: disk
ephemeral: false
profiles:
- custom
stateful: false
description: ""
uname -a on source:
$ uname -a
Linux c1-source 5.4.0-186-generic #206-Ubuntu SMP Fri Apr 26 12:31:10 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
On target:
$ uname -a
Linux c1-target 5.4.0-186-generic #206-Ubuntu SMP Fri Apr 26 12:31:10 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
snap list lxd on source host:
$ snap list lxd
Name Version Rev Tracking Publisher Notes
lxd git-3217ea4 28855 5.0/edge canonical✓ -
snap list lxd on target host:
$ snap list lxd
Name Version Rev Tracking Publisher Notes
lxd 5.19-8635f82 26200 5.19/stable canonical✓ -
zfs versions on both hosts are identical:
$ zfs --version
zfs-0.8.3-1ubuntu12.17
zfs-kmod-0.8.3-1ubuntu12.17
OS version on source host:
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
OS version on target host:
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal