Unfortunately, 'lxc-execute' does not seem to set it up right. If I create an LXC named "foo" and run 'lxc-execute -n foo /bin/bash", what I get appears equivalent to the whole root filesystem being mounted -o rbind,rw in the container. If I su to my user account, I see the entire contents of the account's home directory; if I create a file there, it shows up in the real home directory, and if I delete one, it gets deleted in the real home directory. Everyhing is read-write and suid binaries are still suid... In short, it looks like this is a good deal less protection than I would get from something like this:
Code: Select all
for x in lib bin sbin usr etc dev proc sys var tmp; do
mkdir -p /sandbox/$x
mount --rbind /$x /sandbox/$x
mount -o remount,ro,nosuid /sandbox/$x
done
mkdir -p /sandbox/home/username
chown username:users /sandbox/home/username
cp /home/username/.Xauthority /sandbox/home/username
chroot --userspec=username /sandbox /bin/bash