~mrooney/ecryptfs/nautilus-integration

« back to all changes in this revision

Viewing changes to src/utils/ecryptfs-umount-private

  • Committer: Dustin Kirkland
  • Date: 2009-01-26 18:08:13 UTC
  • Revision ID: git-v1:1abdd21606f764382f2abc8a73abda091ace76fd
clear relevant keys on helper unmount

If the user calls the ecryptfs-umount-private helper, clear the kernel
keyring of the keys used by that private helper.

This should help assuage bug:
https://bugs.launchpad.net/ecryptfs/+bug/313812

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh -e
2
2
# This script unmounts a user's private ecryptfs folder
 
3
# and clears the kernel keyring of the relevant keys
3
4
#
4
5
# Original by Michael Halcrow, IBM
5
6
# Extracted to a stand-alone script by Dustin Kirkland <kirkland@canonical.com>
6
7
 
7
 
/sbin/umount.ecryptfs_private
 
8
out=`/sbin/umount.ecryptfs_private 2>&1`
 
9
if [ -n "$out" ]; then
 
10
        echo "$out"
 
11
fi
 
12
if echo "$out" | grep -q -v "Sessions still open"; then
 
13
        for sig in `cat "$HOME/.ecryptfs/Private.sig"`; do
 
14
                key_id=`keyctl show | grep "$sig$" | awk '{print $1}'`
 
15
                keyctl unlink "$key_id" @u
 
16
        done
 
17
fi