Bug 868330 - ecryptfs-migrate-home fails when run under sudo
ecryptfs-migrate-home fails when run under sudo
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: ecryptfs-utils (Show other bugs)
17
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Michal Hlavinka
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-19 10:17 EDT by Martin Wilck
Modified: 2013-08-02 03:30 EDT (History)
2 users (show)

See Also:
Fixed In Version: ecryptfs-utils-100-6.fc17
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-01 14:46:10 EDT
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)
suggested patch (852 bytes, patch)
2012-10-19 10:17 EDT, Martin Wilck
no flags Details | Diff

  None (edit)
Description Martin Wilck 2012-10-19 10:17:29 EDT
Created attachment 630057 [details]
suggested patch

When ecryptfs-migrate-home is run under sudo, it fails with the error message:

mount: mount(2) failed: No such file or directory

/var/log/messages shows:

Oct 19 15:05:32 cooper kernel: [145335.386171] Could not find key with description: [3ef50ccbb36702dd]
Oct 19 15:05:32 cooper kernel: [145335.386181] process_request_key_err: No key
Oct 19 15:05:32 cooper kernel: [145335.386186] Could not find valid key in user session keyring for sig specified in mount option: [3ef50ccb
b36702dd]
Oct 19 15:05:32 cooper kernel: [145335.386190] One or more global auth toks could not properly register; rc = [-2]
Oct 19 15:05:32 cooper kernel: [145335.386195] Error parsing options; rc = [-2]

This is because under sudo the session keyring is inherited from the UID that called sudo:

[root@cooper martin]# keyctl show
Session Keyring
 323396226 --alswrv   1004    -1  keyring: _uid_ses.1004
 510177860 --alswrv   1004    -1   \_ keyring: _uid.1004
 298885694 --als-rv   1004  1004       \_ user: e17bce6f437104df
1006539220 --als-rv   1004  1004       \_ user: b2875fdadcef9521

However, ecryptfs-add-passphrase (which is called by ecryptfs-setup-private before mounting) inserts the mount key into root's user keyring.

The kernel searches the mount key in the session keyring, not in the user keyring, and fails.

The attached patch illustrates a possible solution to the problem. Running with root privileges, ecryptfs-setup-private can attach to root's keyring before mounting, and the mount command will succeed.
Comment 1 Fedora End Of Life 2013-07-04 03:02:41 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. 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 WONTFIX if it remains open with a Fedora 
'version' of '17'.

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 prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 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 to Fedora 17's end of life.

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.
Comment 2 Fedora End Of Life 2013-08-01 14:46:14 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 3 Michal Hlavinka 2013-08-02 03:30:03 EDT
the fix was released
F17-updates has ecryptfs-utils-103-1.fc17 > ecryptfs-utils-100-6.fc17

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