#785013 ecryptfs-utils: ecryptfs-mount-private fails under screen

Package:
ecryptfs-utils
Source:
ecryptfs-utils
Description:
ecryptfs cryptographic filesystem (utilities)
Submitter:
GI
Date:
2015-05-11 15:24:07 UTC
Severity:
normal
#785013#5
Date:
2015-05-11 15:15:32 UTC
From:
To:
Hi There,

ecryptfs-mount-private fails when running under a screen session that
was re-attached from a different machine. (I set up my private directory
to be non-automounted, non-auto-umounted and using a login independent
wrapping passphrase.)

Here's how it can be re-produced: You need two machines (called deb1 and
deb2) to reproduce the problem. (I'm using the prompt "deb1>" to
indicate a shell prompt on deb1)

    deb1> ssh deb2
    deb2> ssh -t deb1 screen
    (starts a new screen on machine deb1, from deb2)
    screen@deb1> ecryptfs-mount-private
    (works as expected, and ~/Private is mounted)
    screen@deb1> ecryptfs-umount-private
    (works as expected, and ~/Private is unmounted)

Now press Ctrl-A Ctrl -D and detach the screen. Then start a new
terminal on deb1 (without going through the machine deb2) and re-attach
the screen:

    deb1> screen -R -D
    (Attaches to the screen session created from deb2)
    screen@deb1> ecryptfs-mount-private
    Enter your wrapping passphrase:
    Inserted auth tok with sig [bbbbbbbbbbbbbbbb] into the user session keyring
    mount: No such file or directory

Looks like /sbin/mount.ecryptfs_private is what fails and produces the
above message. The keys seem to have been added correctly however:
    screen@deb1>keyctl list @u
    2 keys in keyring:
    575554787: --alswrv  2070   100 user: aaaaaaaaaaaaaaaa
    990744347: --alswrv  2070   100 user: bbbbbbbbbbbbbbbb
    screen@deb1>cat ~/.ecryptfs/Private.sig
    bbbbbbbbbbbbbbbb
    aaaaaaaaaaaaaaaa

It's not serious, since I can work around the problem easily. However it
did take me 2 hours to realize that the problem was with running under a
re-attached screen! (It might be some other weird PAM stuff, but this is
what I can consistently reproduce.)

Best,

Gautam