Bug 1480793 - ecryptfs-mount-private fails to mount if passphrase is not on root's keyring
ecryptfs-mount-private fails to mount if passphrase is not on root's keyring
Status: NEW
Product: Fedora
Classification: Fedora
Component: ecryptfs-utils (Show other bugs)
26
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michal Hlavinka
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-11 17:53 EDT by Andre Costa
Modified: 2017-08-14 19:37 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andre Costa 2017-08-11 17:53:34 EDT
Description of problem:
I can't get ecryptfs-mount-private to work on F26 (it worked on F25). After a lot of testing (and help from peers on ask.fedoraproject.org [*]), I figured out a pattern. Actually, there seems to be more than one bug involved, but I'll concentrate on the keyring issue.

[*] https://ask.fedoraproject.org/en/question/109144/ecryptfs-mount-private-not-working-on-f26/?answer=109452#post-id-109452


Version-Release number of selected component (if applicable):
ecryptfs-utils-111-2.fc25.x86_64


How reproducible:
Always.

Steps to Reproduce:
1. run ecryptfs-mount-private (after configuring it with ecryptfs-setup-private --no-fnek --noautomount) as a regular user
2.
3.

Actual results:
Enter your login passphrase:
Inserted auth tok with sig [XXX] into the user session keyring
mount: No such file or directory

Expected results:
~/.Private should be properly mounted on ~/Private

Additional info:
If I add mount passphrase signature on root's keyring, it works as expected:
~ sudo ecryptfs-add-passphrase
[sudo] password for costa: 
Passphrase: 
Inserted auth tok with sig [XXX] into the user session keyring
~ ecryptfs-mount-private 
Enter your login passphrase:
Inserted auth tok with sig [XXX] into the user session keyring
# mount worked

If I remove the key, it starts failing again:

~ sudo keyctl list @u
1 key in keyring:
438925633: --alswrv     0     0 user: XXX
~ sudo keyctl unlink 438925633 @u
~ sudo keyctl list @u
keyring is empty
~ ecryptfs-mount-private 
Enter your login passphrase:
Inserted auth tok with sig [XXX] into the user session keyring
mount: No such file or directory

The other issue is that both ecryptfs-mount-private and ecryptfs-umount-private increment/decrement /dev/shm/ecryptfs-$USER-Private even if they fail. I will file a separate issue for this.
Comment 1 Andre Costa 2017-08-11 18:05:52 EDT
Filed bug #1480795
Comment 2 Michal Hlavinka 2017-08-14 08:32:11 EDT
Do you have something "different" on your machine? I'm not able to reproduce this.

Fresh new virtual machine with Fedora 26, new user "qemuser", added to group ecryptfs


[qemuser@f26 ~]$ ecryptfs-setup-private --no-fnek --noautomount
Enter your login passphrase [qemuser]: 
Enter your mount passphrase [leave blank to generate one]: 

************************************************************************
YOU SHOULD RECORD YOUR MOUNT PASSPHRASE AND STORE IT IN A SAFE LOCATION.
  ecryptfs-unwrap-passphrase ~/.ecryptfs/wrapped-passphrase
THIS WILL BE REQUIRED IF YOU NEED TO RECOVER YOUR DATA AT A LATER TIME.
************************************************************************

INFO: /home/qemuser/Private will not be mounted on login
/usr/sbin/restorecon
/usr/sbin/restorecon

Done configuring.

Testing mount/write/umount/read...
Inserted auth tok with sig [ad1cef28d3a3ba22] into the user session keyring
Inserted auth tok with sig [ad1cef28d3a3ba22] into the user session keyring
Testing succeeded.

Logout, and log back in to begin using your encrypted directory.


[qemuser@f26 ~]$ ecryptfs-mount-private
Enter your login passphrase:
Inserted auth tok with sig [ad1cef28d3a3ba22] into the user session keyring


[qemuser@f26 ~]$ mount | grep ecryptfs
/home/qemuser/.Private on /home/qemuser/Private type ecryptfs (rw,nosuid,nodev,relatime,ecryptfs_sig=ad1cef28d3a3ba22,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_unlink_sigs)


Even SElinux is enabled in enforcing mode.


------
I CAN reproduce this, when I become qemuser from root with "su qemuser", in that case it will fail the same way as you've described. But it's to be expected, as after "su qemuser" environment was not (re)set correctly for qemuser and you are still partially original user (root in this case).
Comment 3 Andre Costa 2017-08-14 19:37:54 EDT
As far as I am concerned, there is nothing different with this machine -- but there could be something different with my user.

I also tried creating a new user on my machine, and did the same process of creating ~/.Private for him. To my surprise, it worked out of the box. The only difference I can see is that my user has sudo rights (it has been created as a "Administrator"), while this test user I created was a regular account.

The upgrade to F26 has followed the same procedure I've been using for quite some time already: I preserve /home (which is on a separate partition), and reformat / and swap. I'm using ext4 on LVM.

What kind of info can I provide you to help you narrow down the cause of the problem? Any SELinux data? LVM?

Note You need to log in before you can comment on or make changes to this bug.