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: 2018-05-03 04:19 EDT (History)
6 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?
Comment 4 Sebastian Pölsterl 2017-08-31 16:08:49 EDT
I'm experiencing the same problem.

It seems to be related to an issue in systemd: https://github.com/systemd/systemd/pull/6286 (via https://bugs.archlinux.org/task/54670).
Comment 5 Sebastian Pölsterl 2017-10-09 16:16:36 EDT
The fix from the systemd issue above (https://github.com/systemd/systemd/pull/6342) can be applied manually by manually linking the user and session keyring via

keyctl link @u @s

before running ecryptfs-mount-private
Comment 6 Fedora End Of Life 2018-05-03 04:19:40 EDT
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

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