Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 494040 - sys-fs/ecryptfs-utils-103 - auto-umount fails
Summary: sys-fs/ecryptfs-utils-103 - auto-umount fails
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Kernel Miscellaneous
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-12 15:33 UTC by Michelangelo Scopelliti
Modified: 2014-02-16 11:01 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo Scopelliti 2013-12-12 15:33:09 UTC
I've recently started to mess around with ecryptfs.
Before trying anything destructive, I've decided to stick with private directoty setup.
The creation/use of the encrypted directory is fine, but the directory stays mounted even after I log out of the system.
On an ubuntu system, the same version of ecryptfs-utils works as planned.

I suppose that this is a PAM-related issue, but I'm not certain.
Even so, I think that some extra pam.d file and/or some instruction should be added to ebuild.

Reproducible: Always

Steps to Reproduce:
1. emerge ecryptfs-utils
2. setup a private directory (ecryptfs-setup-private --noautomount)
3. ecryptfs-mount-private
4. log out
5. log in again
Actual Results:  
the directory is still mounted

Expected Results:  
no mounted ~/Private directory

emerge --info

Portage 2.2.7 (default/linux/amd64/13.0, gcc-4.8.2, glibc-2.17, 3.12.4 x86_64)
=================================================================
System uname: Linux-3.12.4-x86_64-AMD_A8-3870_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
KiB Mem:    15892200 total,  15359608 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Thu, 12 Dec 2013 07:15:01 +0000
ld ld di GNU (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.3.3
dev-util/cmake:           2.8.12.1-r1
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.14
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0
sys-kernel/linux-headers: 3.12 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo science kernelpanic
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA @EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/tomoyo/conf /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/portage/distfiles"
FCFLAGS="-march=native -O2 -pipe"FEATURES="assume-digests binpkg-logs candy cgroup clean-logs compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/science /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext SECURITY_HAZARD X a52 aac aalib acl adolc aio alisp alsa amd64 amr ao apng audiofile bazaar berkdb bidi bitmap blas bluetooth bs2b bzip2 cairo caps cblas-external cdda cdio chm clang cli compact conntrack consolekit context contrast contrib corefonts cracklib crypt cups curl cvs cxx dbus demosaic detex devil dga dhcp dhcp-tools djbfft djvu dri dts dv dvb dvd dvi2tty dvipdfm ebook ecdsa eigen emf encode epspdf excel exif extensions extra faac facedetect fdk fdt ffmpeg fftw firmware flac fluidsynth fontconfig fontforge fortran fpx frei0r ftp gbm gcj gd gdbm gif gimp git glamor gles gles2 glut gmp gold gpg gpm graphics graphicsmagick graphite graphviz gsl gsm gstreamer gtk gtk2 gtkstyle gts gudev hdri highlight hpn hwdb iconv icu id3tag idn imagemagick imaging inkjar inotify ipython iso ithreads jbig jemalloc jpeg jpeg2k kdrive keymap kmod kpathsea ladspa lame lapack lasi latex lcms ldns lensfun libass libcaca libkms libnotify libsamplerate libsoxr libv4l llvm llvm-shared-libs lqr lto lua luatex lynxkeymap lzma lzo mad mathml matplotlib mdev mem-scramble mercurial metalink metapost metis metric minizip mjpeg mmap mms mmx mmxext mng modplug modules mount mp3 mp3rtp mpeg mpi mpi-threads mudflap multilib multitarget musepack music mysql mysqli natspec ncat ncurses ndiff netlink network network-cron networking newnet nlopt nls normalize nping nptl nsplugin numpy nuv ocr offensive offlinehelp ogg openal opencl openexr opengl openmp openvg opus osmesa pam pango passwdqc pch pcre pdf pdo pgf pkcs11 plotutils plugins png pnm policykit postgres postproc postscript pstricks publishers pvr pyglet python python3 q16 q32 q64 q8 qt3support quicktime quvi r600-llvm-compiler rar raw readline reencrypt rle romio rpc rtmp scale0tilt scanner schroedinger science script sdl secure-delete secure-messaging session smartcard smi smp sndfile sox sparse speex spoof-source sql sqlite sse sse2 sse3 ssl startup-notification subversion suid svg syslog system-cairo system-icu system-jpeg system-sqlite t1lib taglib telepathy tftp tga theora thin-splines threads tiff timezone tls truetype tty-helpers twolame type3 udev udisks umfpack unicode urandom usb v4l vaapi vcd vdpau video vim vim-syntax vorbis vpx wavpack wayland webdav webgl webp wmf wxwidgets x264 xa xattr xcb xcomposite xdg xetex xft xkb xlib-xcb xml xmp xorg xpm xscreensaver xv xvid xvmc yuv4mpeg zlib" ABI_X86="32 64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver presenter-minimizer" LINGUAS="it en fr" OFFICE_IMPLEMENTATION="libreoffice" OPENMPI_FABRICS="knem" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64 armeb" RUBY_TARGETS="ruby20" SANE_BACKENDS="plustek" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2013-12-27 19:19:25 UTC
Without logs or additional information it will be hard to determine what is the issue.

But I guess you are missing the following at /etc/pam.d/system-auth:
---
session        optional       pam_ecryptfs.so
---
Comment 2 Michelangelo Scopelliti 2013-12-29 15:43:46 UTC
(In reply to Alon Bar-Lev from comment #1)
> Without logs or additional information it will be hard to determine what is
> the issue.
> 
> But I guess you are missing the following at /etc/pam.d/system-auth:
> ---
> session        optional       pam_ecryptfs.so
> ---

Yes, one of the problems is that I don't find any log.
Adding the 'session' line to /etc/pam.d/system-auth, the auto mounting/umounting function works; But there is not such an indication neither in the ebuild nor on the site (the reference in man pam_ecryptfs suggests different files, and some precedence -- see relevant page on archlinux wiki, https://wiki.archlinux.org/index.php/ECryptfs -- seems to be required).

Besides that, your suggestion works only if the package is built w/ USE=suid.
If USE=-suid is used, a setreuid error is generated on every mount attempt:

setreuid: operation not permitted

I've tried also to add my user to root group and to a newly created ecryptfs group, but still no go.

What additional information can I add?
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2014-02-15 22:15:12 UTC
(In reply to Michelangelo Scopelliti from comment #2)
> (In reply to Alon Bar-Lev from comment #1)
> > Without logs or additional information it will be hard to determine what is
> > the issue.
> > 
> > But I guess you are missing the following at /etc/pam.d/system-auth:
> > ---
> > session        optional       pam_ecryptfs.so
> > ---
> 
> Yes, one of the problems is that I don't find any log.
> Adding the 'session' line to /etc/pam.d/system-auth, the auto
> mounting/umounting function works; But there is not such an indication
> neither in the ebuild nor on the site (the reference in man pam_ecryptfs
> suggests different files, and some precedence -- see relevant page on
> archlinux wiki, https://wiki.archlinux.org/index.php/ECryptfs -- seems to be
> required).
> 
> Besides that, your suggestion works only if the package is built w/ USE=suid.
> If USE=-suid is used, a setreuid error is generated on every mount attempt:
> 
> setreuid: operation not permitted
> 
> I've tried also to add my user to root group and to a newly created ecryptfs
> group, but still no go.
> 
> What additional information can I add?

Please confirm that all is working.

Basically these are the instructions of upstream[1][2].

Following upstream instructions and understanding that privilege escalation requires the suid should be sufficient.

So I am closing, ebuilds are not replacements to project documentation.

[1] http://linux.die.net/man/8/pam_ecryptfs
[2] http://linux.die.net/man/1/mount.ecryptfs_private
Comment 4 Michelangelo Scopelliti 2014-02-16 11:01:40 UTC
> Please confirm that all is working.
> 
> Basically these are the instructions of upstream[1][2].
> 
> Following upstream instructions and understanding that privilege escalation
> requires the suid should be sufficient.
> 
> So I am closing, ebuilds are not replacements to project documentation.
> 
> [1] http://linux.die.net/man/8/pam_ecryptfs
> [2] http://linux.die.net/man/1/mount.ecryptfs_private

Well, it's working, but I'm not convinced.

You're right, ebuilds are not replacements to documentation. Yet, it is my opinion that current ebuild is slightly misleading.

The ebuild issues a warning about using a suid binary, and that is naturally correct; but the ebuild should also warn the user about the fact that,, without suid, a 'private' mount is impossible, unless the user installs and configures appropriately pam_mount (see, for example,
https://wiki.sabayon.org/index.php?title=ECryptfs ).

Just my 2c.