Comment 3 for bug 366140

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

The following two patches are in no way intended to be applied, they're just for
conversation.

The one against mount.ecryptfs_private makes it use capabilities instead of
setuid. If we do a mount, it puts cap_sys_admin and cap_dac_override in
pE so it can do mount(2) and write to /etc/mtab.

Currently for umount, mount.ecryptfs_private does execl("/bin/umount"). So
the patch puts those capabilities in pI in the hopes that umount will have
them in fI.

The /bin/umount patch is needed because ordinarily umount refuses to unmount
an entry not in fstab unless the caller is euid=0. So the patch instead checks
whether the needed capabilities are in pE.

Finally, with these patches applied you need to do

  capset cap_sys_admin,cap_dac_override=pe /sbin/mount.ecryptfs_private
  capset cap_sys_admin,cap_dac_override=ie /bin/umount