Commit Graph

4 Commits

Author SHA1 Message Date
MasterofJOKers 73fdc6b27a lxc-debian-userns: Handle uid-mapping with lxc-create
lxc-create will pass "--mapped-uid" and "--mapped-gid" into the
template, if there's an "lxc.idmap" option in the config file. We now
support getting these parameters as options.

Since an "lxc.idmap" option in the config makes lxc-create already
change the userns, we cannot support it. Therefore, we error out if we
see these options. Instead, we write the "lxc.idmap" options ourselves
based on the "--uidmap" and "--gidmap" options passed by the user.
2023-03-08 00:29:02 +01:00
MasterofJOKers b5243aaa2b Add lxc-debian-userns LXC template script
This script can be used as LXC template to install a Debian into a
directory using `mmdebstrap`. It's intended use is to create a container
filesystem with appropriate uids/gids for use in an unprivileged
container. The script assumes that it runs as root and only changes the
userns to install Debian.
2023-02-26 00:24:25 +01:00
MasterofJOKers 845e3fe30e Add remap-uid-and-gid-for-lv
I've used this script to remap files' uids/gids of containers created
without a custom userns into their new range.  It's inferior to
`fuidshift` from the `lxc` project in that it doesn't handle ACLs and is
quite slow - probably because it calls a binary for every file.

By default, it runs in debug mode only printing the chown command
instead of executing it. You need to edit the file to use it.

It also only works with LVs (logical volumes from LVM), mounting them
automatically.
2023-02-25 17:15:23 +01:00
MasterofJOKers 271d7009cf Add get-lxc-idmap-config script
This script handles uid/gid ranges for creating unprivileged containers as root.
2023-02-25 17:13:12 +01:00