~nobuto/ecryptfs/verify-wrapped-passphrase

« back to all changes in this revision

Viewing changes to src/utils/ecryptfs-verify

  • Committer: Nobuto MURATA
  • Date: 2013-03-18 15:42:19 UTC
  • Revision ID: nmurata@ashisuto.co.jp-20130318154219-76dtzqsvbxytyh1s
src/utils/ecryptfs-verify: check existence and permission of
wrapped-passphrase (LP: #1156672)

Show diffs side-by-side

added added

removed removed

Lines of Context:
118
118
        fi
119
119
}
120
120
 
 
121
wrapped_passphrase_valid() {
 
122
        local w="$1/.ecryptfs/wrapped-passphrase"
 
123
        if [ -e "$w" ]; then
 
124
                info "[$w] exists"
 
125
        else
 
126
                error "[$w] does not exist"
 
127
        fi
 
128
        local owner=$(stat -c "%U" "$w")
 
129
        if [ "$owner" = "$user" ]; then
 
130
                info "Ownership [$owner] of [$w] is correct"
 
131
        else
 
132
                error "Invalid owner [$owner] of [$w]"
 
133
        fi
 
134
}
 
135
 
121
136
mount_is_home() {
122
137
        local home="$1"
123
138
        local mountfile="$home/.ecryptfs/Private.mnt"
218
233
                        mountfile_valid "$home"
219
234
                        automount_true "$home"
220
235
                        mount_is_home "$home"
 
236
                        wrapped_passphrase_valid "$home"
221
237
                ;;
222
238
                check_private)
223
239
                        ecryptfs_exists "$home"
224
240
                        sigfile_valid "$home"
225
241
                        mountfile_valid "$home"
226
242
                        mount_is_private "$home"
 
243
                        wrapped_passphrase_valid "$home"
227
244
                ;;
228
245
                check_filenames_encrypted)
229
246
                        ecryptfs_exists "$home"