~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to doc/ecryptfs-pam-doc.txt

  • Committer: mhalcrow@us.ibm.com
  • Date: 2007-11-06 22:56:01 UTC
  • Revision ID: git-v1:f8357de9d554b274497b5cce9db4347254b7e7eb
Initial import of eCryptfs filesystem userspace utilities (mount helper, daemon component,
etc.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
eCryptfs PAM-based Mount
 
2
 
 
3
Mike Halcrow <mhalcrow@us.ibm.com>
 
4
 
 
5
 
 
6
eCryptfs Mounting Overview
 
7
 
 
8
eCryptfs is set up in the Open Client to automatically mount on user
 
9
login. The default mount is an overlay mount on top of
 
10
~/Confidential/, and it uses a passphrase-based key.
 
11
 
 
12
eCryptfs requires that the user's mount passphrase be inserted into
 
13
the user session keyring in order to access the files under the
 
14
~/Confidential/ mount point. The mount passphrase is wrapped
 
15
(encrypted) with the user's login passphrase and is stored in the
 
16
~/.ecryptfs/wrapped-passphrase file. When the user logs in, the
 
17
eCryptfs PAM module intercepts the user's login passphrase, uses it to
 
18
decrypt the wrapped mount passphrase, and inserts the unwrapped mount
 
19
passphrase into the user session keyring.
 
20
 
 
21
Once the user has logged in, his ~/.bash_profile script is executed by
 
22
the Bash shell. A segment of code in ~/.bash_profile checks for the
 
23
existence of a ~/.ecryptfs/auto-mount file. If this file exists, then
 
24
code is executed to mount ~/Confidential/ via eCryptfs.
 
25
 
 
26
When the user changes his login credentials, the eCryptfs PAM module
 
27
unwraps the mount passphrase in ~/.ecryptfs/wrapped-passphrase with
 
28
the user's old passphrase and rewraps the mount passphrase into
 
29
~/.ecryptfs/wrapped-passphrase with the user's new passphrase.
 
30
 
 
31
For more information on eCryptfs, see the Linux Journal article on
 
32
eCryptfs at <http://www.linuxjournal.com/article/9400> or visit
 
33
the eCryptfs web site at <http://ecryptfs.sf.net>
 
34
 
 
35
 
 
36
Setup Overview
 
37
 
 
38
In order for these operations to complete successfully, the eCryptfs
 
39
PAM module needs to be inserted into the PAM stack in
 
40
/etc/pam.d/system-auth, an entry needs to be in /etc/fstab for the
 
41
user's ~/Confidential/ directory, the ~/.ecryptfs/auto-mount and
 
42
~/.ecryptfs/wrapped-passphrase files need to exist, and the mount code
 
43
needs to be in the user's ~/.bash_profile script.
 
44
 
 
45
The following shell script attempts to set all of this up
 
46
automatically:
 
47
 
 
48
http://downloads.sourceforge.net/ecryptfs/ecryptfs-setup-pam-wrapped.sh
 
49
 
 
50
Root executes this script in the following manner:
 
51
 
 
52
./ecryptfs-setup-pam-wrapped.sh user "mount_passphrase" "login_passphrase"
 
53
 
 
54
Where 'user' is the username, 'mount_passphrase' is the passphrase
 
55
used for encrypting files under the eCryptfs mount point, and
 
56
'login_passphrase' is the user's current login passphrase.
 
57
 
 
58
 
 
59
Setup Details
 
60
 
 
61
These instructions detail how to carry out the manual steps that the
 
62
ecryptfs-setup-pam-wrapped.sh tries to do for you automatically.
 
63
 
 
64
The following line needs to be added to /etc/pam.d/system-auth,
 
65
immediately below the line referencing the pam_unix.so module in the
 
66
auth context:
 
67
 
 
68
auth       required     pam_ecryptfs.so unwrap
 
69
 
 
70
The following line needs to be added to /etc/pam.d/system-auth,
 
71
immediately above the line referencing the pam_unix.so module in the
 
72
password context:
 
73
 
 
74
password   required     pam_ecryptfs.so
 
75
 
 
76
The following line needs to be added to /etc/fstab:
 
77
 
 
78
/home/user/Confidential /home/user/Confidential ecryptfs rw,ecryptfs_sig=deadbeefbaadf00d,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,user,noauto, 0 0
 
79
 
 
80
Where 'user' is the username and 'deadbeefbaadf00d' is the mount
 
81
passphrase signature/identifier value. This signature is in /etc/mtab
 
82
after you perform a manual eCryptfs mount.
 
83
 
 
84
The following shell code needs to be appended to the user's
 
85
~/.bash_profile:
 
86
 
 
87
if test -e $HOME/.ecryptfs/auto-mount; then
 
88
  mount | grep "$HOME/Confidential type ecryptfs"
 
89
  if test $? != 0; then
 
90
    mount -i $HOME/Confidential
 
91
  fi
 
92
fi
 
93
ecryptfs-zombie-kill
 
94
 
 
95
The following file must exist:
 
96
 
 
97
~/.ecryptfs/auto-mount
 
98
 
 
99
The following file must contain the mount passphrase, encrypted with
 
100
the user's login passphrase:
 
101
 
 
102
~/.ecryptfs/wrapped-passphrase
 
103
 
 
104
The `ecryptfs-wrap-passphrase' command line utility can be used to
 
105
produce this file:
 
106
 
 
107
ecryptfs_wrap_passphrase ~/.ecryptfs/wrapped-passphrase "passphrase to wrap" "wrapping passphrase"
 
108
 
 
109
With these elements in place, the user should be able to log in and
 
110
have his eCryptfs mount point be created automatically.
 
111
 
 
112
 
 
113
Troubleshooting
 
114
 
 
115
      Problem: The ~/Confidential/ directory is not being mounted on login.
 
116
      Problem: The ~/Confidential/ directory is mounted on login, but
 
117
      the files under the ~/Confidential/ directory cannot be read.
 
118
 
 
119
            Solution: Your ~/.ecryptfs/wrapped-passphrase file may be
 
120
            incorrect. Run ecryptfs-wrap-passphrase to recreate it if
 
121
            that is the case. Otherwise, the PAM stack is not set up
 
122
            correctly. Otherwise, the code to mount your
 
123
            ~/Confidential directory is not in your ~/.bash_profile
 
124
            file.
 
125
 
 
126
      Problem: The ~/Confidential/ directory mounts on console login
 
127
      but not on GDM login.
 
128
 
 
129
            Solution: Make sure you have the most recent
 
130
            ecryptfs-utils package.
 
131
 
 
132
      Problem: Attempts to authenticate to the gnome-screensaver
 
133
      application result in a long pause and a failed attempt.
 
134
 
 
135
            Solution: Your PAM stack is not set up correctly. Make
 
136
            certain that /etc/pam.d/gnome-screensaver does not point
 
137
            to a file in the auth context that includes
 
138
            pam_ecryptfs.so.
 
139
 
 
140
      Problem: How to I backup my encrypted files?
 
141
 
 
142
            Solution: Unmount your ~/Confidential directory so that
 
143
            the lower filesystem files (in encrypted state) show up at
 
144
            that path location, and then copy the files in that
 
145
            directory to another storage device.
 
146
 
 
147
      Problem: How do I recover encrypted files from a backup?
 
148
 
 
149
            Solution: Place the encrypted files into a directory
 
150
            (e.g., /secret) and perform an eCryptfs mount (e.g., mount
 
151
            -t ecryptfs /secret /secret), using your mount passphrase
 
152
            when prompted. If you are unsure of which cipher to
 
153
            select, choose AES-128.
 
154
 
 
155
      Problem: Can I access the lower encrypted files of an active
 
156
      eCryptfs mount?
 
157
 
 
158
            Solution: This is not a good idea. See
 
159
            <http://ecryptfs.sourceforge.net/ecryptfs-faq.html#access_lower>